Class java.crypt.rsa.SecretKey
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.crypt.rsa.SecretKey

java.crypt.rsa.PublicKey
   |
   +----java.crypt.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.


Variable Index

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

Constructor Index

 o SecretKey()
 o SecretKey(BigInteger, BigInteger, BigInteger, BigInteger, BigInteger, BigInteger)
Creates a secret key pair from the component parts

Method Index

 o cryptFast(BigInteger, BigInteger)
perform a fast encryption/decryption
 o d()
 o decrypt(BigInteger)
decrypt a number used for decryption or signing
 o encrypt(BigInteger)
encrypt a number used for encryption or signature verification.
 o insane()
perform a sanity check on the key
 o p()
 o q()
 o test()
Perform a basic test on the key
 o toString()
Access all parts of the secret key.
 o u()

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 factors of n
 o u_
  protected BigInteger u_
the multiplic inverse of p mod q

Constructors

 o SecretKey
  protected SecretKey()
 o 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

Methods

 o d
  public final BigInteger d()
Returns:
the private exponent d
 o p
  public final BigInteger p()
Returns:
the smallest factor of n
 o q
  public final BigInteger q()
Returns:
the largest factor of n
 o u
  public final BigInteger u()
Returns:
the multiplicative inverse of p mod q
 o decrypt
  public BigInteger decrypt(BigInteger encrypted)
decrypt a number used for decryption or signing
Parameters:
encrypted - the number to decrypt.
Returns:
a decrypted number.
 o 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
 o 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
 o insane
  public final String insane()
perform a sanity check on the key
Returns:
null if the key is O.K., otherwise an error message.
 o test
  public final String test()
Perform a basic test on the key
Returns:
null if the key is O.K., otherwise an error message.
 o 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