Convert-PEM
view release on metacpan or search on metacpan
as the name of the object in the PEM-encoded content. For example,
given the string "FOO BAR", the output from *encode* will start with
a header like:
-----BEGIN FOO BAR-----
*Name* is a required argument.
* ASN
An ASN.1 description of the content to be either encoded or decoded.
*ASN* is an optional argument.
* Macro
If your ASN.1 description (in the *ASN* parameter) includes more
than one ASN.1 macro definition, you will want to use the *Macro*
parameter to specify which definition to use when encoding/decoding
objects. For example, if your ASN.1 description looks like this:
may be either PEM or DER. Default is "PEM".
If "DER" is specified, encryption options are ignored when using the
*write* method and the file is written as an uncrypted blob. This
option does not affect the *encode* behavior.
*OutForm* is an optional argument.
$obj = $pem->decode(%args)
Decodes, and, optionally, decrypts a PEM file, returning the object as
decoded by *Convert::ASN1*. The difference between this method and
*read* is that *read* reads the contents of a PEM file on disk; this
method expects you to pass the PEM contents as an argument.
If an error occurs while reading the file or decrypting/decoding the
contents, the function returns *undef*, and you should check the error
message using the *errstr* method (below).
*%args* can contain:
* Content
* Cipher
The Cipher to use if a password is provided. This is an optional
argument; if not provided, the default of DES-EDE3-CBC will be used
or the cipher configured is $Convert::PEM::DefaultCipher. See below
for a list of supported ciphers.
$obj = $pem->read(%args)
Reads, decodes, and, optionally, decrypts a PEM file, returning the
object as decoded by *Convert::ASN1* (or binary blob if ASN.1
description was not provided). This is implemented as a wrapper around
*decode*, with the bonus of reading the PEM file from disk for you.
If an error occurs while reading the file or decrypting/decoding the
contents, the function returns *undef*, and you should check the error
message using the *errstr* method (below).
In addition to the arguments that can be passed to the *decode* method
(minus the *Content* argument), *%args* can contain:
lib/Convert/PEM.pm view on Meta::CPAN
as the name of the object in the PEM-encoded content. For example, given
the string C<FOO BAR>, the output from I<encode> will start with a
header like:
-----BEGIN FOO BAR-----
I<Name> is a required argument.
=item * ASN
An ASN.1 description of the content to be either encoded or decoded.
I<ASN> is an optional argument.
=item * Macro
If your ASN.1 description (in the I<ASN> parameter) includes more than
one ASN.1 macro definition, you will want to use the I<Macro> parameter
to specify which definition to use when encoding/decoding objects.
For example, if your ASN.1 description looks like this:
lib/Convert/PEM.pm view on Meta::CPAN
I<write> method and the file is written as an uncrypted blob. This option
does not affect the I<encode> behavior.
I<OutForm> is an optional argument.
=back
=head2 $obj = $pem->decode(%args)
Decodes, and, optionally, decrypts a PEM file, returning the
object as decoded by I<Convert::ASN1>. The difference between this
method and I<read> is that I<read> reads the contents of a PEM file
on disk; this method expects you to pass the PEM contents as an
argument.
If an error occurs while reading the file or decrypting/decoding
the contents, the function returns I<undef>, and you should check
the error message using the I<errstr> method (below).
I<%args> can contain:
lib/Convert/PEM.pm view on Meta::CPAN
The Cipher to use if a password is provided. This is an optional
argument; if not provided, the default of B<DES-EDE3-CBC> will be used
or the cipher configured is B<$Convert::PEM::DefaultCipher>. See below
for a list of supported ciphers.
=back
=head2 $obj = $pem->read(%args)
Reads, decodes, and, optionally, decrypts a PEM file, returning
the object as decoded by I<Convert::ASN1> (or binary blob if ASN.1
description was not provided). This is implemented as a wrapper
around I<decode>, with the bonus of reading the PEM file from disk
for you.
If an error occurs while reading the file or decrypting/decoding
the contents, the function returns I<undef>, and you should check
the error message using the I<errstr> method (below).
In addition to the arguments that can be passed to the I<decode>
method (minus the I<Content> argument), I<%args> can contain:
( run in 0.467 second using v1.01-cache-2.11-cpan-49f99fa48dc )