Package org.wildfly.security.util
Class PasswordBasedEncryptionUtil
java.lang.Object
org.wildfly.security.util.PasswordBasedEncryptionUtil
Password Based Encryption utility class for tooling.
It provides builder to build PBE masked strings for usage with
CredentialStore.- Author:
- Peter Skopek
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class to buildPasswordBasedEncryptionUtilclass with all necessary parameters to support password based encryption algorithms. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Base64AlphabetThe alphabet used by PicketBox project base 64 encoding. -
Method Summary
Modifier and TypeMethodDescriptionchar[]decodeAndDecrypt(String encodedPayload) Decode given payload and decrypt it to original.encryptAndEncode(char[] payload) Encrypt a payload and encode the result usingAlphabetgiven to builder.Returns algorithm parameters used in the process of encryption.Returns encrypted IV (initial vector) as generated by AES algorithm in the process of encryption.
-
Field Details
-
PICKETBOX_COMPATIBILITY
The alphabet used by PicketBox project base 64 encoding.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz./
-
-
Method Details
-
encryptAndEncode
Encrypt a payload and encode the result usingAlphabetgiven to builder. All necessary parameters are supplied throughPasswordBasedEncryptionUtil.Builder.- Parameters:
payload- secret to encrypt- Returns:
- String encrypted and encoded using given parameters
- Throws:
GeneralSecurityException- when problem occurs like non-existent algorithm or similar problems
-
decodeAndDecrypt
Decode given payload and decrypt it to original. All necessary parameters are supplied throughPasswordBasedEncryptionUtil.Builder.- Parameters:
encodedPayload- text to decode and decrypt- Returns:
- decrypted secret
- Throws:
GeneralSecurityException- when problem occurs like non-existent algorithm or similar problems
-
getAlgorithmParameters
Returns algorithm parameters used in the process of encryption. Might be useful to store them separately after encryption happened. It depends on used algorithm.- Returns:
AlgorithmParametersas generated by encryption process
-
getEncodedIV
Returns encrypted IV (initial vector) as generated by AES algorithm in the process of encryption. Other algorithms are not using it. In case of no such data available it returnsnull. It uses already setAlphabetto encode it.- Returns:
- encoded form of IV or
nullwhen not available
-