Class AbstractPEMResourceKeyPairParser

    • Field Detail

      • algo

        private final java.lang.String algo
      • algId

        private final java.lang.String algId
    • Constructor Detail

      • AbstractPEMResourceKeyPairParser

        protected AbstractPEMResourceKeyPairParser​(java.lang.String algo,
                                                   java.lang.String algId,
                                                   java.util.List<java.lang.String> beginners,
                                                   java.util.List<java.lang.String> enders)
    • Method Detail

      • getAlgorithmIdentifier

        public java.lang.String getAlgorithmIdentifier()
        Specified by:
        getAlgorithmIdentifier in interface KeyPairPEMResourceParser
        Returns:
        The OID used to identify this algorithm in DER encodings - e.g., RSA=1.2.840.113549.1.1.1
      • extractKeyPairs

        public java.util.Collection<java.security.KeyPair> extractKeyPairs​(SessionContext session,
                                                                           NamedResource resourceKey,
                                                                           java.lang.String beginMarker,
                                                                           java.lang.String endMarker,
                                                                           FilePasswordProvider passwordProvider,
                                                                           java.util.List<java.lang.String> lines,
                                                                           java.util.Map<java.lang.String,​java.lang.String> headers)
                                                                    throws java.io.IOException,
                                                                           java.security.GeneralSecurityException
        Description copied from class: AbstractKeyPairResourceParser
        Extracts the key pairs within a single delimited by markers block of lines. By default cleans up the empty lines, joins them and converts them from BASE64
        Overrides:
        extractKeyPairs in class AbstractKeyPairResourceParser
        Parameters:
        session - The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool or session unknown).
        resourceKey - A hint as to the origin of the text lines
        beginMarker - The line containing the begin marker
        endMarker - The line containing the end marker
        passwordProvider - The FilePasswordProvider to use in case the data is encrypted - may be null if no encrypted
        lines - The block of lines between the markers
        headers - Any headers that may have been available when data was read
        Returns:
        The extracted KeyPairs - may be null/empty if none.
        Throws:
        java.io.IOException - If failed to parse the data
        java.security.GeneralSecurityException - If failed to generate the keys
      • applyPrivateKeyCipher

        protected byte[] applyPrivateKeyCipher​(byte[] bytes,
                                               PrivateKeyEncryptionContext encContext,
                                               boolean encryptIt)
                                        throws java.security.GeneralSecurityException,
                                               java.io.IOException
        Throws:
        java.security.GeneralSecurityException
        java.io.IOException