Top Description Fields Constructors Methods
org.apache.sshd.common.config.keys.loader.ssh2

public Class Ssh2PublicKeyEntryDecoder

extends Object
implements PublicKeyRawDataDecoder<PublicKey>, PublicKeyEntryResolver, PublicKeyRawDataReader<PublicKey>, KeyTypeNamesSupport
Class Inheritance
All Implemented Interfaces
org.apache.sshd.common.config.keys.KeyTypeNamesSupport, org.apache.sshd.common.config.keys.PublicKeyRawDataReader, org.apache.sshd.common.config.keys.PublicKeyEntryResolver, org.apache.sshd.common.config.keys.PublicKeyRawDataDecoder
Imports
java.io.IOException, .InputStream, .StreamCorruptedException, java.security.GeneralSecurityException, .PublicKey, java.security.spec.InvalidKeySpecException, java.util.AbstractMap.SimpleImmutableEntry, .Arrays, .Collection, .Collections, .List, .Map, .NavigableSet, .TreeMap, org.apache.sshd.common.NamedResource, org.apache.sshd.common.config.keys.KeyEntryResolver, .KeyTypeNamesSupport, .KeyUtils, .PublicKeyEntryDecoder, .PublicKeyEntryResolver, .PublicKeyRawDataDecoder, .PublicKeyRawDataReader, org.apache.sshd.common.config.keys.loader.KeyPairResourceLoader, .KeyPairResourceParser, org.apache.sshd.common.keyprovider.KeyPairProvider, org.apache.sshd.common.session.SessionContext, org.apache.sshd.common.util.GenericUtils, .ValidateUtils

Decodes a public key file encoded according to The Secure Shell (SSH) Public Key File Format
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
public static final String
public static final String
public static final char
HEADER_CONTINUATION_INDICATOR

According to RFC-4716 section 3.3: A line is continued if the last character in the line is a "\".

public static final Ssh2PublicKeyEntryDecoder
public static final List<String>
public static final List<String>
public static final NavigableSet<String>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public PublicKey
decodePublicKey(SessionContext
The SessionContext for invoking this command - may be null if not invoked within a session context (e.g., offline tool or session unknown).
session
,
String
The reported / encode key type
keyType
,
InputStream
The key data bytes stream positioned after the key type decoding and making sure it is one of the supported types
keyData
,
Map<String, String>
Any headers that may have been available when data was read
headers
)

Implements org.apache.sshd.common.config.keys.PublicKeyRawDataDecoder.decodePublicKey.

public PublicKey
public NavigableSet<String>
public PublicKey
public PublicKey
readPublicKey(SessionContext session, NamedResource resourceKey, String beginMarker, String endMarker, List<String> lines, Map<String, String> headers)

public PublicKey
readPublicKey(SessionContext session, NamedResource resourceKey, String beginMarker, String endMarker, byte[] dataBytes, Map<String, String> headers)

public PublicKey
resolve(SessionContext
The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool or session unknown).
session
,
String
The OpenSSH reported key type
keyType
,
byte[]
The OpenSSH encoded key data
keyData
,
Map<String, String>
Any headers that may have been available when data was read
headers
)

Implements org.apache.sshd.common.config.keys.PublicKeyEntryResolver.resolve.

protected Map.Entry<Map<String, String>, List<String>>
separateDataLinesFromHeaders(SessionContext session, NamedResource resourceKey, String startLine, String endLine, List<String> lines)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BEGIN_MARKERback to summary
public static final String BEGIN_MARKER
END_MARKERback to summary
public static final String END_MARKER
HEADER_CONTINUATION_INDICATORback to summary
public static final char HEADER_CONTINUATION_INDICATOR

According to RFC-4716 section 3.3: 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.

INSTANCEback to summary
public static final Ssh2PublicKeyEntryDecoder INSTANCE
START_MARKERSback to summary
public static final List<String> START_MARKERS
STOP_MARKERSback to summary
public static final List<String> STOP_MARKERS
SUPPORTED_KEY_TYPESback to summary
public static final NavigableSet<String> SUPPORTED_KEY_TYPES

Constructor Detail

Ssh2PublicKeyEntryDecoderback to summary
public Ssh2PublicKeyEntryDecoder()

Method Detail

decodePublicKeyback to summary
public PublicKey decodePublicKey(SessionContext session, String keyType, InputStream keyData, Map<String, String> headers) throws IOException, GeneralSecurityException

