Class EncryptedPEMKeyReader

  • All Implemented Interfaces:
    PEMKeyReader

    class EncryptedPEMKeyReader
    extends StandardPEMKeyReader
    PEM Key Reader implementation supporting historical password-based encryption from OpenSSL EVP_BytesToKey
    • Field Detail

      • PROC_TYPE_ENCRYPTED_HEADER

        private static final java.lang.String PROC_TYPE_ENCRYPTED_HEADER
        See Also:
        Constant Field Values
      • DEK_INFO_PATTERN

        private static final java.util.regex.Pattern DEK_INFO_PATTERN
      • DEK_INFO_ALGORITHM_GROUP

        private static final int DEK_INFO_ALGORITHM_GROUP
        See Also:
        Constant Field Values
      • resource

        private final Resource<?> resource
    • Constructor Detail

    • Method Detail

      • readPemKey

        public PEMKey readPemKey​(java.io.BufferedReader bufferedReader)
                          throws java.io.IOException
        Description copied from class: StandardPEMKeyReader
        Read PEM Key from Buffered Reader
        Specified by:
        readPemKey in interface PEMKeyReader
        Overrides:
        readPemKey in class StandardPEMKeyReader
        Parameters:
        bufferedReader - Buffered Reader containing lines from resource reader
        Returns:
        PEM Key
        Throws:
        java.io.IOException - Thrown on failure to read or decode PEM Key
      • isEncrypted

        private boolean isEncrypted​(java.util.List<java.lang.String> headers)
      • readEncryptedPemKey

        private PEMKey readEncryptedPemKey​(PEMKey pemKey)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • getDecryptedPemKeyBody

        private byte[] getDecryptedPemKeyBody​(char[] password,
                                              byte[] pemKeyBody,
                                              EncryptedPEMKeyReader.DataEncryptionKeyInfo dataEncryptionKeyInfo)
                                       throws java.io.IOException
        Throws:
        java.io.IOException