Crypt::DSA - DSA Signatures and Key Generation |
keygen(%arg)
sign(%arg)
verify(%arg)
Crypt::DSA - DSA Signatures and Key Generation
use Crypt::DSA; my $dsa = Crypt::DSA->new;
my $key = $dsa->keygen( Size => 512, Seed => $seed, Verbosity => 1 );
my $sig = $dsa->sign( Message => "foo bar", Key => $key );
my $verified = $dsa->verify( Message => "foo bar", Signature => $sig, Key => $key, );
Crypt::DSA is an implementation of the DSA (Digital Signature Algorithm) signature verification system. The implementation itself is pure Perl, although the heavy-duty mathematics underneath are provided by the Math::Pari library.
This package provides DSA signing, signature verification, and key generation.
The Crypt::DSA public interface is similar to that of Crypt::RSA. This was done intentionally.
Constructs a new Crypt::DSA object. At the moment this isn't particularly useful in itself, other than being the object you need to do much else in the system.
Returns the new object.
keygen(%arg)
Generates a new set of DSA keys, including both the public and private portions of the key.
%arg can contain:
This argument is mandatory.
This is entirely optional, and if not provided a random seed will be generated automatically.
The default is 0.
sign(%arg)
Signs a message (or the digest of a message) using the private portion of the DSA key and returns the signature.
The signature is a hash reference with two keys: s and r.
%arg can include:
You must provide either this argument or Message (see below).
This argument is required.
my $sign = $dsa->sign(Message => $message, ... );
is a shorter way of writing
use Digest::SHA1 qw( sha1 ); my $sig = $dsa->sign(Digest => sha1( $message ), ... );
verify(%arg)
Verifies a signature generated with sign. Returns a true value on success and false on failure.
%arg can contain:
This argument is required.
This argument is required.
Either this argument or Message (see below) must be present.
Benjamin Trott, ben@rhumba.pair.com
Except where otherwise noted, Crypt::DSA is Copyright 2001 Benjamin Trott. All rights reserved. Crypt::DSA is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
Crypt::DSA - DSA Signatures and Key Generation |