Class cryptix.security.rsa.SecretKey
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
This class is an RSA secret key pair.
It can also be used as a public key.
Copyright (C) 1995, 1996 Systemics Ltd (http://www.systemics.com/)
All rights reserved.
-
d_
- the private exponent
-
p_
- one of the factors of n
-
q_
- the other factors of n
-
u_
- the multiplic inverse of p mod q
-
SecretKey()
-
-
SecretKey(BigInteger, BigInteger, BigInteger, BigInteger, BigInteger, BigInteger)
- Creates a secret key pair from the component parts
-
cryptFast(BigInteger, BigInteger)
- perform a fast encryption/decryption
-
d()
-
-
decrypt(BigInteger)
- decrypt a number
used for decryption or signing
-
encrypt(BigInteger)
- encrypt a number
used for encryption or signature verification.
-
insane()
- perform a sanity check on the key
-
p()
-
-
q()
-
-
test()
- Perform a basic test on the key
-
toString()
- Access all parts of the secret key.
-
u()
-
d_
protected BigInteger d_
- the private exponent
p_
protected BigInteger p_
- one of the factors of n
q_
protected BigInteger q_
- the other factors of n
u_
protected BigInteger u_
- the multiplic inverse of p mod q
SecretKey
protected SecretKey()
SecretKey
public SecretKey(BigInteger n0,
BigInteger e0,
BigInteger d0,
BigInteger p0,
BigInteger q0,
BigInteger u0)
- Creates a secret key pair from the component parts
- Parameters:
- n0 - The public modulus
- e0 - The public exponent
- d0 - The private exponent
- p0 - One of the factors of n
- q0 - The other Factor of n
- u0 - The multiplic inverse of p mod q
d
public final BigInteger d()
- Returns:
- the private exponent d
p
public final BigInteger p()
- Returns:
- the smallest factor of n
q
public final BigInteger q()
- Returns:
- the largest factor of n
u
public final BigInteger u()
- Returns:
- the multiplicative inverse of p mod q
decrypt
public BigInteger decrypt(BigInteger encrypted)
- decrypt a number
used for decryption or signing
- Parameters:
- encrypted - the number to decrypt.
- Returns:
- a decrypted number.
encrypt
public BigInteger encrypt(BigInteger plain)
- encrypt a number
used for encryption or signature verification.
N.B. this is quicker that 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 key,
BigInteger msg)
- perform a fast encryption/decryption
- Parameters:
- key - either e if encrypting or d if decrypting
- msg - the message to crypt.
- Returns:
- the encrypted/decrypted message
insane
public final String insane()
- perform a sanity check on the key
- Returns:
- null if the key is O.K., otherwise an error message.
test
public final String test()
- Perform a basic test on the key
- Returns:
- null if the key is O.K., otherwise an error message.
toString
public String toString()
- Access all parts of the secret key.
This function 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