COM.claymoresystems.provider
Class RSASignature

java.lang.Object
  extended by java.security.SignatureSpi
      extended by java.security.Signature
          extended by COM.claymoresystems.provider.RSASignature
All Implemented Interfaces:
Blindable

public class RSASignature
extends java.security.Signature
implements Blindable

This class implements RSA signature w/ PKCS#1 padding but no DigestInfo encoding because Cryptix doesn't and SSL requires it for Client Auth.

We assume that we already have an RSAEncryption primitive floating around.


Field Summary
 
Fields inherited from class java.security.Signature
SIGN, state, UNINITIALIZED, VERIFY
 
Fields inherited from class java.security.SignatureSpi
appRandom
 
Constructor Summary
RSASignature()
           
 
Method Summary
protected  java.lang.Object engineGetParameter(java.lang.String param)
           SPI: There aren't any parameters
protected  void engineInitSign(java.security.PrivateKey key)
          SPI: Initializes this object for signing using the private key
protected  void engineInitVerify(java.security.PublicKey key)
          SPI: Initializes this object for verification using the given key
protected  void engineSetParameter(java.lang.String param, java.lang.Object value)
           SPI: There aren't any parameters
protected  byte[] engineSign()
           SPI: Sign the input
protected  void engineUpdate(byte b)
          SPI: Single byte updates are forbidden
protected  void engineUpdate(byte[] b, int off, int len)
          SPI: Updates the data.
protected  boolean engineVerify(byte[] signature)
           SPI: Verify the input
 void setBlindingInfo(java.security.SecureRandom rng, CryptixRSAPublicKey pubKey)
          set the RNG for blinding
protected  byte[] sigToBytes(java.math.BigInteger num)
           
 
Methods inherited from class java.security.Signature
clone, getAlgorithm, getInstance, getInstance, getInstance, getParameter, getParameters, getProvider, initSign, initSign, initVerify, initVerify, setParameter, setParameter, sign, sign, toString, update, update, update, update, verify, verify
 
Methods inherited from class java.security.SignatureSpi
engineGetParameters, engineInitSign, engineSetParameter, engineSign, engineUpdate, engineVerify
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RSASignature

public RSASignature()
Method Detail

engineInitVerify

protected void engineInitVerify(java.security.PublicKey key)
                         throws java.security.InvalidKeyException
SPI: Initializes this object for verification using the given key

Specified by:
engineInitVerify in class java.security.SignatureSpi
Parameters:
key - the public key
Throws:
java.security.InvalidKeyException - if the key class doesn't implement CryptixRSAPublicKey

engineInitSign

protected void engineInitSign(java.security.PrivateKey key)
                       throws java.security.InvalidKeyException
SPI: Initializes this object for signing using the private key

Specified by:
engineInitSign in class java.security.SignatureSpi
Parameters:
key - the private key
Throws:
java.security.InvalidKeyException - if the key class doesn't implement than CryptixRSAPrivateKey

engineUpdate

protected void engineUpdate(byte b)
                     throws java.security.SignatureException
SPI: Single byte updates are forbidden

Specified by:
engineUpdate in class java.security.SignatureSpi
Throws:
java.security.SignatureException - if you do a single byte update

engineUpdate

protected void engineUpdate(byte[] b,
                            int off,
                            int len)
                     throws java.security.SignatureException
SPI: Updates the data. This can only be called once with a single data value or we throw an error

Specified by:
engineUpdate in class java.security.SignatureSpi
Parameters:
b - the buffer containing the data
off - the offset into the buffer
len - the length
Throws:
java.security.SignatureException - either if the algorithm was improperly initialized or you try to call update more than once

engineSign

protected byte[] engineSign()
                     throws java.security.SignatureException
SPI: Sign the input

Specified by:
engineSign in class java.security.SignatureSpi
Returns:
a signature as a byte string
Throws:
java.security.SignatureException - bad input

engineVerify

protected boolean engineVerify(byte[] signature)
                        throws java.security.SignatureException
SPI: Verify the input

Specified by:
engineVerify in class java.security.SignatureSpi
Returns:
true or false
Throws:
java.security.SignatureException - bad input

setBlindingInfo

public void setBlindingInfo(java.security.SecureRandom rng,
                            CryptixRSAPublicKey pubKey)
set the RNG for blinding

Specified by:
setBlindingInfo in interface Blindable
Parameters:
rng - a secure RNG

engineSetParameter

protected void engineSetParameter(java.lang.String param,
                                  java.lang.Object value)
                           throws java.security.InvalidParameterException
SPI: There aren't any parameters

Specified by:
engineSetParameter in class java.security.SignatureSpi
Throws:
java.security.InvalidParameterException

engineGetParameter

protected java.lang.Object engineGetParameter(java.lang.String param)
                                       throws java.security.InvalidParameterException
SPI: There aren't any parameters

Specified by:
engineGetParameter in class java.security.SignatureSpi
Throws:
java.security.InvalidParameterException

sigToBytes

protected byte[] sigToBytes(java.math.BigInteger num)


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