opencard.opt.security
Class DSASignCredential

java.lang.Object
  extended by opencard.opt.security.DSASignCredential
All Implemented Interfaces:
Credential, PKACredential, SignCredential

public class DSASignCredential
extends java.lang.Object
implements PKACredential, SignCredential

Sample credential to perform a DSA signing operation. This credential does not hash a message nor pad input blocks which are too small. It only accepts data which matches the key's input length and performs the raw DSA algorithm. This credential can be used for external authentication.

See Also:
PKACredential, SignCredential

Field Summary
protected  java.security.Signature JCAsignature
           
protected  java.security.interfaces.DSAPrivateKey privKey
           
 
Constructor Summary
DSASignCredential(java.security.interfaces.DSAPrivateKey privateKey)
          Constructor using a DSA private key
 
Method Summary
 int getInputLength()
          Return the input length that the cryptographic algorithm can process.
 byte[] sign(byte[] data)
          Compute a signature over a block of data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

privKey

protected java.security.interfaces.DSAPrivateKey privKey

JCAsignature

protected java.security.Signature JCAsignature
Constructor Detail

DSASignCredential

public DSASignCredential(java.security.interfaces.DSAPrivateKey privateKey)
Constructor using a DSA private key

Method Detail

sign

public byte[] sign(byte[] data)
            throws OpenCardRuntimeException
Compute a signature over a block of data.

Specified by:
sign in interface SignCredential
Parameters:
data - Data to be signed. Must have length getInputLength().
Returns:
the signature/cryptogram
Throws:
OpenCardRuntimeException - Invalid input block length or invalid key.

getInputLength

public int getInputLength()
Description copied from interface: SignCredential
Return the input length that the cryptographic algorithm can process.

Specified by:
getInputLength in interface SignCredential
Returns:
int