Crypt::OpenPGP::Armour(3p)

NAME
Crypt::OpenPGP::Armour - ASCII Armouring and Unarmouring

SYNOPSIS
    use Crypt::OpenPGP::Armour;

    my $armoured = Crypt::OpenPGP::Armour->armour(
                           Data => "foo bar baz",
                           Object => "FOO OBJECT",
                           Headers => {
                                         Version => '0.57',
                                         Comment => 'FooBar',
                                      },
                     );

    my $decoded = Crypt::OpenPGP::Armour->unarmour( $armoured ) or
        die Crypt::OpenPGP::Armour->errstr;

DESCRIPTION
This module converts arbitrary-length strings of binary octets into Base64-encoded ASCII messages suitable for transfer as text. It also converts in the opposite direction, taking an armoured message and returning the binary data, along with headers.

USAGE

  Crypt::OpenPGP::Armour->armour( %args )
Converts arbitrary-length strings of binary octets in an encoded message containing 4 parts: head and tail markers that identify the type of content contained therein; a group of newline-separated headers at the top of the message; Base64-encoded data; and a Base64-encoded CRC24 checksum of the message body.

Returns undef on failure, the encoded message on success. In the case of failure call the class method errstr to get the error message.

%args can contain:

•   Object

    Specifies the type of object being armoured; the string "PGP " (PGP followed by a space) will be prepended to the value you pass in.

    This argument is required.

•   Data

    The binary octets to be encoded as the body of the armoured message; these octets will be encoded into ASCII using MIME::Base64.

    This argument is required.

•   Headers

    A reference to a hash containing key-value pairs, where the key is the name of the header and the value the header value. These headers are placed at the top of the encoded message in the form "Header: Value".

•   NoVersion

    Boolean flag; if true, then default Version header will not be added to the armour.

  Crypt::OpenPGP::Armour->unarmour($message)
Decodes an ASCII-armoured message and returns a hash reference whose keys are the arguments provided to armour, above. Returns undef on failure (for example, if the checksum fails to match, or if the message is in an incomprehensible format). In case of failure call the class method errstr to get the text of the error message.

AUTHOR & COPYRIGHTS
Please see the Crypt::OpenPGP manpage for author, copyright, and license information.