Package org.apache.sshd.putty
Class AbstractPuttyKeyDecoder<PUB extends java.security.PublicKey,PRV extends java.security.PrivateKey>
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.common.config.keys.impl.AbstractIdentityResourceLoader<PUB,PRV>
-
- org.apache.sshd.putty.AbstractPuttyKeyDecoder<PUB,PRV>
-
- Type Parameters:
PUB
- Generic public key typePRV
- Generic private key type
- All Implemented Interfaces:
IdentityResourceLoader<PUB,PRV>
,KeyTypeNamesSupport
,KeyPairResourceLoader
,KeyPairResourceParser
,PuttyKeyPairResourceParser<PUB,PRV>
- Direct Known Subclasses:
DSSPuttyKeyDecoder
,ECDSAPuttyKeyDecoder
,EdDSAPuttyKeyDecoder
,RSAPuttyKeyDecoder
public abstract class AbstractPuttyKeyDecoder<PUB extends java.security.PublicKey,PRV extends java.security.PrivateKey> extends AbstractIdentityResourceLoader<PUB,PRV> implements PuttyKeyPairResourceParser<PUB,PRV>
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ENCRYPTION_HEADER
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Fields inherited from interface org.apache.sshd.common.config.keys.IdentityResourceLoader
MAX_BIGINT_OCTETS_COUNT
-
Fields inherited from interface org.apache.sshd.common.config.keys.loader.KeyPairResourceLoader
MAX_CIPHER_NAME_LENGTH, MAX_KEY_COMMENT_LENGTH, MAX_KEY_TYPE_NAME_LENGTH, MAX_PRIVATE_KEY_DATA_SIZE, MAX_PUBLIC_KEY_DATA_SIZE
-
Fields inherited from interface org.apache.sshd.common.config.keys.loader.KeyPairResourceParser
EMPTY
-
Fields inherited from interface org.apache.sshd.putty.PuttyKeyPairResourceParser
FORMAT_3_MAC_KEY_LENGTH, KEY_FILE_HEADER_PREFIX, KNOWN_HEADERS, NO_PRIVATE_KEY_ENCRYPTION_VALUE, PPK_FILE_SUFFIX, PRIVATE_LINES_HEADER, PUBLIC_LINES_HEADER
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractPuttyKeyDecoder(java.lang.Class<PUB> pubType, java.lang.Class<PRV> prvType, java.util.Collection<java.lang.String> names)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
canExtractKeyPairs(NamedResource resourceKey, java.util.List<java.lang.String> lines)
static java.util.List<java.lang.String>
extractDataLines(NamedResource resourceKey, java.util.List<java.lang.String> lines, int startIndex, java.lang.String hdrName, java.lang.String hdrValue, java.util.List<java.lang.String> curLines)
java.util.Collection<java.security.KeyPair>
loadKeyPairs(NamedResource resourceKey, int formatVersion, byte[] pubData, byte[] prvData, java.util.Map<java.lang.String,java.lang.String> headers)
java.util.Collection<java.security.KeyPair>
loadKeyPairs(NamedResource resourceKey, int formatVersion, java.io.InputStream pubData, java.io.InputStream prvData, java.util.Map<java.lang.String,java.lang.String> headers)
abstract java.util.Collection<java.security.KeyPair>
loadKeyPairs(NamedResource resourceKey, int formatVersion, PuttyKeyReader pubReader, PuttyKeyReader prvReader, java.util.Map<java.lang.String,java.lang.String> headers)
java.util.Collection<java.security.KeyPair>
loadKeyPairs(SessionContext session, NamedResource resourceKey, int formatVersion, java.lang.String pubData, java.lang.String prvData, java.lang.String prvEncryption, FilePasswordProvider passwordProvider, java.util.Map<java.lang.String,java.lang.String> headers)
java.util.Collection<java.security.KeyPair>
loadKeyPairs(SessionContext session, NamedResource resourceKey, int formatVersion, java.util.List<java.lang.String> pubLines, java.util.List<java.lang.String> prvLines, java.lang.String prvEncryption, FilePasswordProvider passwordProvider, java.util.Map<java.lang.String,java.lang.String> headers)
java.util.Collection<java.security.KeyPair>
loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, java.util.List<java.lang.String> lines)
Loads key pairs from the given resource text lines-
Methods inherited from class org.apache.sshd.common.config.keys.impl.AbstractIdentityResourceLoader
getPrivateKeyType, getPublicKeyType, getSupportedKeyTypes
-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.config.keys.IdentityResourceLoader
getPrivateKeyType, getPublicKeyType
-
Methods inherited from interface org.apache.sshd.common.config.keys.loader.KeyPairResourceLoader
loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs
-
Methods inherited from interface org.apache.sshd.common.config.keys.KeyTypeNamesSupport
getSupportedKeyTypes
-
-
-
-
Field Detail
-
ENCRYPTION_HEADER
public static final java.lang.String ENCRYPTION_HEADER
- See Also:
- Constant Field Values
-
-
Method Detail
-
canExtractKeyPairs
public boolean canExtractKeyPairs(NamedResource resourceKey, java.util.List<java.lang.String> lines) throws java.io.IOException, java.security.GeneralSecurityException
- Specified by:
canExtractKeyPairs
in interfaceKeyPairResourceParser
- Specified by:
canExtractKeyPairs
in interfacePuttyKeyPairResourceParser<PUB extends java.security.PublicKey,PRV extends java.security.PrivateKey>
- Parameters:
resourceKey
- A hint as to the origin of the text lineslines
- The resource lines- Returns:
true
if the parser can extract some key pairs from the lines- Throws:
java.io.IOException
- If failed to process the linesjava.security.GeneralSecurityException
- If failed to extract information regarding the possibility to extract the key pairs
-
loadKeyPairs
public java.util.Collection<java.security.KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, java.util.List<java.lang.String> lines) throws java.io.IOException, java.security.GeneralSecurityException
Description copied from interface:KeyPairResourceLoader
Loads key pairs from the given resource text lines- Specified by:
loadKeyPairs
in interfaceKeyPairResourceLoader
- Parameters:
session
- TheSessionContext
for invoking this load command - may benull
if not invoked within a session context (e.g., offline tool or session unknown).resourceKey
- A hint as to the origin of the text linespasswordProvider
- TheFilePasswordProvider
to use in case the data is encrypted - may benull
if no encrypted data is expectedlines
- TheList
of lines as read from the resource- Returns:
- The extracted
KeyPair
s - may benull
/empty if none. Note: the resource loader may decide to skip unknown lines if more than one key pair type is encoded in it - Throws:
java.io.IOException
- If failed to process the linesjava.security.GeneralSecurityException
- If failed to generate the keys from the parsed data
-
extractDataLines
public static java.util.List<java.lang.String> extractDataLines(NamedResource resourceKey, java.util.List<java.lang.String> lines, int startIndex, java.lang.String hdrName, java.lang.String hdrValue, java.util.List<java.lang.String> curLines) throws java.io.IOException
- Throws:
java.io.IOException
-
loadKeyPairs
public java.util.Collection<java.security.KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, int formatVersion, java.util.List<java.lang.String> pubLines, java.util.List<java.lang.String> prvLines, java.lang.String prvEncryption, FilePasswordProvider passwordProvider, java.util.Map<java.lang.String,java.lang.String> headers) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
loadKeyPairs
public java.util.Collection<java.security.KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, int formatVersion, java.lang.String pubData, java.lang.String prvData, java.lang.String prvEncryption, FilePasswordProvider passwordProvider, java.util.Map<java.lang.String,java.lang.String> headers) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
loadKeyPairs
public java.util.Collection<java.security.KeyPair> loadKeyPairs(NamedResource resourceKey, int formatVersion, byte[] pubData, byte[] prvData, java.util.Map<java.lang.String,java.lang.String> headers) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
loadKeyPairs
public java.util.Collection<java.security.KeyPair> loadKeyPairs(NamedResource resourceKey, int formatVersion, java.io.InputStream pubData, java.io.InputStream prvData, java.util.Map<java.lang.String,java.lang.String> headers) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
loadKeyPairs
public abstract java.util.Collection<java.security.KeyPair> loadKeyPairs(NamedResource resourceKey, int formatVersion, PuttyKeyReader pubReader, PuttyKeyReader prvReader, java.util.Map<java.lang.String,java.lang.String> headers) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
-