Interface PublicKeyEntryDecoder<PUB extends java.security.PublicKey,​PRV extends java.security.PrivateKey>

    • Method Detail

      • resolve

        default java.security.PublicKey resolve​(SessionContext session,
                                                java.lang.String keyType,
                                                byte[] keyData,
                                                java.util.Map<java.lang.String,​java.lang.String> headers)
                                         throws java.io.IOException,
                                                java.security.GeneralSecurityException
        Specified by:
        resolve in interface PublicKeyEntryResolver
        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).
        keyType - The OpenSSH reported key type
        keyData - The OpenSSH encoded key data
        headers - Any headers that may have been available when data was read
        Returns:
        The extracted PublicKey - ignored if null
        Throws:
        java.io.IOException - If failed to parse the key data
        java.security.GeneralSecurityException - If failed to generate the key
      • decodePublicKeyByType

        default PUB decodePublicKeyByType​(SessionContext session,
                                          java.lang.String keyType,
                                          java.io.InputStream keyData,
                                          java.util.Map<java.lang.String,​java.lang.String> headers)
                                   throws java.io.IOException,
                                          java.security.GeneralSecurityException
        Specified by:
        decodePublicKeyByType in interface PublicKeyRawDataDecoder<PUB extends java.security.PublicKey>
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException
      • encodePublicKey

        java.lang.String encodePublicKey​(java.io.OutputStream s,
                                         PUB key)
                                  throws java.io.IOException
        Encodes the PublicKey using the OpenSSH format - same one used by the decodePublicKey method(s)
        Parameters:
        s - The OutputStream to write the data to
        key - The PublicKey - may not be null
        Returns:
        The key type value - one of the KeyTypeNamesSupport.getSupportedKeyTypes()
        Throws:
        java.io.IOException - If failed to generate the encoding