org.clazzes.optional.sec.rsa
Class RSACrtPrivKey

java.lang.Object
  extended by org.clazzes.optional.sec.rsa.RSAPrivKey
      extended by org.clazzes.optional.sec.rsa.RSACrtPrivKey

public class RSACrtPrivKey
extends RSAPrivKey

An RSA private key with a passphrase-encrypted storage possibility. This specialized class does make use of the Chinese Remainder Theorem and hence stores the factorization of the modulus and other values alongside with the private exponent.


Constructor Summary
RSACrtPrivKey(BigInt modulus, BigInt pubExponent, BigInt privExponent, BigInt p, BigInt q, BigInt dp, BigInt dq, BigInt qi)
           
 
Method Summary
 BigInt decryptPlain(BigInt x)
          Calculates the plain decrpyt operation x^privExp.
protected  void encodeEncryptedParts(java.io.DataOutputStream dos)
          Encode the encrypted parts.
 
Methods inherited from class org.clazzes.optional.sec.rsa.RSAPrivKey
decode, decodeBigInt, encode, getModulus, getPubExponent, getPubKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RSACrtPrivKey

public RSACrtPrivKey(BigInt modulus,
                     BigInt pubExponent,
                     BigInt privExponent,
                     BigInt p,
                     BigInt q,
                     BigInt dp,
                     BigInt dq,
                     BigInt qi)
Parameters:
modulus - The modulus of the RSA key.
pubExponent - The public exponent.
privExponent - The private exponent.
p - The larger prime of the factorization of the modulus.
q - The smaller prime of the factorization of the modulus.
dp - privExponent mod (p-1)
dq - privExponent mod (q-1)
qi - The modular inverse of q w.r.t. p. ((q * qi) mod p == 1 mod p)
Method Detail

decryptPlain

public BigInt decryptPlain(BigInt x)
Description copied from class: RSAPrivKey
Calculates the plain decrpyt operation x^privExp. This operation may additionally be used on a padded message digest to sign data.

Overrides:
decryptPlain in class RSAPrivKey
Parameters:
x - The encrypted text.
Returns:
The decrypted plain text, which is usually subject to an appropriate padding scheme.

encodeEncryptedParts

protected void encodeEncryptedParts(java.io.DataOutputStream dos)
                             throws java.io.IOException
Description copied from class: RSAPrivKey
Encode the encrypted parts. This function may be overwritten by more sophisticated implementations like implementations, which make use of the Chinese Remainder Theorem.

Overrides:
encodeEncryptedParts in class RSAPrivKey
Parameters:
dos - The data output stream, which will be encrypted.
Throws:
java.io.IOException


Copyright © 2010. All Rights Reserved.