Convert-PEM
view release on metacpan or search on metacpan
* AES-192-CBC
* AES-256-CBC
* CAMELLIA-128-CBC
* CAMELLIA-192-CBC
* CAMELLIA-256-CBC
* IDEA-CBC
* SEED-CBC
Convert::PEM->has_cipher(*$cipher_name*)
Will see if the cipher is supported and is configured with an encryption
module.
Convert::PEM->has_cipher_module(*$cipher_name*)
Will see if the cipher is supported and if the configured encryption
module is usable. If it is not usable, will return "undef". If it is
usable, will return the name of the cipher module.
Convert::PEM->set_cipher_module($cipher,$module[,$all])
This function/method is used to specify a module name for a supported
cipher. It accepts 2 or 3 arguments.
Convert::PEM->set_cipher_module(<cipher_name>, <module_name>[,0])
or
$OBJ->set_cipher_module(<cipher_name>, <module_name>[,0])
"cipher_name"
A supported cipher name. Use Convert::PEM::list_ciphers() to
retrieve a list of supported ciphers.
"module_name"
A cipher module. The module must support the following methods:
$cipher_object = Cipher->new($key)
$cipher_object->encrypt($plaintext)
$cipher_object->decrypt($ciphertext)
$cipher_object->blocksize()
"all"
An optional boolean argument. If true will replace the modules for
all supported ciphers matching the cipher being set. Default is
true. If setting a cipher, only set this to false if it is desired
to use a separate cipher for different key lengths of the same
algorithm.
Convert::PEM->list_cipher_modules([$cipher_name])
If a *cipher_name* is provided, will return the module configured for
the matching cipher name or "undef" if cipher is not supported. If
*cipher_name* is not provided, will return a list of modules names
configured as an array in array context or as a colon separated list in
scalar context.
Here is a list of the cipher modules used by default.
* Crypt::DES
* Crypt::DES_EDE3
* Crypt::Rijndael - "AES-128-CBC, AES-192-CBC and AES-256-CBC"
* Crypt::Camellia - "CAMELLIA-128-CBC, CAMELLIA-192-CBC and
CAMELLIA-256-CBC"
* Crypt::IDEA
* Crypt::SEED
ERROR HANDLING
If an error occurs in any of the above methods, the method will return
"undef". You should then call the method *errstr* to determine the
source of the error:
$pem->errstr
In the case that you do not yet have a *Convert::PEM* object (that is,
if an error occurs while creating a *Convert::PEM* object), the error
can be obtained as a class method:
Convert::PEM->errstr
For example, if you try to decode an encrypted object, and you do not
give a passphrase to decrypt the object:
my $obj = $pem->read( Filename => "encrypted.pem" )
or die "Decryption failed: ", $pem->errstr;
LICENSE
Convert::PEM is free software; you may redistribute it and/or modify it
under the same terms as Perl itself.
AUTHOR & COPYRIGHTS
Except where otherwise noted, Convert::PEM is Copyright Benjamin Trott,
cpan@stupidfool.org. All rights reserved.
( run in 0.549 second using v1.01-cache-2.11-cpan-39bf76dae61 )