Crypt::OpenPGP::MDC - MDC packet


NAME

Crypt::OpenPGP::MDC - MDC (modification detection code) packet


SYNOPSIS

    use Crypt::OpenPGP::MDC;
    my $mdc = Crypt::OpenPGP::MDC->new( Data => 'foobar' );
    my $digest = $mdc->digest;
    my $serialized = $mdc->save;
    my $mdc = Crypt::OpenPGP::MDC->parse($buffer);
    my $digest = $mdc->digest;


DESCRIPTION

Crypt::OpenPGP::MDC is a PGP MDC (modification detection code) packet. Such a packet is used alongside Encrypted-MDC data packets so that modifications to the ciphertext can be detected. The MDC packet contains a SHA-1 digest of the plaintext for comparison with the decrypted plaintext.

You generally will never need to construct a Crypt::OpenPGP::MDC packet yourself; usage is by the Crypt::OpenPGP::Ciphertext object.


USAGE

Crypt::OpenPGP::MDC->new( [ Data => $data ] )

Creates a new MDC packet object and returns that object. If you do not supply any data $data, the object is created empty; this is used, for example, in parse (below), to create an empty packet which is then filled from the data in the buffer.

If you wish to initialize a non-empty object, supply new with the Data parameter along with a value $data. $data should contain the plaintext prefix (length = cipher blocksize + 2), the actual plaintext, and two octets corresponding to the hex digits 0xd3 and 0x14.

$mdc->save

Returns the text of the MDC packet; this is the digest of the data passed to new (above) as $data, for example.

Crypt::OpenPGP::MDC->parse($buffer)

Given $buffer, a Crypt::OpenPGP::Buffer object holding (or with offset pointing to) an MDC packet, returns a new <Crypt::OpenPGP::MDC> object, initialized with the MDC data in the buffer.

$mdc->digest

Returns the MDC digest data (eg. the string passed as $data to new, above).


AUTHOR & COPYRIGHTS

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

 Crypt::OpenPGP::MDC - MDC packet