au.net.aba.crypto.provider
Class RSAPrivKeyCrt

java.lang.Object
  |
  +--au.net.aba.crypto.provider.RSAPrivKey
        |
        +--au.net.aba.crypto.provider.RSAPrivKeyCrt

public class RSAPrivKeyCrt
extends RSAPrivKey
implements java.security.interfaces.RSAPrivateCrtKey

A class for ABA RSA private keys that can use the Chinese Remainder Theorem.

See Also:
Serialized Form

Field Summary
protected  java.math.BigInteger dP
           
protected  java.math.BigInteger dQ
           
protected  java.math.BigInteger exponent
          The public exponent.
static java.lang.String ident
           
protected  java.math.BigInteger p
          The larger of the two prime factors.
protected  java.math.BigInteger pMinus1
          p-1 [calculated].
protected  java.math.BigInteger q
          The smaller of the two prime factors.
protected  java.math.BigInteger qInv
          The multiplicative inverse of q % p [calculated].
protected  java.math.BigInteger qMinus1
          q-1 [calculated].
 
Fields inherited from class au.net.aba.crypto.provider.RSAPrivKey
d, ident, modulus
 
Fields inherited from interface java.security.PrivateKey
serialVersionUID
 
Fields inherited from interface java.security.Key
serialVersionUID
 
Constructor Summary
RSAPrivKeyCrt()
          Construct an empty RSAPrivKey.
RSAPrivKeyCrt(java.math.BigInteger modulus, java.math.BigInteger exponent, java.math.BigInteger d, java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger dP, java.math.BigInteger dQ, java.math.BigInteger qInv)
          Construct an RSAPrivKeyCrt the appropriate big numbers
RSAPrivKeyCrt(byte[] encKey)
           
 
Method Summary
 java.math.BigInteger getCrtCoefficient()
          Returns the crtCoefficient.
 byte[] getEncoded()
          Return an encoded representation for this key.
 java.lang.String getFormat()
          Return the format this key is in.
 java.math.BigInteger getPrimeExponentP()
          Returns the primeExponentP.
 java.math.BigInteger getPrimeExponentQ()
          Returns the primeExponentQ.
 java.math.BigInteger getPrimeP()
          Returns the prime P.
 java.math.BigInteger getPrimeQ()
          Returns the prime Q.
 java.math.BigInteger getPublicExponent()
          Returns the public exponent.
 java.lang.String toString()
          Generate a String representation of this key.
 
Methods inherited from class au.net.aba.crypto.provider.RSAPrivKey
getAlgorithm, getModulus, getPrivateExponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ident

public static final java.lang.String ident

exponent

protected java.math.BigInteger exponent
The public exponent.

p

protected java.math.BigInteger p
The larger of the two prime factors.

q

protected java.math.BigInteger q
The smaller of the two prime factors.

qInv

protected java.math.BigInteger qInv
The multiplicative inverse of q % p [calculated].

pMinus1

protected java.math.BigInteger pMinus1
p-1 [calculated].

qMinus1

protected java.math.BigInteger qMinus1
q-1 [calculated].

dP

protected java.math.BigInteger dP

dQ

protected java.math.BigInteger dQ
Constructor Detail

RSAPrivKeyCrt

public RSAPrivKeyCrt()
Construct an empty RSAPrivKey.

RSAPrivKeyCrt

public RSAPrivKeyCrt(byte[] encKey)

RSAPrivKeyCrt

public RSAPrivKeyCrt(java.math.BigInteger modulus,
                     java.math.BigInteger exponent,
                     java.math.BigInteger d,
                     java.math.BigInteger p,
                     java.math.BigInteger q,
                     java.math.BigInteger dP,
                     java.math.BigInteger dQ,
                     java.math.BigInteger qInv)
Construct an RSAPrivKeyCrt the appropriate big numbers
Parameters:
modulus - the modulus.
exponent - the public exponent.
d - the private exponent.
p - the prime p.
q - the prime q.
dP - the prime exponent p.
dQ - the prime exponent q.
qInv - the CRT coefficient.
Method Detail

getFormat

public java.lang.String getFormat()
Description copied from class: RSAPrivKey
Return the format this key is in. This returns "ABA" which indicates the encoded key is the form of a byte array whose contents form the string "modulus.exponent" (ie the String returned from the toString() method. This format is compatible with the AsciiEncodedKeySpec.
Overrides:
getFormat in class RSAPrivKey

getEncoded

public byte[] getEncoded()
Description copied from class: RSAPrivKey
Return an encoded representation for this key. Returns a byte array that forms the string "modulus.exponent".
Overrides:
getEncoded in class RSAPrivKey
Tags copied from class: RSAPrivKey
See Also:
RSAPrivKey.getFormat(), RSAPrivKey.toString()

getPublicExponent

public java.math.BigInteger getPublicExponent()
Returns the public exponent.
Specified by:
getPublicExponent in interface java.security.interfaces.RSAPrivateCrtKey
Returns:
the public exponent.

getPrimeP

public java.math.BigInteger getPrimeP()
Returns the prime P.
Specified by:
getPrimeP in interface java.security.interfaces.RSAPrivateCrtKey
Returns:
the prime P.

getPrimeQ

public java.math.BigInteger getPrimeQ()
Returns the prime Q.
Specified by:
getPrimeQ in interface java.security.interfaces.RSAPrivateCrtKey
Returns:
the prime Q.

getPrimeExponentP

public java.math.BigInteger getPrimeExponentP()
Returns the primeExponentP.
Specified by:
getPrimeExponentP in interface java.security.interfaces.RSAPrivateCrtKey
Returns:
the primeExponentP.

getPrimeExponentQ

public java.math.BigInteger getPrimeExponentQ()
Returns the primeExponentQ.
Specified by:
getPrimeExponentQ in interface java.security.interfaces.RSAPrivateCrtKey
Returns:
the primeExponentQ.

getCrtCoefficient

public java.math.BigInteger getCrtCoefficient()
Returns the crtCoefficient.
Specified by:
getCrtCoefficient in interface java.security.interfaces.RSAPrivateCrtKey
Returns:
the crtCoefficient.

toString

public java.lang.String toString()
Generate a String representation of this key.
Overrides:
toString in class RSAPrivKey
Returns:
The key as a string.