Perl Diver 2.31
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

Convert::PEM::CBC

Name Convert::PEM::CBC
Version
Located at /usr/share/perl5/vendor_perl
File /usr/share/perl5/vendor_perl/Convert/PEM/CBC.pm
Is Core No
Search CPAN for this module Convert::PEM::CBC
Documentation Convert::PEM::CBC
Module Details Convert::PEM::CBC

NAME

Convert::PEM::CBC - Cipher Block Chaining Mode implementation


SYNOPSIS

    use Convert::PEM::CBC;
    my $cbc = Convert::PEM::CBC->new(
                         Cipher     => 'Crypt::DES_EDE3',
                         Passphrase => 'foo'
           );
    my $plaintext = 'foo bar baz';
    $cbc->encrypt($plaintext);


DESCRIPTION

Convert::PEM::CBC implements the CBC (Cipher Block Chaining) mode for encryption/decryption ciphers; the CBC is designed for compatability with OpenSSL and may not be compatible with other implementations (such as SSH).


USAGE

$cbc = Convert::PEM::CBC->new(%args)

Creates a new Convert::PEM::CBC object and initializes it. Returns the new object.

%args can contain:

$cbc->encrypt($plaintext)

Encrypts the plaintext $plaintext using the underlying cipher implementation in CBC mode, and returns the ciphertext.

If any errors occur, returns undef, and you should check the errstr method to find out what went wrong.

$cbc->decrypt($ciphertext)

Decrypts the ciphertext $ciphertext using the underlying cipher implementation in CBC mode, and returns the plaintext.

If any errors occur, returns undef, and you should check the errstr method to find out what went wrong.

$cbc->iv

Returns the current initialization vector. One use for this might be to grab the initial value of the IV if it's created randomly (ie. you haven't provided an IV argument to new):

    my $cbc = Convert::PEM::CBC->new( Cipher => $cipher );
    my $iv = $cbc->iv;   ## Generated randomly in 'new'.

Convert::PEM uses this to write the IV to the PEM file when encrypting, so that it can be known when trying to decrypt the file.

$cbc->errstr

Returns the value of the last error that occurred. This should only be considered meaningful when you've received undef from one of the functions above; in all other cases its relevance is undefined.


AUTHOR & COPYRIGHTS

Please see the Convert::PEM manpage for author, copyright, and license information.

Perl Diver brought to you by ScriptSolutions.com © 1997- 2025