Class AbstractPuttyKeyDecoder<PUB extends PublicKey,PRV extends PrivateKey>
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.common.config.keys.impl.AbstractIdentityResourceLoader<PUB,PRV>
-
- org.apache.sshd.common.config.keys.loader.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 PublicKey,PRV extends PrivateKey> extends AbstractIdentityResourceLoader<PUB,PRV> implements PuttyKeyPairResourceParser<PUB,PRV>
- Author:
- Apache MINA SSHD Project
-
-
Field Summary
Fields Modifier and Type Field Description static 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.common.config.keys.loader.putty.PuttyKeyPairResourceParser
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(Class<PUB> pubType, Class<PRV> prvType, Collection<String> names)
-
Method Summary
-
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
getSimplifiedLogger
-
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 String ENCRYPTION_HEADER
- See Also:
- Constant Field Values
-
-
Method Detail
-
canExtractKeyPairs
public boolean canExtractKeyPairs(NamedResource resourceKey, List<String> lines) throws IOException, GeneralSecurityException
- Specified by:
canExtractKeyPairs
in interfaceKeyPairResourceParser
- Specified by:
canExtractKeyPairs
in interfacePuttyKeyPairResourceParser<PUB extends PublicKey,PRV extends 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:
IOException
- If failed to process the linesGeneralSecurityException
- If failed to extract information regarding the possibility to extract the key pairs
-
loadKeyPairs
public Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, List<String> lines) throws IOException, 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:
IOException
- If failed to process the linesGeneralSecurityException
- If failed to generate the keys from the parsed data
-
extractDataLines
public static List<String> extractDataLines(NamedResource resourceKey, List<String> lines, int startIndex, String hdrName, String hdrValue, List<String> curLines) throws IOException
- Throws:
IOException
-
loadKeyPairs
public Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, List<String> pubLines, List<String> prvLines, String prvEncryption, FilePasswordProvider passwordProvider, Map<String,String> headers) throws IOException, GeneralSecurityException
- Throws:
IOException
GeneralSecurityException
-
loadKeyPairs
public Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, String pubData, String prvData, String prvEncryption, FilePasswordProvider passwordProvider, Map<String,String> headers) throws IOException, GeneralSecurityException
- Throws:
IOException
GeneralSecurityException
-
loadKeyPairs
public Collection<KeyPair> loadKeyPairs(NamedResource resourceKey, byte[] pubData, byte[] prvData, Map<String,String> headers) throws IOException, GeneralSecurityException
- Throws:
IOException
GeneralSecurityException
-
loadKeyPairs
public Collection<KeyPair> loadKeyPairs(NamedResource resourceKey, InputStream pubData, InputStream prvData, Map<String,String> headers) throws IOException, GeneralSecurityException
- Throws:
IOException
GeneralSecurityException
-
loadKeyPairs
public abstract Collection<KeyPair> loadKeyPairs(NamedResource resourceKey, PuttyKeyReader pubReader, PuttyKeyReader prvReader, Map<String,String> headers) throws IOException, GeneralSecurityException
- Throws:
IOException
GeneralSecurityException
-
-