public class PropertyEncryptor
extends java.lang.Object
| Constructor and Description |
|---|
PropertyEncryptor() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.Properties |
decryptPropertiesFromFile(java.lang.String filePath,
EncryptionKeyPair keyPair)
Decrypts properties from a file using the provided secret key.
|
static EncryptionKeyPair |
encryptedPropertiesToStream(java.io.OutputStream os,
java.util.Properties properties)
Encrypts properties to a file represented as a byte array and returns the secret key used for encryption.
|
public static java.util.Properties decryptPropertiesFromFile(java.lang.String filePath,
EncryptionKeyPair keyPair)
throws java.io.IOException,
java.security.InvalidAlgorithmParameterException,
javax.crypto.IllegalBlockSizeException,
javax.crypto.NoSuchPaddingException,
javax.crypto.BadPaddingException,
java.security.NoSuchAlgorithmException,
java.security.InvalidKeyException
filePath - The path to the file containing encrypted properties.keyPair - The secret key and iv used for decryption.java.io.IOExceptionjava.security.InvalidAlgorithmParameterExceptionjavax.crypto.IllegalBlockSizeExceptionjavax.crypto.NoSuchPaddingExceptionjavax.crypto.BadPaddingExceptionjava.security.NoSuchAlgorithmExceptionjava.security.InvalidKeyExceptionpublic static EncryptionKeyPair encryptedPropertiesToStream(java.io.OutputStream os, java.util.Properties properties) throws java.io.IOException, java.security.InvalidAlgorithmParameterException, javax.crypto.NoSuchPaddingException, javax.crypto.IllegalBlockSizeException, java.security.NoSuchAlgorithmException, javax.crypto.BadPaddingException, java.security.InvalidKeyException
os - The output stream where the encrypted properties will be written.properties - The Properties object containing the properties to be encrypted.java.io.IOExceptionjava.security.InvalidAlgorithmParameterExceptionjavax.crypto.NoSuchPaddingExceptionjavax.crypto.IllegalBlockSizeExceptionjava.security.NoSuchAlgorithmExceptionjavax.crypto.BadPaddingExceptionjava.security.InvalidKeyException