Class PasswordBasedEncryptionUtil


  • public final class PasswordBasedEncryptionUtil
    extends Object
    Password Based Encryption utility class for tooling. It provides builder to build PBE masked strings for usage with org.wildfly.security.credential.store.CredentialStore.
    Author:
    Peter Skopek
    • Field Detail

      • PICKETBOX_COMPATIBILITY

        public static final org.wildfly.common.codec.Base64Alphabet PICKETBOX_COMPATIBILITY
        The alphabet used by PicketBox project base 64 encoding. 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz./
    • Method Detail

      • encryptAndEncode

        public String encryptAndEncode​(char[] payload)
                                throws GeneralSecurityException
        Encrypt a payload and encode the result using Alphabet given to builder. All necessary parameters are supplied through PasswordBasedEncryptionUtil.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
      • getAlgorithmParameters

        public AlgorithmParameters 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:
        AlgorithmParameters as generated by encryption process
      • getEncodedIV

        public String 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 returns null. It uses already set Alphabet to encode it.
        Returns:
        encoded form of IV or null when not available