NAME
Crypt::Schnorr::AuthSign - Schnorr Authentication & Signature Protocols
VERSION
$Revision: 1.10 $
$Date: 2001/05/26 15:54:53 $
SYNOPSIS
use Crypt::Schnorr::AuthSign;
$schnorr = new Crypt::Schnorr::AuthSign;
$schnorr->qsize(512); # Use a 512 bit modulus.
$schnorr->keygen(Name => 'Test User'); # Create a new keypair.
$req = $schnorr->authreq(); # Create auth request.
$c = $schnorr->challenge($req); # Generate auth challenge.
$response = $schnorr->response($c); # Respond to a challenge.
$auth = $schnorr->verify($response); # Verify auth response.
$sign = $schnorr->sign($m); # Create a signature for $m.
$valid = $schnorr->verify($sign, $m); # Verify signature on $m.
DESCRIPTION
This module implements the basic Schnorr authentication and signature protocols. It supports zlib compression, Radix64 encoding for exported keys and protocol packets, and a simple method for binding metadata to keys. It does not provide any key management functions or maintain a key database.
CONSTRUCTOR
DATA METHODS
- qsize()
-
Sets the QSIZE instance variable which can be used to change the bitlength of the prime 'q' which is the modulus for most of the calculations in the protocol. A smaller prime, 'p' (q=pk+1) is also used - its bitlength is dependent on the choice of q.
- secretkey()
-
If called without parameters, returns the Crypt::Schnorr::Key object corresponding to the active secret key. If passed a Crypt::Schnorr::Key object, makes that key the currently active secret key.
- pubkey()
-
If called without parameters, returns the Crypt::Schnorr::Key object corresponding to the active public key. If passed a Crypt::Schnorr::Key object, makes that key the currently active public key.
- version()
-
Sets the VERSION instance variable which can be used to change the Version: string on the generated protocol packets to whatever you like. If called without parameters, simply returns the value of the VERSION instance variable.
- comment()
-
Sets the COMMENT instance variable which can be used to change the Comment: string on the generated protocol packets to whatever you like. If called without parameters, simply returns the value of the COMMENT instance variable.
- debug()
-
Sets the DEBUG instance variable which causes the module to emit debugging information if set to a true value. If called without parameters, simply returns the value of the DEBUG instance variable.
- hash()
-
Sets or fetches the HASH instance variable - a coderef. The referenced routine should compute a message digest of it's first argument and return the digest as a decimal or hex number.
OBJECT METHODS
- keygen(%metainfo)
-
Generates new public key parameters, creates a new keypair, and binds the name/value pairs of %metainfo with it. Sets the active secret and public keys to the generated keypair. Returns undef if there was an error, otherwise returns a filehandle that reports the progress of the key generation process.
- authreq()
-
Creates and returns an authorization request. Saves parameters associated with the request for use in the rest of the authorization protocol.
- challenge($authreq)
-
Generates and returns a challenge to the authorization request in $authreq, and saves the request parameters for use in the rest of the authorization protocol.
- response($challenge)
-
Generates and returns a response to the authorization challenge in $challenge, using some of the information saved by the last call to authreq().
- sign($message)
-
Computes a message digest of $message, and returns a signature on this message digest. The message digest is computed using the default hash routine (SHA1 with Digest::SHA1) or the hash routine set with the last call to hash().
- verify($response)
-
Attempts to verify the response packet $response against the currently active public key, which should previously have been set by a call to pubkey() or some other method. Returns true iff the authorization succeeded.
KEY OBJECT METHODS
- new($keypacket)
-
Creates a new Crypt::Schnorr::Key object and initializes it from the key information in $keypacket. The $keypacket argument is required.
- export()
-
Returns a Radix64 encoded representation of the key.
- meta()
-
Allows metadata access. Provide a label to retrieve the value associated with it, provide a label/value pair and it will be associated with the key, replacing the old value if metadata with the specified label already exists. If called without parameters, will return a list containing all metadata key/value pairs.
AUTHOR
Crypt::Schnorr::AuthSign is Copyright (c) 2001 Ashish Gulhati <hash@netropolis.org>. All Rights Reserved.
LICENSE
This code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
DISCLAIMER
This is free software. If it breaks, you own both parts.