public final class EncryptedPrivateKeyWriter extends Object
EncryptedPrivateKeyWriter is a utility class for write and protect
PrivateKey objects with a password to files.| Constructor and Description |
|---|
EncryptedPrivateKeyWriter() |
| Modifier and Type | Method and Description |
|---|---|
static void |
encryptPrivateKeyWithPassword(PrivateKey privateKey,
File file,
String password)
Encrypt the given
PrivateKey with the given password and write the result to the
given File. |
static void |
encryptPrivateKeyWithPassword(PrivateKey privateKey,
@NonNull OutputStream outputStream,
String password)
Encrypt the given
PrivateKey with the given password and write the result to the
given OutputStream. |
static byte[] |
encryptPrivateKeyWithPassword(PrivateKey privateKey,
String password)
Encrypt the given
PrivateKey with the given password and return the resulted byte
array. |
public static byte[] encryptPrivateKeyWithPassword(PrivateKey privateKey, String password) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException, InvalidParameterSpecException, IOException
PrivateKey with the given password and return the resulted byte
array.privateKey - the private key to encryptpassword - the passwordNoSuchAlgorithmException - is thrown if instantiation of the SecretKeyFactory object fails.InvalidKeySpecException - is thrown if generation of the SecretKey object fails.NoSuchPaddingException - the no such padding exceptionInvalidKeyException - is thrown if initialization of the cipher object failsInvalidAlgorithmParameterException - is thrown if initialization of the cypher object fails.IllegalBlockSizeException - the illegal block size exceptionBadPaddingException - the bad padding exceptionInvalidParameterSpecException - the invalid parameter spec exceptionIOException - Signals that an I/O exception has occurred.public static void encryptPrivateKeyWithPassword(PrivateKey privateKey, @NonNull @NonNull OutputStream outputStream, String password) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException, InvalidParameterSpecException, IOException
PrivateKey with the given password and write the result to the
given OutputStream.privateKey - the private key to encryptoutputStream - the output streampassword - the passwordNoSuchAlgorithmException - is thrown if instantiation of the SecretKeyFactory object fails.InvalidKeySpecException - is thrown if generation of the SecretKey object fails.NoSuchPaddingException - the no such padding exceptionInvalidKeyException - is thrown if initialization of the cipher object failsInvalidAlgorithmParameterException - is thrown if initialization of the cypher object fails.IllegalBlockSizeException - the illegal block size exceptionBadPaddingException - the bad padding exceptionInvalidParameterSpecException - the invalid parameter spec exceptionIOException - Signals that an I/O exception has occurred.public static void encryptPrivateKeyWithPassword(PrivateKey privateKey, File file, String password) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException, InvalidParameterSpecException, IOException
PrivateKey with the given password and write the result to the
given File.privateKey - the private key to encryptfile - the filepassword - the passwordNoSuchAlgorithmException - is thrown if instantiation of the SecretKeyFactory object fails.InvalidKeySpecException - is thrown if generation of the SecretKey object fails.NoSuchPaddingException - the no such padding exceptionInvalidKeyException - is thrown if initialization of the cipher object failsInvalidAlgorithmParameterException - is thrown if initialization of the cypher object fails.IllegalBlockSizeException - the illegal block size exceptionBadPaddingException - the bad padding exceptionInvalidParameterSpecException - the invalid parameter spec exceptionIOException - Signals that an I/O exception has occurredCopyright © 2015–2019 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.