de.flexiprovider.core.rsa
Class RSAPrivateCrtKey

java.lang.Object
  |
  +--de.flexiprovider.api.keys.PrivateKey
        |
        +--de.flexiprovider.core.rsa.interfaces.RSAPrivateKey
              |
              +--de.flexiprovider.core.rsa.interfaces.RSAPrivateCrtKey
                    |
                    +--de.flexiprovider.core.rsa.RSAPrivateCrtKey
All Implemented Interfaces:
Key, java.security.Key, java.security.PrivateKey, RSAKey, java.security.interfaces.RSAKey, java.security.interfaces.RSAPrivateCrtKey, java.security.interfaces.RSAPrivateKey, java.io.Serializable
Direct Known Subclasses:
MeRSAPrivateKey, MpRSAPrivateKey

public class RSAPrivateCrtKey
extends RSAPrivateCrtKey

This class implements the RSAPrivateCrtKey interface. It represents a RSA private key with additional information (for the RSA decryption with the CRT) and is usually instantiated from RSAKeyPairGenerator.

Author:
Thomas Wahrenbruch
See Also:
RSAKeyPairGenerator, Serialized Form

Field Summary
protected  FlexiBigInt crtCoeff
          The CRT coefficient q-1 mod p.
protected  FlexiBigInt d
          The private exponent d.
protected  FlexiBigInt dP
          The number d mod (p-1).
protected  FlexiBigInt dQ
          The number d mod (q-1).
protected  FlexiBigInt e
          The public exponent e.
protected  FlexiBigInt n
          The number n = p*q.
protected  FlexiBigInt p
          The prime p.
protected  FlexiBigInt q
          The prime q.
 
Fields inherited from interface java.security.PrivateKey
serialVersionUID
 
Constructor Summary
  RSAPrivateCrtKey(FlexiBigInt n, FlexiBigInt e, FlexiBigInt d, FlexiBigInt p, FlexiBigInt q, FlexiBigInt dP, FlexiBigInt dQ, FlexiBigInt crtCoeff)
          Generate a new RSA private key.
protected RSAPrivateCrtKey(RSAPrivateCrtKeySpec keySpec)
          Construct an RSAPrivCrtKey out of the given key specification.
 
Method Summary
 boolean equals(java.lang.Object other)
          Compare this key with another object.
protected  codec.asn1.ASN1Type getAlgParams()
           
 FlexiBigInt getCRTCoeff()
           
 FlexiBigInt getD()
           
 FlexiBigInt getDp()
           
 FlexiBigInt getDq()
           
 FlexiBigInt getE()
           
protected  byte[] getKeyData()
           
 FlexiBigInt getN()
           
protected  codec.asn1.ASN1ObjectIdentifier getOID()
           
 FlexiBigInt getP()
           
 FlexiBigInt getQ()
           
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class de.flexiprovider.core.rsa.interfaces.RSAPrivateCrtKey
getCrtCoefficient, getPrimeExponentP, getPrimeExponentQ, getPrimeP, getPrimeQ, getPublicExponent
 
Methods inherited from class de.flexiprovider.core.rsa.interfaces.RSAPrivateKey
getAlgorithm, getModulus, getPrivateExponent
 
Methods inherited from class de.flexiprovider.api.keys.PrivateKey
getEncoded, getFormat
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.security.interfaces.RSAPrivateKey
getPrivateExponent
 
Methods inherited from interface java.security.Key
getAlgorithm, getEncoded, getFormat
 
Methods inherited from interface java.security.interfaces.RSAKey
getModulus
 

Field Detail

n

protected FlexiBigInt n
The number n = p*q.

d

protected FlexiBigInt d
The private exponent d.

e

protected FlexiBigInt e
The public exponent e.

p

protected FlexiBigInt p
The prime p.

q

protected FlexiBigInt q
The prime q.

dP

protected FlexiBigInt dP
The number d mod (p-1).

dQ

protected FlexiBigInt dQ
The number d mod (q-1).

crtCoeff

protected FlexiBigInt crtCoeff
The CRT coefficient q-1 mod p.
Constructor Detail

RSAPrivateCrtKey

public RSAPrivateCrtKey(FlexiBigInt n,
                        FlexiBigInt e,
                        FlexiBigInt d,
                        FlexiBigInt p,
                        FlexiBigInt q,
                        FlexiBigInt dP,
                        FlexiBigInt dQ,
                        FlexiBigInt crtCoeff)
Generate a new RSA private key.
Parameters:
n - the number n = p*q;
e - the public exponent e.
d - the private exponent d.
p - the prime p.
q - the prime q.
dP - the number d mod (p-1).
dQ - the number d mod (q-1).
crtCoeff - the coefficient for RSA decryption with the CRT.
See Also:
RSAKeyPairGenerator

RSAPrivateCrtKey

protected RSAPrivateCrtKey(RSAPrivateCrtKeySpec keySpec)
Construct an RSAPrivCrtKey out of the given key specification.
Parameters:
keySpec - the key specification
Method Detail

getN

public FlexiBigInt getN()
Returns:
the n n

getE

public FlexiBigInt getE()
Overrides:
getE in class RSAPrivateCrtKey
Returns:
the public exponent e

getD

public FlexiBigInt getD()
Overrides:
getD in class RSAPrivateKey
Returns:
the private exponent d

getP

public FlexiBigInt getP()
Overrides:
getP in class RSAPrivateCrtKey
Returns:
the prime p

getQ

public FlexiBigInt getQ()
Overrides:
getQ in class RSAPrivateCrtKey
Returns:
the prime q

getDp

public FlexiBigInt getDp()
Overrides:
getDp in class RSAPrivateCrtKey
Returns:
the private exponent d mod (p-1)

getDq

public FlexiBigInt getDq()
Overrides:
getDq in class RSAPrivateCrtKey
Returns:
the private exponent d mod (q-1)

getCRTCoeff

public FlexiBigInt getCRTCoeff()
Overrides:
getCRTCoeff in class RSAPrivateCrtKey
Returns:
the CRT coefficient

equals

public boolean equals(java.lang.Object other)
Compare this key with another object.
Overrides:
equals in class java.lang.Object
Parameters:
other - the other object
Returns:
the result of the comparison

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a human readable form of the key

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getOID

protected codec.asn1.ASN1ObjectIdentifier getOID()
Overrides:
getOID in class PrivateKey
Returns:
the OID to encode in the SubjectPublicKeyInfo structure

getAlgParams

protected codec.asn1.ASN1Type getAlgParams()
Overrides:
getAlgParams in class PrivateKey
Returns:
the algorithm parameters to encode in the SubjectPublicKeyInfo structure

getKeyData

protected byte[] getKeyData()
Overrides:
getKeyData in class PrivateKey
Returns:
the keyData to encode in the SubjectPublicKeyInfo structure