Perl Diver 2.33
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

Crypt::DSA::Key

Name Crypt::DSA::Key
Version 1.17
Located at /usr/share/perl5
File /usr/share/perl5/Crypt/DSA/Key.pm
Is Core No
Search CPAN for this module Crypt::DSA::Key
Documentation Crypt::DSA::Key
Module Details Crypt::DSA::Key

NAME

Crypt::DSA::Key - DSA key


SYNOPSIS

    use Crypt::DSA::Key;
    my $key = Crypt::DSA::Key->new;
    $key->p($p);


DESCRIPTION

Crypt::DSA::Key contains a DSA key, both the public and private portions. Subclasses of Crypt::DSA::Key implement read and write methods, such that you can store DSA keys on disk, and read them back into your application.


USAGE

Any of the key attributes can be accessed through combination get/set methods. The key attributes are: p, q, g, priv_key, and pub_key. For example:

    $key->p($p);
    my $p2 = $key->p;

$key = Crypt::DSA::Key->new(%arg)

Creates a new (empty) key object. All of the attributes are initialized to 0.

Alternately, if you provide the Filename parameter (see below), the key will be read in from disk. If you provide the Type parameter (mandatory if Filename is provided), be aware that your key will actually be blessed into a subclass of Crypt::DSA::Key. Specifically, it will be the class implementing the specific read functionality for that type, eg. Crypt::DSA::Key::PEM.

Returns the key on success, undef otherwise. (See Password for one reason why new might return undef).

%arg can contain:

$key->write(%arg)

Writes a key (optionally) to disk, using a format that you define with the Type parameter.

If your $key object has a defined priv_key (private key portion), the key will be written as a DSA private key object; otherwise, it will be written out as a public key. Note that not all serialization mechanisms can produce public keys in this version--currently, only PEM public keys are supported.

%arg can include:

  • TypeType
    The type of file format that you wish to write. PEM is one example (in fact, currently, it's the only example).

    This argument is mandatory, unless your $key object is already blessed into a subclass (eg. Crypt::DSA::Key::PEM), and you wish to write the file using the same subclass.

  • FilenameFilename
    The location of the file on disk where you want the key file to be written.

  • PasswordPassword
    If you want the key file to be encrypted, provide this argument, and the ASN.1-encoded string will be encrypted using the passphrase as a key.

$key->size

Returns the size of the key, in bits. This is actually the number of bits in the large prime p.


AUTHOR & COPYRIGHTS

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

Perl Diver brought to you by ScriptSolutions.com © 1997- 2026