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
-
RSAPrivateKey()
- Default constructor.
-
RSAPrivateKey(ASN1Object)
- creates a RSA private key from an ASN1Object
-
RSAPrivateKey(String)
- creates a RSA private key from a PEM of DER file
-
decrypt(String)
- decrypts an encrypted PrivateKeyInfo (PKCS#5 and PKCS#8).
-
encrypt(String)
- Encrypt the PrivateKeyInfo data structure (PKCS#5 and PKCS#8).
-
encryptionAlgorithm()
- returns the algorithm the private key was encrypted
-
fingerprint()
- returns the fingerprint of this private key
-
generateKeys(int)
- generates the key pair
-
generateKeys(int, Random)
- generates the key pair
-
isEncrypted()
- returns true if the private key is encrypted
-
netscapeFormat()
- returns true if this privateKey is in netscape format
-
publicKey()
- returns the public key part of this private key
-
saveFormat()
- returns the file format (ASN1.DER, ASN1.PEM) of the private key
-
saveToFile(String)
- Encrypt private key and save to file.
-
setEncryptionAlgorithm(String)
- sets the algorithm used to encrypt the private key
-
setNetscapeFormat(boolean)
- sets this private key to netscape format
-
setSaveFormat(int)
- sets the file format (ASN1.DER, ASN1.PEM) of the private key
RSAPrivateKey
public RSAPrivateKey()
- Default constructor.
RSAPrivateKey
public RSAPrivateKey(String fileName) throws IOException, CodingException
- creates a RSA private key from a PEM of DER file
RSAPrivateKey
public RSAPrivateKey(ASN1Object o) throws CodingException
- creates a RSA private key from an ASN1Object
generateKeys
public void generateKeys(int keylen)
- generates the key pair
- Parameters:
- keylen - number of bits for modulus
- Overrides:
- generateKeys in class PrivateKey
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
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
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
isEncrypted
public boolean isEncrypted()
- returns true if the private key is encrypted
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
publicKey
public PublicKey publicKey()
- returns the public key part of this private key
- Overrides:
- publicKey in class PrivateKey
setEncryptionAlgorithm
public void setEncryptionAlgorithm(String alg)
- sets the algorithm used to encrypt the private key
setSaveFormat
public void setSaveFormat(int format)
- sets the file format (ASN1.DER, ASN1.PEM) of the private key
setNetscapeFormat
public void setNetscapeFormat(boolean nf)
- sets this private key to netscape format
encryptionAlgorithm
public String encryptionAlgorithm()
- returns the algorithm the private key was encrypted
saveFormat
public int saveFormat()
- returns the file format (ASN1.DER, ASN1.PEM) of the private key
netscapeFormat
public boolean netscapeFormat()
- returns true if this privateKey is in netscape format
fingerprint
public byte[] fingerprint()
- returns the fingerprint of this private key
All Packages Class Hierarchy This Package Previous Next Index