GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Crypt::OpenPGP::S2k(3) User Contributed Perl Documentation Crypt::OpenPGP::S2k(3)

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

    use Crypt::OpenPGP::S2k;

    # S2k generates an encryption key from a passphrase; in order to
    # understand how large of a key to generate, we need to know which
    # cipher we're using, and what the passphrase is.
    my $cipher = Crypt::OpenPGP::Cipher->new( '...' );
    my $passphrase = 'foo';

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

    my $serialized = $s2k->save;

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.

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.7.

Returns the new S2k-generator object.

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.

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

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.

Please see the Crypt::OpenPGP manpage for author, copyright, and license information.
2015-08-16 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.