|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.clazzes.optional.sec.rsa.RSAPrivKey
public class RSAPrivKey
An RSA private key with a passphrase-encrypted storage possibility. This class does not make use of the Chinese Remainder Theorem and hence stores the private exponent internally without the factorization of the modulus.
Constructor Summary | |
---|---|
RSAPrivKey(BigInt modulus,
BigInt pubExponent,
BigInt privExponent)
Construct an RSA private key from the given numbers. |
Method Summary | |
---|---|
static RSAPrivKey |
decode(java.io.InputStream is,
byte[] passPhrase)
Write the encrypted private key to an output stream. |
protected static BigInt |
decodeBigInt(java.io.DataInputStream dis,
boolean legacy)
Decode an unsigned BigInt from a DataInputStream. |
BigInt |
decryptPlain(BigInt x)
Calculates the plain decrpyt operation x^privExp . |
void |
encode(java.io.OutputStream os,
byte[] passPhrase,
RandomGenerator random)
Write the encrypted private key to an output stream. |
protected void |
encodeEncryptedParts(java.io.DataOutputStream dos)
Encode the encrypted parts. |
BigInt |
getModulus()
|
BigInt |
getPubExponent()
|
RSAPubKey |
getPubKey()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RSAPrivKey(BigInt modulus, BigInt pubExponent, BigInt privExponent)
modulus
- The modulus of operation.pubExponent
- The public exponent.privExponent
- The private exponent.Method Detail |
---|
public BigInt getModulus()
public BigInt getPubExponent()
public RSAPubKey getPubKey()
protected static BigInt decodeBigInt(java.io.DataInputStream dis, boolean legacy) throws java.io.IOException
dis
- The DataInputStream to read from.
java.io.IOException
- Upon write errors.protected void encodeEncryptedParts(java.io.DataOutputStream dos) throws java.io.IOException
dos
- The data output stream, which will be encrypted.
java.io.IOException
public void encode(java.io.OutputStream os, byte[] passPhrase, RandomGenerator random) throws java.io.IOException
os
- The target output stream.passPhrase
- A pass phrase. If the pass phrase is a string it is
highly recommended to use the UTF-8 representation of
the pass phrase.random
- A random number generator used to generate salt bytes.
java.io.IOException
- Upon write errors.public static RSAPrivKey decode(java.io.InputStream is, byte[] passPhrase) throws java.io.IOException
os
- The target output stream.passPhrase
- A pass phrase. If the pass phrase is a string it is
highly recommended to use the UTF-8 representation of
the pass phrase.
java.io.IOException
- Upon read errors.public BigInt decryptPlain(BigInt x)
x^privExp
. This operation may additionally
be used on a padded message digest to sign data.
x
- The encrypted text.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |