public final class EncryptedPrivateKeyReader extends Object
EncryptedPrivateKeyReader is a utility class for reading encrypted private keys
that are protected with a password.| Constructor and Description |
|---|
EncryptedPrivateKeyReader() |
| Modifier and Type | Method and Description |
|---|---|
static KeyPair |
getKeyPair(File encryptedPrivateKeyFile,
String password)
|
static PrivateKey |
readPasswordProtectedPrivateKey(byte[] encryptedPrivateKeyBytes,
String password,
String algorithm)
Reads the given byte array that contains a password protected private key.
|
static PrivateKey |
readPasswordProtectedPrivateKey(File encryptedPrivateKeyFile,
String password)
Reads the given
File that contains a password protected private key. |
static PrivateKey |
readPasswordProtectedPrivateKey(File encryptedPrivateKeyFile,
String password,
String algorithm)
Reads from the given
File that contains the password protected private key and
returns it |
public static PrivateKey readPasswordProtectedPrivateKey(byte[] encryptedPrivateKeyBytes, String password, String algorithm) throws IOException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException, InvalidKeyException, InvalidAlgorithmParameterException
encryptedPrivateKeyBytes - the byte array that contains the password protected private keypassword - the passwordalgorithm - the algorithmPrivateKey objectIOException - Signals that an I/O exception has occurred.NoSuchAlgorithmException - is thrown if instantiation of the SecretKeyFactory object fails.NoSuchPaddingException - the no such padding exceptionInvalidKeySpecException - is thrown if generation of the SecretKey object fails.InvalidKeyException - is thrown if initialization of the cipher object fails.InvalidAlgorithmParameterException - is thrown if initialization of the cipher object fails.public static PrivateKey readPasswordProtectedPrivateKey(File encryptedPrivateKeyFile, String password, String algorithm) throws IOException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException, InvalidKeyException, InvalidAlgorithmParameterException
File that contains the password protected private key and
returns itencryptedPrivateKeyFile - the file that contains the password protected private keypassword - the passwordalgorithm - the algorithmPrivateKey objectIOException - Signals that an I/O exception has occurred.NoSuchAlgorithmException - is thrown if instantiation of the SecretKeyFactory object fails.NoSuchPaddingException - the no such padding exceptionInvalidKeySpecException - is thrown if generation of the SecretKey object fails.InvalidKeyException - is thrown if initialization of the cipher object fails.InvalidAlgorithmParameterException - is thrown if initialization of the cipher object fails.public static KeyPair getKeyPair(File encryptedPrivateKeyFile, String password) throws FileNotFoundException, IOException, org.bouncycastle.openssl.PEMException
encryptedPrivateKeyFile - the file that contains the password protected KeyPairpassword - the passwordFileNotFoundException - is thrown if the file did not foundIOException - Signals that an I/O exception has occurred.org.bouncycastle.openssl.PEMException - is thrown if an error occurs on read the pem filepublic static PrivateKey readPasswordProtectedPrivateKey(File encryptedPrivateKeyFile, String password) throws IOException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException, InvalidKeyException, InvalidAlgorithmParameterException
File that contains a password protected private key.encryptedPrivateKeyFile - the file that contains the password protected private keypassword - the passwordPrivateKey objectIOException - Signals that an I/O exception has occurred.NoSuchAlgorithmException - is thrown if instantiation of the SecretKeyFactory object fails.NoSuchPaddingException - the no such padding exceptionInvalidKeySpecException - is thrown if generation of the SecretKey object fails.InvalidKeyException - is thrown if initialization of the cipher object fails.InvalidAlgorithmParameterException - is thrown if initialization of the cipher object fails.Copyright © 2015–2019 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.