|
Oracle Security Developer Tools Crypto Java API Reference 10g (10.1.4.0.1) B28171-01 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
oracle.security.crypto.core.RSAKey
oracle.security.crypto.core.RSAPrivateKey
An RSA private key.
RSA private keys are output in PKCS #8 PrivateKeyInfo format, and this is also the preferred format for input. However, for backwards compatibility reasons, the PKCS #1 RSAPrivateKey format is recognized for input as well.
| Constructor Summary | |
RSAPrivateKey()Creates a new, uninitialized RSA private key. |
|
RSAPrivateKey(java.math.BigInteger mod, java.math.BigInteger exp)Construct a new RSAPrivateKey object with the given parameters. |
|
RSAPrivateKey(java.math.BigInteger mod, java.math.BigInteger exp, java.math.BigInteger e, java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger e1, java.math.BigInteger e2, java.math.BigInteger c)Construct a new RSAPrivateKey object with the given parameters. |
|
RSAPrivateKey(byte[] encoded)Makes a new RSA private key from a specified encoding. |
|
RSAPrivateKey(java.io.File f)Construct a new RSAPrivateKey object from a file. |
|
RSAPrivateKey(java.io.InputStream is)Initializes this RSA private key by reading its encoding from the given stream. |
|
| Method Summary | |
java.lang.Object |
clone()Creates a deep copy of this RSAPrivateKey instance. |
void |
erase()Erases the key material making the key un-usable. |
void |
finalize()Erases this object prior to being reclaimed by the garbage collector. |
AlgorithmIdentifier |
getAlgID()Returns the algorithm identifier for this key. |
ASN1Object |
getContents()Returns this RSAPrivateKey's contents in PKCS #1 privateKey format (as opposed to PKCS #8 privateKeyInfo format). |
java.math.BigInteger |
getCrtCoefficient() |
java.lang.String |
getFormat()Returns a string which indicates the format of this object's encoding. |
java.math.BigInteger |
getPrimeExponentP() |
java.math.BigInteger |
getPrimeExponentQ() |
java.math.BigInteger |
getPrimeP() |
java.math.BigInteger |
getPrimeQ() |
java.math.BigInteger |
getPublicExponent() |
RSAPublicKey |
getPublicKey()Get the public key from this private key. |
void |
initialize(AlgorithmIdentifier algID, ASN1Object contents)Initializes this instance from the given algorithm paramters and key contents. |
void |
input(java.io.InputStream is)Reads an RSA private key from the specified input stream. |
boolean |
isPublic()Indicates whether this is a public key. |
int |
length()Length of this object's encoding. |
void |
output(java.io.OutputStream os)Writes the DER encoding of this key in PKCS #8 privateKeyInfo format (as opposed to PKCS #1 privateKey format) to the given output stream. |
void |
readExternal(java.io.ObjectInput is) |
void |
setModulusExponent(java.math.BigInteger modulus, java.math.BigInteger exponent)Sets the modulus and (private) exponent. |
java.lang.String |
toString() |
void |
writeExternal(java.io.ObjectOutput os) |
| Methods inherited from class oracle.security.crypto.core.RSAKey |
getAlgorithm, getBitLength, getEncoded, getExponent, getModulus, modulusLength, setBytes |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface oracle.security.crypto.core.Key |
getAlgorithm, getBitLength, getEncoded |
| Constructor Detail |
public RSAPrivateKey()
public RSAPrivateKey(java.math.BigInteger mod,
java.math.BigInteger exp)
RSAPrivateKey object with the given parameters.
Note: A RSAPrivateKey constructed using only the modulus and private exponent cannot be used to derive the corresponding public key, nor can it be output to a DER-encoded ASN.1 representation.
mod - the modulusexp - the private exponent
public RSAPrivateKey(java.math.BigInteger mod,
java.math.BigInteger exp,
java.math.BigInteger e,
java.math.BigInteger p,
java.math.BigInteger q,
java.math.BigInteger e1,
java.math.BigInteger e2,
java.math.BigInteger c)
RSAPrivateKey object with the given parameters.mod - the modulusexp - the private exponente - the public exponentp - a big prime pq - a big prime qe1 -e2 -c -
public RSAPrivateKey(java.io.File f)
throws java.io.FileNotFoundException,
java.io.IOException
RSAPrivateKey object from a file.f - the file that stores the RSAPrivateKeyjava.io.FileNotFoundException - If the file didn't exist.java.io.IOException - If the input or output exception occured.
public RSAPrivateKey(java.io.InputStream is)
throws java.io.IOException
public RSAPrivateKey(byte[] encoded)
throws java.io.IOException
encoded - a BER encoding of an RSA private key| Method Detail |
public void initialize(AlgorithmIdentifier algID,
ASN1Object contents)
throws AlgorithmIdentifierException,
InvalidInputException
PrivateKeyinitialize in interface PrivateKeyAlgorithmIdentifierExceptionInvalidInputException
public void setModulusExponent(java.math.BigInteger modulus,
java.math.BigInteger exponent)
setModulusExponent in class RSAKeypublic boolean isPublic()
isPublic in class RSAKeyfalsepublic RSAPublicKey getPublicKey()
public java.math.BigInteger getPublicExponent()
public java.math.BigInteger getPrimeP()
public java.math.BigInteger getPrimeQ()
public java.math.BigInteger getPrimeExponentP()
public java.math.BigInteger getPrimeExponentQ()
public java.math.BigInteger getCrtCoefficient()
public java.lang.String getFormat()
getFormat in interface Keypublic ASN1Object getContents()
RSAPrivateKey's contents in PKCS #1 privateKey format (as opposed to PKCS #8 privateKeyInfo format).
To output the key in this format in DER encoding, use code like the following:
RSAPrivateKey key = ... ;
OutputStream os = ... ;
key.getContents().output(os);
getContents in interface PrivateKeyfor PKCS #8 privateKeyInfo format.public AlgorithmIdentifier getAlgID()
PrivateKeygetAlgID in interface PrivateKeypublic void erase()
Keys can be erased multiple times with no consequence.
erase in interface Keyerase in class RSAKeypublic void finalize()
Note: There is no guarantee of when, if ever, finalize will be invoked by the Java runtime.
public java.lang.Object clone()
RSAPrivateKey instance.clone in interface Keyclone in class RSAKey
public void input(java.io.InputStream is)
throws java.io.IOException
input in interface Streamablejava.io.IOException
public void output(java.io.OutputStream os)
throws java.io.IOException
output in interface Streamablejava.io.IOExceptionfor PKCS #1 privateKey format.public int length()
Streamablelength in interface Streamablepublic java.lang.String toString()
public void writeExternal(java.io.ObjectOutput os)
throws java.io.IOException
writeExternal in interface java.io.Externalizablejava.io.IOException
public void readExternal(java.io.ObjectInput is)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablejava.io.IOExceptionjava.lang.ClassNotFoundException
|
Oracle Security Developer Tools Crypto Java API Reference 10g (10.1.4.0.1) B28171-01 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||