opencard.opt.security
Class RSACRTKey

java.lang.Object
  extended by opencard.opt.security.RSACRTKey
All Implemented Interfaces:
java.io.Serializable, java.security.Key, java.security.PrivateKey

public class RSACRTKey
extends java.lang.Object
implements java.security.PrivateKey

Contains an RSA key in a form suitable for fast signing via the chinese remainder's algorithm

. In this package OpenCard provides key classes for common algorithms like RSA, DSA (or DES) that each concrete card service implementing a card service interface should support instead of defining its own key classes. Only for new PKA algorithms that OpenCard does not yet support a card service may define its own key classes.

Version:
$Id: RSACRTKey.java,v 1.1.1.1 1999/10/05 15:08:48 damke Exp $
Author:
Michael Baentsch (mib@zurich.ibm.com)
See Also:
PrivateKey, Serialized Form

Field Summary
protected  java.math.BigInteger dp
          d mod (p-1)
protected  java.math.BigInteger dq
          d mod (q-1)
protected  int inputLength
          input data length
protected  int keyLength
          Key length (in bits)
protected  int outputLength
          output data length
protected  java.math.BigInteger p
          Prime p
protected  java.math.BigInteger q
          Prime q
protected  java.math.BigInteger qm
          (inverse of q) mod p
 
Fields inherited from interface java.security.PrivateKey
serialVersionUID
 
Constructor Summary
RSACRTKey(java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger qm, java.math.BigInteger dp, java.math.BigInteger dq)
          Produce an RSACRTKey from the given BigIntegers.
RSACRTKey(byte[] p, byte[] q, byte[] qm, byte[] dp, byte[] dq, int inputLength, int outputLength, int keyLength)
          Produce an RSACRTKey from the given byte arrays.
 
Method Summary
 java.math.BigInteger coefficient()
          Coefficient of CRT representation.
 java.math.BigInteger exponent1()
          First Exponent of CRT representation.
 java.math.BigInteger exponent2()
          Second Exponent of CRT representation.
 java.lang.String getAlgorithm()
          Conformance to the java.security interface
 byte[] getEncoded()
          Conformance to the java.security interface
 java.lang.String getFormat()
          Conformance to the java.security interface
 int getInputLength()
          Returns the number of bytes to be input into a signing operation with this key.
 int maxOutputLength()
          Returns the number of bytes to be generated by a signing operation with this key.
 java.math.BigInteger prime1()
          First Prime of CRT representation.
 java.math.BigInteger prime2()
          Second Prime of CRT representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

p

protected java.math.BigInteger p
Prime p


q

protected java.math.BigInteger q
Prime q


qm

protected java.math.BigInteger qm
(inverse of q) mod p


dp

protected java.math.BigInteger dp
d mod (p-1)


dq

protected java.math.BigInteger dq
d mod (q-1)


inputLength

protected int inputLength
input data length


outputLength

protected int outputLength
output data length


keyLength

protected int keyLength
Key length (in bits)

Constructor Detail

RSACRTKey

public RSACRTKey(byte[] p,
                 byte[] q,
                 byte[] qm,
                 byte[] dp,
                 byte[] dq,
                 int inputLength,
                 int outputLength,
                 int keyLength)
Produce an RSACRTKey from the given byte arrays.

Parameters:
p - Prime p.
q - Prime q.
qm - (inverse of q) mod p
dp - d mod (p-1)
dq - d mod (q-1)
inputLength - Number of bytes accepted for input to signature routine.
outputLength - Number of bytes produced by signature routine.
keyLength - The nominal size of the key in bits.

RSACRTKey

public RSACRTKey(java.math.BigInteger p,
                 java.math.BigInteger q,
                 java.math.BigInteger qm,
                 java.math.BigInteger dp,
                 java.math.BigInteger dq)
Produce an RSACRTKey from the given BigIntegers.

Parameters:
p - Prime p.
q - Prime q.
qm - (inverse of q) mod p
dp - d mod (p-1)
dq - d mod (q-1)
Method Detail

coefficient

public java.math.BigInteger coefficient()
Coefficient of CRT representation.

Returns:
Coefficient of CRT representation ((inverse of q) mod p)

exponent1

public java.math.BigInteger exponent1()
First Exponent of CRT representation.

Returns:
First Exponent of CRT representation

exponent2

public java.math.BigInteger exponent2()
Second Exponent of CRT representation.

Returns:
Second exponent of CRT representation

getAlgorithm

public java.lang.String getAlgorithm()
Conformance to the java.security interface

Specified by:
getAlgorithm in interface java.security.Key
See Also:
PrivateKey

getEncoded

public byte[] getEncoded()
Conformance to the java.security interface

Specified by:
getEncoded in interface java.security.Key
See Also:
PrivateKey

getFormat

public java.lang.String getFormat()
Conformance to the java.security interface

Specified by:
getFormat in interface java.security.Key
See Also:
PrivateKey

getInputLength

public int getInputLength()
Returns the number of bytes to be input into a signing operation with this key.

Returns:
Input data length.

maxOutputLength

public int maxOutputLength()
Returns the number of bytes to be generated by a signing operation with this key.

Returns:
Output data length.

prime1

public java.math.BigInteger prime1()
First Prime of CRT representation.

Returns:
First prime of CRT representation

prime2

public java.math.BigInteger prime2()
Second Prime of CRT representation.

Returns:
Second prime of CRT representation