Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.java.security.key.rsa
Class GnuRSAPrivateKey  view GnuRSAPrivateKey download GnuRSAPrivateKey.java

java.lang.Object
  extended bygnu.java.security.key.rsa.GnuRSAKey
      extended bygnu.java.security.key.rsa.GnuRSAPrivateKey
All Implemented Interfaces:
java.security.Key, java.security.PrivateKey, java.security.interfaces.RSAKey, java.security.interfaces.RSAPrivateCrtKey, java.security.interfaces.RSAPrivateKey, java.io.Serializable

public class GnuRSAPrivateKey
extends GnuRSAKey
implements java.security.PrivateKey, java.security.interfaces.RSAPrivateCrtKey

An object that embodies an RSA private key.

References:

  1. RSA-PSS Signature Scheme with Appendix, part B.
    Primitive specification and supporting documentation.
    Jakob Jonsson and Burt Kaliski.


Field Summary
private  java.math.BigInteger d
          The private exponent of an RSA private key.
private static boolean DEBUG
           
private  java.math.BigInteger dP
          The first factor's exponent.
private  java.math.BigInteger dQ
          The second factor's exponent.
private  java.math.BigInteger p
          The first prime divisor of the modulus.
private  java.math.BigInteger q
          The second prime divisor of the modulus.
private  java.math.BigInteger qInv
          The CRT (Chinese Remainder Theorem) coefficient.
private  java.lang.String str
          String representation of this key.
 
Fields inherited from class gnu.java.security.key.rsa.GnuRSAKey
defaultFormat
 
Fields inherited from interface java.security.PrivateKey
serialVersionUID
 
Fields inherited from interface java.security.interfaces.RSAPrivateCrtKey
serialVersionUID
 
Constructor Summary
GnuRSAPrivateKey(java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger e, java.math.BigInteger d)
          Convenience constructor.
GnuRSAPrivateKey(int preferredFormat, java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger e, java.math.BigInteger d)
          Constructs a new instance of a GnuRSAPrivateKey given the designated arguments.
GnuRSAPrivateKey(int preferredFormat, java.math.BigInteger n, java.math.BigInteger e, java.math.BigInteger d, java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger dP, java.math.BigInteger dQ, java.math.BigInteger qInv)
          Constructs a new instance of a GnuRSAPrivateKey given the designated arguments.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns true if the designated object is an instance of this class and has the same RSA parameter values as this one.
 java.math.BigInteger getCrtCoefficient()
          Returns the CRT coefficient
 byte[] getEncoded(int format)
          Returns the encoded form of this private key according to the designated format.
 java.math.BigInteger getPrimeExponentP()
          Returns the primeExponentP
 java.math.BigInteger getPrimeExponentQ()
          Returns the primeExponentQ
 java.math.BigInteger getPrimeP()
          Returns the primeP value
 java.math.BigInteger getPrimeQ()
          Returns the primeQ value
 java.math.BigInteger getPrivateExponent()
          Returns the private exponent value for this key
 java.lang.String toString()
          Convert this Object to a human-readable String.
