Crypt::OpenPGP::S2k.3pm

Langue: en

Version: 2001-08-10 (mandriva - 01/05/08)

Section: 3 (Bibliothèques de fonctions)

NAME

Crypt::OpenPGP::S2k - String-to-key generation

SYNOPSIS

     use Crypt::OpenPGP::S2k;
 
 
     my $s2k = Crypt::OpenPGP::S2k->new('Salt_Iter');
     my $key = $s2k->generate($passphrase, $keysize);
 
 
     my $serialized = $s2k->save;
 
 

DESCRIPTION

Crypt::OpenPGP::S2k implements string-to-key generation for use in generating symmetric cipher keys from standard, arbitrary-length passphrases (like those used to lock secret key files). Since a passphrase can be of any length, and key material must be a very specific length, a method is needed to translate the passphrase into the key. The OpenPGP RFC defines three such methods, each of which this class implements.

USAGE


Crypt::OpenPGP::S2k->new($type)

Creates a new type of S2k-generator of type $type; valid values for $type are "Simple", "Salted", and "Salt_Iter". These generator types are described in the OpenPGP RFC section 3.6.

Returns the new S2k-generator object.

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

Given a buffer $buffer of type Crypt::OpenPGP::Buffer, determines the type of S2k from the first octet in the buffer (one of the types listed above in new), then creates a new object of that type and initializes the S2k state from the buffer $buffer. Different initializations occur based on the type of S2k.

Returns the new S2k-generator object.

$s2k->save

Serializes the S2k object and returns the serialized form; this form will differ based on the type of S2k.

$s2k->generate($passphrase, $keysize)


$s2k->generate($passphrase, $keysize)

Given a passphrase $passphrase, which should be a string of octets of arbitrary length, and a keysize $keysize, generates enough key material to meet the size $keysize, and returns that key material.

AUTHOR & COPYRIGHTS

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