public class OpenSSHKeyPairResourceParser extends AbstractKeyPairResourceParser
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
AUTH_MAGIC |
private static byte[] |
AUTH_MAGIC_BYTES |
static java.lang.String |
BEGIN_MARKER |
static java.util.List<java.lang.String> |
BEGINNERS |
private static java.util.Map<java.lang.Class<?>,PrivateKeyEntryDecoder<?,?>> |
BY_KEY_CLASS_DECODERS_MAP |
private static java.util.Map<java.lang.String,PrivateKeyEntryDecoder<?,?>> |
BY_KEY_TYPE_DECODERS_MAP |
static java.lang.String |
END_MARKER |
static java.util.List<java.lang.String> |
ENDERS |
static OpenSSHKeyPairResourceParser |
INSTANCE |
logEMPTYMAX_CIPHER_NAME_LENGTH, MAX_KEY_COMMENT_LENGTH, MAX_KEY_TYPE_NAME_LENGTH, MAX_PRIVATE_KEY_DATA_SIZE, MAX_PUBLIC_KEY_DATA_SIZE| Constructor and Description |
|---|
OpenSSHKeyPairResourceParser() |
| Modifier and Type | Method and Description |
|---|---|
java.util.Collection<java.security.KeyPair> |
extractKeyPairs(SessionContext session,
NamedResource resourceKey,
java.lang.String beginMarker,
java.lang.String endMarker,
FilePasswordProvider passwordProvider,
java.io.InputStream stream,
java.util.Map<java.lang.String,java.lang.String> headers) |
static PrivateKeyEntryDecoder<?,?> |
getPrivateKeyEntryDecoder(java.lang.Class<?> keyType) |
static PrivateKeyEntryDecoder<?,?> |
getPrivateKeyEntryDecoder(java.security.Key key) |
static PrivateKeyEntryDecoder<?,?> |
getPrivateKeyEntryDecoder(java.security.KeyPair kp) |
static PrivateKeyEntryDecoder<?,?> |
getPrivateKeyEntryDecoder(java.lang.String keyType) |
protected java.util.Map.Entry<java.security.PrivateKey,java.lang.String> |
readPrivateKey(SessionContext session,
NamedResource resourceKey,
OpenSSHParserContext context,
java.lang.String keyType,
FilePasswordProvider passwordProvider,
java.io.InputStream stream) |
protected java.util.List<java.security.KeyPair> |
readPrivateKeys(SessionContext session,
NamedResource resourceKey,
OpenSSHParserContext context,
java.util.Collection<? extends java.security.PublicKey> publicKeys,
FilePasswordProvider passwordProvider,
java.io.InputStream stream) |
protected java.security.PublicKey |
readPublicKey(SessionContext session,
NamedResource resourceKey,
OpenSSHParserContext context,
java.io.InputStream stream,
java.util.Map<java.lang.String,java.lang.String> headers) |
static void |
registerPrivateKeyEntryDecoder(PrivateKeyEntryDecoder<?,?> decoder) |
protected OpenSSHKdfOptions |
resolveKdfOptions(SessionContext session,
NamedResource resourceKey,
java.lang.String beginMarker,
java.lang.String endMarker,
java.io.InputStream stream,
java.util.Map<java.lang.String,java.lang.String> headers) |
protected <S extends java.io.InputStream> |
validateStreamMagicMarker(SessionContext session,
NamedResource resourceKey,
S stream) |
canExtractKeyPairs, extractKeyPairs, extractKeyPairs, getBeginners, getEnders, getEndingMarkers, loadKeyPairs, separateDataLinesFromHeadersgetSimplifiedLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaggregate, aggregate, containsMarkerLine, containsMarkerLine, extractDataBytes, findMarkerLine, findMarkerLine, joinDataLinesloadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairspublic static final java.lang.String BEGIN_MARKER
public static final java.util.List<java.lang.String> BEGINNERS
public static final java.lang.String END_MARKER
public static final java.util.List<java.lang.String> ENDERS
public static final java.lang.String AUTH_MAGIC
public static final OpenSSHKeyPairResourceParser INSTANCE
private static final byte[] AUTH_MAGIC_BYTES
private static final java.util.Map<java.lang.String,PrivateKeyEntryDecoder<?,?>> BY_KEY_TYPE_DECODERS_MAP
private static final java.util.Map<java.lang.Class<?>,PrivateKeyEntryDecoder<?,?>> BY_KEY_CLASS_DECODERS_MAP
public java.util.Collection<java.security.KeyPair> extractKeyPairs(SessionContext session, NamedResource resourceKey, java.lang.String beginMarker, java.lang.String endMarker, FilePasswordProvider passwordProvider, java.io.InputStream stream, java.util.Map<java.lang.String,java.lang.String> headers) throws java.io.IOException, java.security.GeneralSecurityException
extractKeyPairs in class AbstractKeyPairResourceParsersession - 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 linesbeginMarker - The line containing the begin markerendMarker - The line containing the end markerpasswordProvider - The FilePasswordProvider to use in case the data is encrypted - may be
null if no encryptedstream - The decoded data InputStreamheaders - Any headers that may have been available when data was readKeyPairs - may be null/empty if none.java.io.IOException - If failed to parse the datajava.security.GeneralSecurityException - If failed to generate the keysprotected OpenSSHKdfOptions resolveKdfOptions(SessionContext session, NamedResource resourceKey, java.lang.String beginMarker, java.lang.String endMarker, java.io.InputStream stream, java.util.Map<java.lang.String,java.lang.String> headers) throws java.io.IOException, java.security.GeneralSecurityException
java.io.IOExceptionjava.security.GeneralSecurityExceptionprotected java.security.PublicKey readPublicKey(SessionContext session, NamedResource resourceKey, OpenSSHParserContext context, java.io.InputStream stream, java.util.Map<java.lang.String,java.lang.String> headers) throws java.io.IOException, java.security.GeneralSecurityException
java.io.IOExceptionjava.security.GeneralSecurityExceptionprotected java.util.List<java.security.KeyPair> readPrivateKeys(SessionContext session, NamedResource resourceKey, OpenSSHParserContext context, java.util.Collection<? extends java.security.PublicKey> publicKeys, FilePasswordProvider passwordProvider, java.io.InputStream stream) throws java.io.IOException, java.security.GeneralSecurityException
java.io.IOExceptionjava.security.GeneralSecurityExceptionprotected java.util.Map.Entry<java.security.PrivateKey,java.lang.String> readPrivateKey(SessionContext session, NamedResource resourceKey, OpenSSHParserContext context, java.lang.String keyType, FilePasswordProvider passwordProvider, java.io.InputStream stream) throws java.io.IOException, java.security.GeneralSecurityException
java.io.IOExceptionjava.security.GeneralSecurityExceptionprotected <S extends java.io.InputStream> S validateStreamMagicMarker(SessionContext session, NamedResource resourceKey, S stream) throws java.io.IOException
java.io.IOExceptionpublic static void registerPrivateKeyEntryDecoder(PrivateKeyEntryDecoder<?,?> decoder)
decoder - The decoder to registerjava.lang.IllegalArgumentException - if no decoder or not key type or no supported names for the decoderIdentityResourceLoader.getPublicKeyType(),
KeyTypeNamesSupport.getSupportedKeyTypes()public static PrivateKeyEntryDecoder<?,?> getPrivateKeyEntryDecoder(java.lang.String keyType)
keyType - The OpenSSH key type string - e.g., ssh-rsa, ssh-dss - ignored if
null/emptyPrivateKeyEntryDecoder or {code null} if not foundpublic static PrivateKeyEntryDecoder<?,?> getPrivateKeyEntryDecoder(java.security.KeyPair kp)
kp - The KeyPair to examine - ignored if nullPrivateKeyEntryDecoder provided both the public and private keys have the
same decoder - null if no match foundgetPrivateKeyEntryDecoder(Key)public static PrivateKeyEntryDecoder<?,?> getPrivateKeyEntryDecoder(java.security.Key key)
key - The Key (public or private) - ignored if nullPrivateKeyEntryDecoder for this key or {code null} if no match foundgetPrivateKeyEntryDecoder(Class)public static PrivateKeyEntryDecoder<?,?> getPrivateKeyEntryDecoder(java.lang.Class<?> keyType)
keyType - The key Class - ignored if null or not a Key compatible typePrivateKeyEntryDecoder or {code null} if no match found