The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Crypt::PKCS10 - parse PKCS #10 certificate requests

SYNOPSIS

use Crypt::PKCS10;

my $decoded = Crypt::PKCS10->new( $csr );
my $cn = $decoded->commonName();

REQUIRES

Convert::ASN1

DESCRIPTION

Crypt::PKCS10 parses PKCS #10 requests and provides accessor methods to extract the requested data. First, the request will be parsed using the included ASN.1 definition. Common object identifiers will be translated to their corresponding names. Additionally, accessor methods allow to extract single data fields. Bit Strings like signatures will be printed in their hexadecimal representation.

METHODS

new

Constructor, creates a new object containing the parsed PKCS #10 request. It takes the request itself as an argument. PEM and DER encoding is supported.

use Crypt::PKCS10;
my $decoded = Crypt::PKCS10->new( $csr );

commonName

Returns the common name as stored in the request.

my $cn = $decoded->commonName();

organizationalUnitName

Returns the organizational unit name.

emailAddress

Returns the email address.

stateOrProvinceName

Returns the state or province name.

countryName

Returns the country name.

version

The version is stored as an Integer where 0 means 'v1'. Note, there is an offset by one!

pkAlgorithm

Returns the public key algorithm according to its object identifier.

subjectPublicKey

The public key will be returned in its hexadecimal representation

signatureAlgorithm

Returns the signature algorithm according to its object identifier.

signature

The signature will be returned in its hexadecimal representation

attributes

A request may contain a set of attributes. This method returns a reference to a hash consisting of all attributes.

%attributes = $decoded->attributes;
print Dumper(\%attributes);

certificateTemplate

CertificateTemplate is an attribute widely used by Windows certification authorities.

AUTHORS

Gideon Knocke

COPYRIGHT

This software is copyright (c) 2014 by Gideon Knocke.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

Terms of the Perl programming language system itself

a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or

b) the "Artistic License"