Class cryptiX.rsa.RSAPrivateKey
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class cryptiX.rsa.RSAPrivateKey

java.lang.Object
   |
   +----java.util.Observable
           |
           +----cryptiX.rsa.PublicKey
                   |
                   +----cryptiX.rsa.PrivateKey
                           |
                           +----cryptiX.rsa.RSAPrivateKey

public class RSAPrivateKey
extends PrivateKey

Constructor Index

 o RSAPrivateKey()
Default constructor.
 o RSAPrivateKey(ASN1Object)
creates a RSA private key from an ASN1Object
 o RSAPrivateKey(String)
creates a RSA private key from a PEM of DER file

Method Index

 o decrypt(String)
decrypts an encrypted PrivateKeyInfo (PKCS#5 and PKCS#8).
 o encrypt(String)
Encrypt the PrivateKeyInfo data structure (PKCS#5 and PKCS#8).
 o encryptionAlgorithm()
returns the algorithm the private key was encrypted
 o fingerprint()
returns the fingerprint of this private key
 o generateKeys(int)
generates the key pair
 o generateKeys(int, Random)
generates the key pair
 o isEncrypted()
returns true if the private key is encrypted
 o netscapeFormat()
returns true if this privateKey is in netscape format
 o publicKey()
returns the public key part of this private key
 o saveFormat()
returns the file format (ASN1.DER, ASN1.PEM) of the private key
 o saveToFile(String)
Encrypt private key and save to file.
 o setEncryptionAlgorithm(String)
sets the algorithm used to encrypt the private key
 o setNetscapeFormat(boolean)
sets this private key to netscape format
 o setSaveFormat(int)
sets the file format (ASN1.DER, ASN1.PEM) of the private key

Constructors

 o RSAPrivateKey
  public RSAPrivateKey()
Default constructor.
 o RSAPrivateKey
  public RSAPrivateKey(String fileName) throws IOException, CodingException
creates a RSA private key from a PEM of DER file
 o RSAPrivateKey
  public RSAPrivateKey(ASN1Object o) throws CodingException
creates a RSA private key from an ASN1Object

Methods

 o generateKeys
  public void generateKeys(int keylen)
generates the key pair
Parameters:
keylen - number of bits for modulus
Overrides:
generateKeys in class PrivateKey
 o generateKeys
  public void generateKeys(int keylen,
                           Random rng)
generates the key pair
Parameters:
keylen - number of bits for modulus
rng - the random number generator to use
Overrides:
generateKeys in class PrivateKey
 o decrypt
  public void decrypt(String password) throws CodingException
decrypts an encrypted PrivateKeyInfo (PKCS#5 and PKCS#8).
Parameters:
password - the password to decrypt the key
 o encrypt
  public void encrypt(String password) throws CodingException
Encrypt the PrivateKeyInfo data structure (PKCS#5 and PKCS#8).
Parameters:
password - the password to use
Returns:
EncryptedPrivateKeyInfo
 o isEncrypted
  public boolean isEncrypted()
returns true if the private key is encrypted
 o saveToFile
  public void saveToFile(String fileName) throws IOException
Encrypt private key and save to file.
Parameters:
fileName - the file name to use
password - the password for encrypting the private key
algorithmIdentifier - algorithm to use for encrypting the key
pemFormat - true file is written in PEM format false file is written in DER format
 o publicKey
  public PublicKey publicKey()
returns the public key part of this private key
Overrides:
publicKey in class PrivateKey
 o setEncryptionAlgorithm
  public void setEncryptionAlgorithm(String alg)
sets the algorithm used to encrypt the private key
 o setSaveFormat
  public void setSaveFormat(int format)
sets the file format (ASN1.DER, ASN1.PEM) of the private key
 o setNetscapeFormat
  public void setNetscapeFormat(boolean nf)
sets this private key to netscape format
 o encryptionAlgorithm
  public String encryptionAlgorithm()
returns the algorithm the private key was encrypted
 o saveFormat
  public int saveFormat()
returns the file format (ASN1.DER, ASN1.PEM) of the private key
 o netscapeFormat
  public boolean netscapeFormat()
returns true if this privateKey is in netscape format
 o fingerprint
  public byte[] fingerprint()
returns the fingerprint of this private key

All Packages  Class Hierarchy  This Package  Previous  Next  Index