iaik.utils
Class SSLeayPrivateKey
java.lang.Object
|
+--iaik.utils.SSLeayPrivateKey
- public class SSLeayPrivateKey
- extends java.lang.Object
- implements PrivateKey
This class can be used to read and decrypt private keys created with SSLeay.
- See Also:
- Serialized Form
|
Constructor Summary |
SSLeayPrivateKey(java.io.InputStream is)
Reads a private key created by SSLeay from the specified file. |
SSLeayPrivateKey(java.lang.String fileName)
Reads a private key created by SSLeay from the specified file. |
|
Method Summary |
void |
decrypt(java.lang.String password)
Decrypts this private key. |
java.lang.String |
getAlgorithm()
Returns the symmetric encryption algorithm used to protect this private key. |
byte[] |
getEncoded()
This method is not supported and therefore returns null. |
java.lang.String |
getFormat()
Returns the format used to encode the key or null if the
key does not support encoding. |
PrivateKey |
getPrivateKey()
Returns the included private key. |
boolean |
isEncrypted()
Returns true if this private key is encrypted. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
SSLeayPrivateKey
public SSLeayPrivateKey(java.lang.String fileName)
throws java.io.IOException,
InvalidKeyException
- Reads a private key created by SSLeay from the specified file.
- Parameters:
fileName - the name of the file containing the private key- Throws:
- java.io.IOException - if an error occurs during reading the key
- InvalidKeyException - if the key can not be parsed
SSLeayPrivateKey
public SSLeayPrivateKey(java.io.InputStream is)
throws java.io.IOException,
InvalidKeyException
- Reads a private key created by SSLeay from the specified file.
- Parameters:
is - an input stream containing the private key- Throws:
- java.io.IOException - if an error occurs during reading the key
- InvalidKeyException - if the key can not be parsed
isEncrypted
public boolean isEncrypted()
- Returns true if this private key is encrypted.
- Returns:
- true if this private key is encrypted
getPrivateKey
public PrivateKey getPrivateKey()
throws InvalidKeyException
- Returns the included private key.
- Returns:
- the private key
- Throws:
- InvalidKeyException - if an error occurs during parsing this private key or the
is not decrypted yet
decrypt
public void decrypt(java.lang.String password)
throws InvalidKeyException
- Decrypts this private key. Does nothing if the key is not encrypted.
- Parameters:
password - the password to decrypt the private key
getAlgorithm
public java.lang.String getAlgorithm()
- Returns the symmetric encryption algorithm used to protect this private key.
- Returns:
- the encryption algorithm or null if the private key is not encrypted
getEncoded
public byte[] getEncoded()
- This method is not supported and therefore returns null.
getFormat
public java.lang.String getFormat()
- Returns the format used to encode the key or null if the
key does not support encoding.
- Returns:
- the string "SSLeay"