static GnuRSAPrivateKey valueOf(byte[] k)
          A class method that takes the output of the encodePrivateKey() method of an RSA keypair codec object (an instance implementing gnu.java.security.key.IKeyPairCodec for RSA keys, and re-constructs an instance of this object.
 
Methods inherited from class gnu.java.security.key.rsa.GnuRSAKey
getAlgorithm, getE, getEncoded, getFormat, getModulus, getN, getPublicExponent
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.security.Key
getAlgorithm, getEncoded, getFormat
 
Methods inherited from interface java.security.interfaces.RSAPrivateCrtKey
getPublicExponent
 
Methods inherited from interface java.security.interfaces.RSAKey
getModulus
 

Field Detail

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

p

private final java.math.BigInteger p
The first prime divisor of the modulus.


q

private final java.math.BigInteger q
The second prime divisor of the modulus.


d

private final java.math.BigInteger d
The private exponent of an RSA private key.


dP

private final java.math.BigInteger dP
The first factor's exponent.


dQ

private final java.math.BigInteger dQ
The second factor's exponent.


qInv

private final java.math.BigInteger qInv
The CRT (Chinese Remainder Theorem) coefficient.


str

private transient java.lang.String str
String representation of this key. Cached for speed.

Constructor Detail

GnuRSAPrivateKey

public GnuRSAPrivateKey(java.math.BigInteger p,
                        java.math.BigInteger q,
                        java.math.BigInteger e,
                        java.math.BigInteger d)
Convenience constructor. Calls the constructor with 5 arguments passing Registry.RAW_ENCODING_ID>Registry.RAW_ENCODING_ID 55 as the identifier of the preferred encoding format.


GnuRSAPrivateKey

public GnuRSAPrivateKey(int preferredFormat,
                        java.math.BigInteger p,
                        java.math.BigInteger q,
                        java.math.BigInteger e,
                        java.math.BigInteger d)
Constructs a new instance of a GnuRSAPrivateKey given the designated arguments.


GnuRSAPrivateKey

public GnuRSAPrivateKey(int preferredFormat,
                        java.math.BigInteger n,
                        java.math.BigInteger e,
                        java.math.BigInteger d,
                        java.math.BigInteger p,
                        java.math.BigInteger q,
                        java.math.BigInteger dP,
                        java.math.BigInteger dQ,
                        java.math.BigInteger qInv)
Constructs a new instance of a GnuRSAPrivateKey given the designated arguments.

Method Detail

valueOf

public static GnuRSAPrivateKey valueOf(byte[] k)
A class method that takes the output of the encodePrivateKey() method of an RSA keypair codec object (an instance implementing gnu.java.security.key.IKeyPairCodec for RSA keys, and re-constructs an instance of this object.


getPrimeP

public java.math.BigInteger getPrimeP()
Description copied from interface: java.security.interfaces.RSAPrivateCrtKey
Returns the primeP value

Specified by:
getPrimeP in interface java.security.interfaces.RSAPrivateCrtKey

getPrimeQ

public java.math.BigInteger getPrimeQ()
Description copied from interface: java.security.interfaces.RSAPrivateCrtKey
Returns the primeQ value

Specified by:
getPrimeQ in interface java.security.interfaces.RSAPrivateCrtKey

getPrimeExponentP

public java.math.BigInteger getPrimeExponentP()
Description copied from interface: java.security.interfaces.RSAPrivateCrtKey
Returns the primeExponentP

Specified by:
getPrimeExponentP in interface java.security.interfaces.RSAPrivateCrtKey

getPrimeExponentQ

public java.math.BigInteger getPrimeExponentQ()
Description copied from interface: java.security.interfaces.RSAPrivateCrtKey
Returns the primeExponentQ

Specified by:
getPrimeExponentQ in interface java.security.interfaces.RSAPrivateCrtKey

getCrtCoefficient

public java.math.BigInteger getCrtCoefficient()
Description copied from interface: java.security.interfaces.RSAPrivateCrtKey
Returns the CRT coefficient

Specified by:
getCrtCoefficient in interface java.security.interfaces.RSAPrivateCrtKey

getPrivateExponent

public java.math.BigInteger getPrivateExponent()
Description copied from interface: java.security.interfaces.RSAPrivateKey
Returns the private exponent value for this key

Specified by:
getPrivateExponent in interface java.security.interfaces.RSAPrivateKey

getEncoded

public byte[] getEncoded(int format)
Returns the encoded form of this private key according to the designated format.

Specified by:
getEncoded in class GnuRSAKey

equals

public boolean equals(java.lang.Object obj)

Returns true if the designated object is an instance of this class and has the same RSA parameter values as this one.

Overrides:
equals in class GnuRSAKey

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).

Overrides:
toString in class GnuRSAKey