public class Ssh2PublicKeyEntryDecoder extends Object implements PublicKeyRawDataDecoder<PublicKey>, PublicKeyEntryResolver, PublicKeyRawDataReader<PublicKey>, KeyTypeNamesSupport
Modifier and Type | Field and Description |
---|---|
static String |
BEGIN_MARKER |
static String |
END_MARKER |
static char |
HEADER_CONTINUATION_INDICATOR
According to RFC-4716 section 3.3:
|
static Ssh2PublicKeyEntryDecoder |
INSTANCE |
static List<String> |
START_MARKERS |
static List<String> |
STOP_MARKERS |
static NavigableSet<String> |
SUPPORTED_KEY_TYPES |
FAILING, IGNORING
Constructor and Description |
---|
Ssh2PublicKeyEntryDecoder() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
decodePublicKey, decodePublicKey
readPublicKey, readPublicKey, readPublicKey, readPublicKey, readPublicKey, readPublicKey, readPublicKey, readPublicKey, readPublicKey, readPublicKey
findSupporterByKeyTypeName
public static final NavigableSet<String> SUPPORTED_KEY_TYPES
public static final String BEGIN_MARKER
public static final String END_MARKER
public static final char HEADER_CONTINUATION_INDICATOR
A line is continued if the last character in the line is a "\". If
the last character of a line is a "\", then the logical contents of
the line are formed by removing the "\" and the line termination
characters, and appending the contents of the next line.
public static final Ssh2PublicKeyEntryDecoder INSTANCE
public NavigableSet<String> getSupportedKeyTypes()
getSupportedKeyTypes
in interface KeyTypeNamesSupport
NavigableSet
of OpenSSH
key type names that are supported by this
decoder - e.g., ssh-rsa, ssh-dss, ecdsa-sha2-nistp384
. This is not a single name - e.g., ECDSA
keys have several curve names. Caveat: this collection may be un-modifiable...public PublicKey resolve(SessionContext session, String keyType, byte[] keyData, Map<String,String> headers) throws IOException, GeneralSecurityException
resolve
in interface PublicKeyEntryResolver
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 typekeyData
- The OpenSSH
encoded key dataheaders
- Any headers that may have been available when data was readPublicKey
- ignored if null
IOException
- If failed to parse the key dataGeneralSecurityException
- If failed to generate the keypublic PublicKey decodePublicKey(SessionContext session, String keyType, InputStream keyData, Map<String,String> headers) throws IOException, GeneralSecurityException
decodePublicKey
in interface PublicKeyRawDataDecoder<PublicKey>
session
- The SessionContext
for invoking this command - may be null
if
not invoked within a session context (e.g., offline tool or session unknown).keyType
- The reported / encode key typekeyData
- The key data bytes stream positioned after the key type decoding and making sure
it is one of the supported typesheaders
- Any headers that may have been available when data was readPublicKey
IOException
- If failed to read from the data streamGeneralSecurityException
- If failed to generate the keypublic PublicKey decodePublicKeyByType(SessionContext session, String keyType, InputStream keyData, Map<String,String> headers) throws IOException, GeneralSecurityException
decodePublicKeyByType
in interface PublicKeyRawDataDecoder<PublicKey>
IOException
GeneralSecurityException
public PublicKey readPublicKey(SessionContext session, NamedResource resourceKey, List<String> lines) throws IOException, GeneralSecurityException
readPublicKey
in interface PublicKeyRawDataReader<PublicKey>
IOException
GeneralSecurityException
public PublicKey readPublicKey(SessionContext session, NamedResource resourceKey, String beginMarker, String endMarker, List<String> lines, Map<String,String> headers) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
public PublicKey readPublicKey(SessionContext session, NamedResource resourceKey, String beginMarker, String endMarker, byte[] dataBytes, Map<String,String> headers) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
protected Map.Entry<Map<String,String>,List<String>> separateDataLinesFromHeaders(SessionContext session, NamedResource resourceKey, String startLine, String endLine, List<String> lines) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
Copyright © 2008–2024 The Apache Software Foundation. All rights reserved.