public class Ssh2PublicKeyEntryDecoder extends java.lang.Object implements PublicKeyRawDataDecoder<java.security.PublicKey>, PublicKeyEntryResolver, PublicKeyRawDataReader<java.security.PublicKey>, KeyTypeNamesSupport
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BEGIN_MARKER |
static java.lang.String |
END_MARKER |
static char |
HEADER_CONTINUATION_INDICATOR
According to RFC-4716 section 3.3:
|
static Ssh2PublicKeyEntryDecoder |
INSTANCE |
static java.util.List<java.lang.String> |
START_MARKERS |
static java.util.List<java.lang.String> |
STOP_MARKERS |
static java.util.NavigableSet<java.lang.String> |
SUPPORTED_KEY_TYPES |
FAILING, IGNORING
Constructor and Description |
---|
Ssh2PublicKeyEntryDecoder() |
Modifier and Type | Method and Description |
---|---|
java.security.PublicKey |
decodePublicKey(SessionContext session,
java.lang.String keyType,
java.io.InputStream keyData,
java.util.Map<java.lang.String,java.lang.String> headers) |
java.security.PublicKey |
decodePublicKeyByType(SessionContext session,
java.lang.String keyType,
java.io.InputStream keyData,
java.util.Map<java.lang.String,java.lang.String> headers) |
java.util.NavigableSet<java.lang.String> |
getSupportedKeyTypes() |
java.security.PublicKey |
readPublicKey(SessionContext session,
NamedResource resourceKey,
java.util.List<java.lang.String> lines) |
java.security.PublicKey |
readPublicKey(SessionContext session,
NamedResource resourceKey,
java.lang.String beginMarker,
java.lang.String endMarker,
byte[] dataBytes,
java.util.Map<java.lang.String,java.lang.String> headers) |
java.security.PublicKey |
readPublicKey(SessionContext session,
NamedResource resourceKey,
java.lang.String beginMarker,
java.lang.String endMarker,
java.util.List<java.lang.String> lines,
java.util.Map<java.lang.String,java.lang.String> headers) |
java.security.PublicKey |
resolve(SessionContext session,
java.lang.String keyType,
byte[] keyData,
java.util.Map<java.lang.String,java.lang.String> headers) |
protected java.util.Map.Entry<java.util.Map<java.lang.String,java.lang.String>,java.util.List<java.lang.String>> |
separateDataLinesFromHeaders(SessionContext session,
NamedResource resourceKey,
java.lang.String startLine,
java.lang.String endLine,
java.util.List<java.lang.String> lines) |
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 java.util.NavigableSet<java.lang.String> SUPPORTED_KEY_TYPES
public static final java.lang.String BEGIN_MARKER
public static final java.util.List<java.lang.String> START_MARKERS
public static final java.lang.String END_MARKER
public static final java.util.List<java.lang.String> STOP_MARKERS
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 java.util.NavigableSet<java.lang.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 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
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
java.io.IOException
- If failed to parse the key datajava.security.GeneralSecurityException
- If failed to generate the keypublic java.security.PublicKey decodePublicKey(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
decodePublicKey
in interface PublicKeyRawDataDecoder<java.security.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
java.io.IOException
- If failed to read from the data streamjava.security.GeneralSecurityException
- If failed to generate the keypublic java.security.PublicKey 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
decodePublicKeyByType
in interface PublicKeyRawDataDecoder<java.security.PublicKey>
java.io.IOException
java.security.GeneralSecurityException
public java.security.PublicKey readPublicKey(SessionContext session, NamedResource resourceKey, java.util.List<java.lang.String> lines) throws java.io.IOException, java.security.GeneralSecurityException
readPublicKey
in interface PublicKeyRawDataReader<java.security.PublicKey>
java.io.IOException
java.security.GeneralSecurityException
public java.security.PublicKey readPublicKey(SessionContext session, NamedResource resourceKey, java.lang.String beginMarker, java.lang.String endMarker, java.util.List<java.lang.String> lines, java.util.Map<java.lang.String,java.lang.String> headers) throws java.io.IOException, java.security.GeneralSecurityException
java.io.IOException
java.security.GeneralSecurityException
public java.security.PublicKey readPublicKey(SessionContext session, NamedResource resourceKey, java.lang.String beginMarker, java.lang.String endMarker, byte[] dataBytes, java.util.Map<java.lang.String,java.lang.String> headers) throws java.io.IOException, java.security.GeneralSecurityException
java.io.IOException
java.security.GeneralSecurityException
protected java.util.Map.Entry<java.util.Map<java.lang.String,java.lang.String>,java.util.List<java.lang.String>> separateDataLinesFromHeaders(SessionContext session, NamedResource resourceKey, java.lang.String startLine, java.lang.String endLine, java.util.List<java.lang.String> lines) throws java.io.IOException, java.security.GeneralSecurityException
java.io.IOException
java.security.GeneralSecurityException