Crypt-OpenPGP

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

        function can handle both asymmetric and symmetric encryption.

        See the *PassphraseCallback* parameter for *decrypt*, below.

  $pgp->encrypt( %args )
    Encrypts a block of data. The encryption is actually done with a
    symmetric cipher; the key for the symmetric cipher is then encrypted
    with either the public key of the recipient or using a passphrase that
    you enter. The former case is using public-key cryptography, the latter,
    standard symmetric ciphers. In the first case, the session key can only
    be unlocked by someone with the corresponding secret key; in the second,
    it can only be unlocked by someone who knows the passphrase.

    Given the parameter *SignKeyID* (see below), *encrypt* will first sign
    the message before encrypting it, adding a Signature packet to the
    encrypted plaintext.

    Returns a block of data containing two PGP packets: the encrypted
    symmetric key and the encrypted data.

    On failure returns "undef".

README  view on Meta::CPAN

            Foo Bar <foo@bar.com>

        The *Identity* is used to build a User ID packet that is stored in
        each of the returned keyblocks.

        This is a required argument.

    *   Passphrase

        String with which the secret key will be encrypted. When read in
        from disk, the key can then only be unlocked using this string.

        This is a required argument.

    *   Version

        Specifies the key version; defaults to version 4 keys. You should
        only set this to version 3 if you know why you are doing so (for
        backwards compatibility, most likely). Version 3 keys only support
        RSA.

lib/Crypt/OpenPGP.pm  view on Meta::CPAN


=back

=head2 $pgp->encrypt( %args )

Encrypts a block of data. The encryption is actually done with a symmetric
cipher; the key for the symmetric cipher is then encrypted with either
the public key of the recipient or using a passphrase that you enter. The
former case is using public-key cryptography, the latter, standard
symmetric ciphers. In the first case, the session key can only be
unlocked by someone with the corresponding secret key; in the second, it
can only be unlocked by someone who knows the passphrase.

Given the parameter I<SignKeyID> (see below), I<encrypt> will first sign
the message before encrypting it, adding a Signature packet to the
encrypted plaintext.

Returns a block of data containing two PGP packets: the encrypted
symmetric key and the encrypted data.

On failure returns C<undef>.

lib/Crypt/OpenPGP.pm  view on Meta::CPAN

    Foo Bar <foo@bar.com>

The I<Identity> is used to build a User ID packet that is stored in
each of the returned keyblocks.

This is a required argument.

=item * Passphrase

String with which the secret key will be encrypted. When read in from
disk, the key can then only be unlocked using this string.

This is a required argument.

=item * Version

Specifies the key version; defaults to version C<4> keys. You should
only set this to version C<3> if you know why you are doing so (for
backwards compatibility, most likely). Version C<3> keys only support
RSA.

lib/Crypt/OpenPGP/Certificate.pm  view on Meta::CPAN

    use Crypt::OpenPGP::Certificate;

    my $dsa_secret_key = Crypt::OpenPGP::Key::Secret->new( 'DSA' );
    my $cert = Crypt::OpenPGP::Certificate->new(
        Key => $dsa_secret_key,
        Version => 4,
        Passphrase => 'foobar',
    );
    my $serialized = $cert->save;

    # Unlock the locked certificate (using the passphrase from above)
    $cert->unlock( 'foobar' );

=head1 DESCRIPTION

I<Crypt::OpenPGP::Certificate> encapsulates a PGP key certificate
for any underlying public-key algorithm, for public and secret keys,
and for master keys and subkeys. All of these scenarios are handled
by the same I<Certificate> class.

A I<Crypt::OpenPGP::Certificate> object wraps around a

lib/Crypt/OpenPGP/Certificate.pm  view on Meta::CPAN


Returns the number of days that the certificate is valid for version
3 keys.

=head2 $cert->is_secret

Returns true if the certificate holds a secret key, false otherwise.

=head2 $cert->is_protected

Returns true if the certificate is locked, false otherwise.

=head2 $cert->is_subkey

Returns true if the certificate is a subkey, false otherwise.

=head2 $cert->can_encrypt

Returns true if the public key algorithm for the certificate I<$cert>
can perform encryption/decryption, false otherwise.



( run in 0.915 second using v1.01-cache-2.11-cpan-26ccb49234f )