COM.claymoresystems.provider

Class RawDSASignature

public class RawDSASignature extends Signature

A class to perform DSA signature and verification.

This is necessary because Sun's provider does not do raw mode.

See FIPS PUB 186, ANSI X9.57

Author: EKR

Constructor Summary
RawDSASignature(String name)
RawDSASignature()
Method Summary
protected ObjectengineGetParameter(String param)
SPI: There aren't any parameters
protected voidengineInitSign(PrivateKey key)
SPI: Initializes this object for signing using the private key
protected voidengineInitVerify(PublicKey key)
SPI: Initializes this object for verification using the given key
protected voidengineSetParameter(String param, Object value)
SPI: There aren't any parameters
protected byte[]engineSign()
Sign the input, following FIPS-186.
protected voidengineUpdate(byte b)
SPI: Single byte updates are forbidden for Raw DSA.
protected voidengineUpdate(byte[] b, int off, int len)
SPI: Updates the digest.
protected booleanengineVerify(byte[] signature)
SPI: Raw Verify

Constructor Detail

RawDSASignature

public RawDSASignature(String name)

RawDSASignature

public RawDSASignature()

Method Detail

engineGetParameter

protected Object engineGetParameter(String param)
SPI: There aren't any parameters

engineInitSign

protected void engineInitSign(PrivateKey key)
SPI: Initializes this object for signing using the private key

Parameters: key the private key

Throws: InvalidKeyException if the key class doesn't implement than DSAPrivateKey

engineInitVerify

protected void engineInitVerify(PublicKey key)
SPI: Initializes this object for verification using the given key

Parameters: key the public key

Throws: InvalidKeyException if the key class doesn't implement than DSAPublicKey

engineSetParameter

protected void engineSetParameter(String param, Object value)
SPI: There aren't any parameters

engineSign

protected byte[] engineSign()
Sign the input, following FIPS-186. The signature is encoded following ANSI X9.57: DSSSignature ::= SEQUENCE { r INTEGER, s INTEGER }

Throws: SignatureException if the engine isn't initialized properly

engineUpdate

protected void engineUpdate(byte b)
SPI: Single byte updates are forbidden for Raw DSA.

Throws: SignatureException bad input

engineUpdate

protected void engineUpdate(byte[] b, int off, int len)
SPI: Updates the digest. Since we're doing raw DSA, this must be a 20 byte string. This can only be called once with a single digest value or we throw an error

Parameters: b the buffer containing the digest off the offset into the buffer len the length (must be 20)

Throws: SignatureException either if the algorithm was improperly initialized or you try to call update more than once

engineVerify

protected boolean engineVerify(byte[] signature)
SPI: Raw Verify

Throws: SignatureException bad input

Copyright (c) 1999-2001 Claymore Systems, Inc., All Rights Reserved.