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
-
d_
- the private exponent
-
p_
- one of the factors of n
-
q_
- the other factor of n
-
u_
- the multiplicative inverse of p mod q
-
SecretKey()
- A constructor that does no initialization, for use only by subclasses.
-
SecretKey(BigInteger, BigInteger, BigInteger, BigInteger, BigInteger, BigInteger)
- Constructs a secret key pair from the component parts.
-
cryptFast(BigInteger, BigInteger)
- Performs a fast encryption/decryption, using the Chinese Remainder Theorem.
-
d()
- Returns the private exponent, d.
-
decrypt(BigInteger)
- Decrypts a number.
-
encrypt(BigInteger)
- Encrypts a number.
-
insane()
- Performs a sanity check on the key.
-
p()
- Returns the smaller factor of n, p.
-
q()
- Returns the larger factor of n, q.
-
test()
- Performs a basic test on the key.
-
toString()
- Returns a string representation of all parts of the secret key.
-
u()
- Returns the multiplicative inverse of p mod q.
d_
protected BigInteger d_
- the private exponent
p_
protected BigInteger p_
- one of the factors of n
q_
protected BigInteger q_
- the other factor of n
u_
protected BigInteger u_
- the multiplicative inverse of p mod q
SecretKey
protected SecretKey()
- A constructor that does no initialization, for use only by subclasses.
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
d
public final BigInteger d()
- Returns the private exponent, d.
p
public final BigInteger p()
- Returns the smaller factor of n, p.
q
public final BigInteger q()
- Returns the larger factor of n, q.
u
public final BigInteger u()
- Returns the multiplicative inverse of p mod q.
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.
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
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.
insane
public final String insane()
- Performs a sanity check on the key.
- Returns:
- null if the key is O.K., otherwise an error message.
test
public final String test()
- Performs a basic test on the key.
- Returns:
- null if the key is O.K., otherwise an error message.
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