Class AbstractPuttyKeyDecoder<PUB extends java.security.PublicKey,​PRV extends java.security.PrivateKey>

    • Field Detail

      • ENCRYPTION_HEADER

        public static final java.lang.String ENCRYPTION_HEADER
        See Also:
        Constant Field Values
    • Constructor Detail

      • AbstractPuttyKeyDecoder

        protected AbstractPuttyKeyDecoder​(java.lang.Class<PUB> pubType,
                                          java.lang.Class<PRV> prvType,
                                          java.util.Collection<java.lang.String> names)
    • Method Detail

      • canExtractKeyPairs

        public boolean canExtractKeyPairs​(NamedResource resourceKey,
                                          java.util.List<java.lang.String> lines)
                                   throws java.io.IOException,
                                          java.security.GeneralSecurityException
        Specified by:
        canExtractKeyPairs in interface KeyPairResourceParser
        Specified by:
        canExtractKeyPairs in interface PuttyKeyPairResourceParser<PUB extends java.security.PublicKey,​PRV extends java.security.PrivateKey>
        Parameters:
        resourceKey - A hint as to the origin of the text lines
        lines - The resource lines
        Returns:
        true if the parser can extract some key pairs from the lines
        Throws:
        java.io.IOException - If failed to process the lines
        java.security.GeneralSecurityException - If failed to extract information regarding the possibility to extract the key pairs
      • loadKeyPairs

        public java.util.Collection<java.security.KeyPair> loadKeyPairs​(SessionContext session,
                                                                        NamedResource resourceKey,
                                                                        FilePasswordProvider passwordProvider,
                                                                        java.util.List<java.lang.String> lines)
                                                                 throws java.io.IOException,
                                                                        java.security.GeneralSecurityException
        Description copied from interface: KeyPairResourceLoader
        Loads key pairs from the given resource text lines
        Specified by:
        loadKeyPairs in interface KeyPairResourceLoader
        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
        passwordProvider - The FilePasswordProvider to use in case the data is encrypted - may be null if no encrypted data is expected
        lines - The List of lines as read from the resource
        Returns:
        The extracted KeyPairs - may be null/empty if none. Note: the resource loader may decide to skip unknown lines if more than one key pair type is encoded in it
        Throws:
        java.io.IOException - If failed to process the lines
        java.security.GeneralSecurityException - If failed to generate the keys from the parsed data
      • extractDataLines

        public static java.util.List<java.lang.String> extractDataLines​(NamedResource resourceKey,
                                                                        java.util.List<java.lang.String> lines,
                                                                        int startIndex,
                                                                        java.lang.String hdrName,
                                                                        java.lang.String hdrValue,
                                                                        java.util.List<java.lang.String> curLines)
                                                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • loadKeyPairs

        public java.util.Collection<java.security.KeyPair> loadKeyPairs​(SessionContext session,
                                                                        NamedResource resourceKey,
                                                                        java.util.List<java.lang.String> pubLines,
                                                                        java.util.List<java.lang.String> prvLines,
                                                                        java.lang.String prvEncryption,
                                                                        FilePasswordProvider passwordProvider,
                                                                        java.util.Map<java.lang.String,​java.lang.String> headers)
                                                                 throws java.io.IOException,
                                                                        java.security.GeneralSecurityException
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException
      • loadKeyPairs

        public java.util.Collection<java.security.KeyPair> loadKeyPairs​(SessionContext session,
                                                                        NamedResource resourceKey,
                                                                        java.lang.String pubData,
                                                                        java.lang.String prvData,
                                                                        java.lang.String prvEncryption,
                                                                        FilePasswordProvider passwordProvider,
                                                                        java.util.Map<java.lang.String,​java.lang.String> headers)
                                                                 throws java.io.IOException,
                                                                        java.security.GeneralSecurityException
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException
      • loadKeyPairs

        public java.util.Collection<java.security.KeyPair> loadKeyPairs​(NamedResource resourceKey,
                                                                        byte[] pubData,
                                                                        byte[] prvData,
                                                                        java.util.Map<java.lang.String,​java.lang.String> headers)
                                                                 throws java.io.IOException,
                                                                        java.security.GeneralSecurityException
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException
      • loadKeyPairs

        public java.util.Collection<java.security.KeyPair> loadKeyPairs​(NamedResource resourceKey,
                                                                        java.io.InputStream pubData,
                                                                        java.io.InputStream prvData,
                                                                        java.util.Map<java.lang.String,​java.lang.String> headers)
                                                                 throws java.io.IOException,
                                                                        java.security.GeneralSecurityException
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException
      • loadKeyPairs

        public abstract java.util.Collection<java.security.KeyPair> loadKeyPairs​(NamedResource resourceKey,
                                                                                 PuttyKeyReader pubReader,
                                                                                 PuttyKeyReader prvReader,
                                                                                 java.util.Map<java.lang.String,​java.lang.String> headers)
                                                                          throws java.io.IOException,
                                                                                 java.security.GeneralSecurityException
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException