String decrypt64()

in microprofile-extensions/microprofile-extensions-config/secured-string-converter/src/main/java/org/apache/geronimo/microprofile/extensions/config/converter/secure/PBECipher.java [104:119]


    String decrypt64(final String encryptedText, final byte[] password) {
        try {
            final byte[] allEncryptedBytes = Base64.getDecoder().decode(encryptedText.getBytes());
            final int totalLen = allEncryptedBytes.length;
            final byte[] salt = new byte[SALT_SIZE];
            System.arraycopy(allEncryptedBytes, 0, salt, 0, SALT_SIZE);
            final byte padLen = allEncryptedBytes[SALT_SIZE];
            final byte[] encryptedBytes = new byte[totalLen - SALT_SIZE - 1 - padLen];
            System.arraycopy(allEncryptedBytes, SALT_SIZE + 1, encryptedBytes, 0, encryptedBytes.length);
            final Cipher cipher = createCipher(password, salt, Cipher.DECRYPT_MODE);
            final byte[] clearBytes = cipher.doFinal(encryptedBytes);
            return new String(clearBytes, StandardCharsets.UTF_8);
        } catch (Exception e) {
            throw new IllegalArgumentException(e);
        }
    }