All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class cryptix.security.rsa.SecretKey

java.lang.Object
   |
   +----cryptix.security.rsa.PublicKey
           |
           +----cryptix.security.rsa.SecretKey

public class SecretKey
extends PublicKey
Note: SecretKey is deprecated. This class may be removed in a future version of Cryptix.

This class represents an RSA secret key pair. It can also be used as a public key.

Copyright © 1995-1997 Systemics Ltd on behalf of the Cryptix Development Team.
All rights reserved.

$Revision: 1.2 $

Author:
Systemics Ltd, David Hopwood
See Also:
BaseRSAPrivateKey

Variable Index

 o d_
the private exponent
 o p_
one of the factors of n
 o q_
the other factor of n
 o u_
the multiplicative inverse of p mod q

Constructor Index

 o SecretKey()
A constructor that does no initialization, for use only by subclasses.
 o SecretKey(BigInteger, BigInteger, BigInteger, BigInteger, BigInteger, BigInteger)
Constructs a secret key pair from the component parts.

Method Index

 o cryptFast(BigInteger, BigInteger)
Performs a fast encryption/decryption, using the Chinese Remainder Theorem.
 o d()
Returns the private exponent, d.
 o decrypt(BigInteger)
Decrypts a number.
 o encrypt(BigInteger)
Encrypts a number.
 o insane()
Performs a sanity check on the key.
 o p()
Returns the smaller factor of n, p.
 o q()
Returns the larger factor of n, q.
 o test()
Performs a basic test on the key.
 o toString()
Returns a string representation of all parts of the secret key.
 o u()
Returns the multiplicative inverse of p mod q.

Variables

 o d_
 protected BigInteger d_
the private exponent

 o p_
 protected BigInteger p_
one of the factors of n

 o q_
 protected BigInteger q_
the other factor of n

 o u_
 protected BigInteger u_
the multiplicative inverse of p mod q

Constructors

 o SecretKey
 protected SecretKey()
A constructor that does no initialization, for use only by subclasses.

 o SecretKey
 public SecretKey(BigInteger n,
                  BigInteger e,
                  BigInteger d,
                  BigInteger p,
                  BigInteger q,
                  BigInteger u)
Constructs a secret key pair from the component parts.

Parameters:
n - the public modulus
e - the public (encryption) exponent
d - the private (decryption) exponent
p - the smaller factor of n
q - the larger factor of n
u - the multiplicative inverse of p mod q

Methods

 o d
 public final BigInteger d()
Returns the private exponent, d.

 o p
 public final BigInteger p()
Returns the smaller factor of n, p.

 o q
 public final BigInteger q()
Returns the larger factor of n, q.

 o u
 public final BigInteger u()
Returns the multiplicative inverse of p mod q.

 o decrypt
 public BigInteger decrypt(BigInteger encrypted)
Decrypts a number. This is used for decryption or signing.

Parameters:
encrypted - the number to decrypt.
Returns:
a decrypted number.
 o encrypt
 public BigInteger encrypt(BigInteger plain)
Encrypts a number. This is used for encryption or signature verification. N.B. this is quicker than the public key method, since secret components are available.

Parameters:
plain - the number to encrypt.
Returns:
an encrypted number.
Overrides:
encrypt in class PublicKey
 o cryptFast
 protected final BigInteger cryptFast(BigInteger exponent,
                                      BigInteger input)
Performs a fast encryption/decryption, using the Chinese Remainder Theorem.

Parameters:
exponent - either e if encrypting or d if decrypting.
input - the value to encrypt or decrypt.
Returns:
the result of the operation.
 o insane
 public final String insane()
Performs a sanity check on the key.

Returns:
null if the key is O.K., otherwise an error message.
 o test
 public final String test()
Performs a basic test on the key.

Returns:
null if the key is O.K., otherwise an error message.
 o toString
 public String toString()
Returns a string representation of all parts of the secret key. This method should be used with caution, in order that the secret key is not compromised.

Returns:
a string representation of the key.
Overrides:
toString in class PublicKey

All Packages  Class Hierarchy  This Package  Previous  Next  Index