OpenCard  
 
OCF, the OpenCard Framework is a standard Java framework for working with Smart Cards.  
 

opencard.opt.security
Class RSASignCredential

java.lang.Object
  |
  +--opencard.opt.security.RSASignCredential

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

Sample credential to perform a RSA 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 RSA signing algorithm. This credential can be used for external authentication.

See Also:
PKACredential, SignCredential

Constructor Summary
RSASignCredential(RSACRTKey privateKey)
          Constructor using an RSA private key that has parameters for Chinese Remaineder Theorem (CRT) computation.
RSASignCredential(RSAPrivateKey privateKey)
          Constructor using an RSA private key
 
Method Summary
 int getInputLength()
           
 byte[] sign(byte[] data)
          Compute a signature over a block of data.
protected  byte[] unsign(byte[] data, boolean reverse)
          Internal routine: Cope with stupid Java signed BigInteger arrays ^%$^&#%&@^*%#@%^%
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RSASignCredential

public RSASignCredential(RSACRTKey privateKey)
Constructor using an RSA private key that has parameters for Chinese Remaineder Theorem (CRT) computation.

RSASignCredential

public RSASignCredential(RSAPrivateKey privateKey)
Constructor using an RSA 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().
Throws:
OpenCardRuntimeException - Invalid input block length or invalid key.

getInputLength

public int getInputLength()
Specified by:
getInputLength in interface SignCredential

unsign

protected byte[] unsign(byte[] data,
                        boolean reverse)
Internal routine: Cope with stupid Java signed BigInteger arrays ^%$^&#%&@^*%#@%^%
Parameters:
data - Byte array to be made 'unsigned'
reverse - Set if reversal to little endian format is required
Returns:
byte array that has a high probability of representing an unsigned BigInteger