Implements org.apache.sshd.common.config.keys.PublicKeyRawDataDecoder.decodePublicKey.

Parameters
session:SessionContext

Doc from org.apache.sshd.common.config.keys.PublicKeyRawDataDecoder.decodePublicKey.

The SessionContext for invoking this command - may be null if not invoked within a session context (e.g., offline tool or session unknown).

keyType:String

Doc from org.apache.sshd.common.config.keys.PublicKeyRawDataDecoder.decodePublicKey.

The reported / encode key type

keyData:InputStream

Doc from org.apache.sshd.common.config.keys.PublicKeyRawDataDecoder.decodePublicKey.

The key data bytes stream positioned after the key type decoding and making sure it is one of the supported types

headers:Map<String, String>

Doc from org.apache.sshd.common.config.keys.PublicKeyRawDataDecoder.decodePublicKey.

Any headers that may have been available when data was read

Returns:PublicKey

Doc from org.apache.sshd.common.config.keys.PublicKeyRawDataDecoder.decodePublicKey.

The decoded PublicKey

Annotations
@Override
Exceptions
IOException:

Doc from org.apache.sshd.common.config.keys.PublicKeyRawDataDecoder.decodePublicKey.

If failed to read from the data stream

GeneralSecurityException:

Doc from org.apache.sshd.common.config.keys.PublicKeyRawDataDecoder.decodePublicKey.

If failed to generate the key

decodePublicKeyByTypeback to summary
public PublicKey decodePublicKeyByType(SessionContext session, String keyType, InputStream keyData, Map<String, String> headers) throws IOException, GeneralSecurityException

Implements org.apache.sshd.common.config.keys.PublicKeyRawDataDecoder.decodePublicKeyByType.

Annotations
@Override
getSupportedKeyTypesback to summary
public NavigableSet<String> getSupportedKeyTypes()

Implements org.apache.sshd.common.config.keys.KeyTypeNamesSupport.getSupportedKeyTypes.

Returns:NavigableSet<String>

Doc from org.apache.sshd.common.config.keys.KeyTypeNamesSupport.getSupportedKeyTypes.

The case insensitive 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...

Annotations
@Override
readPublicKeyback to summary
public PublicKey readPublicKey(SessionContext session, NamedResource resourceKey, List<String> lines) throws IOException, GeneralSecurityException

Implements org.apache.sshd.common.config.keys.PublicKeyRawDataReader.readPublicKey.

Annotations
@Override
readPublicKeyback to summary
public PublicKey readPublicKey(SessionContext session, NamedResource resourceKey, String beginMarker, String endMarker, List<String> lines, Map<String, String> headers) throws IOException, GeneralSecurityException
readPublicKeyback to summary
public PublicKey readPublicKey(SessionContext session, NamedResource resourceKey, String beginMarker, String endMarker, byte[] dataBytes, Map<String, String> headers) throws IOException, GeneralSecurityException
resolveback to summary
public PublicKey resolve(SessionContext session, String keyType, byte[] keyData, Map<String, String> headers) throws IOException, GeneralSecurityException

Implements org.apache.sshd.common.config.keys.PublicKeyEntryResolver.resolve.

Parameters
session:SessionContext

Doc from org.apache.sshd.common.config.keys.PublicKeyEntryResolver.resolve.

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:String

Doc from org.apache.sshd.common.config.keys.PublicKeyEntryResolver.resolve.

The OpenSSH reported key type

keyData:byte[]

Doc from org.apache.sshd.common.config.keys.PublicKeyEntryResolver.resolve.

The OpenSSH encoded key data

headers:Map<String, String>

Doc from org.apache.sshd.common.config.keys.PublicKeyEntryResolver.resolve.

Any headers that may have been available when data was read

Returns:PublicKey

Doc from org.apache.sshd.common.config.keys.PublicKeyEntryResolver.resolve.

The extracted PublicKey - ignored if null

Annotations
@Override
Exceptions
IOException:

Doc from org.apache.sshd.common.config.keys.PublicKeyEntryResolver.resolve.

If failed to parse the key data

GeneralSecurityException:

Doc from org.apache.sshd.common.config.keys.PublicKeyEntryResolver.resolve.

If failed to generate the key

separateDataLinesFromHeadersback to summary
protected Map.Entry<Map<String, String>, List<String>> separateDataLinesFromHeaders(SessionContext session, NamedResource resourceKey, String startLine, String endLine, List<String> lines) throws IOException, GeneralSecurityException