Package org.apache.sshd.putty
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.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>
-
Field Summary
FieldsFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
logFields inherited from interface org.apache.sshd.common.config.keys.IdentityResourceLoader
MAX_BIGINT_OCTETS_COUNTFields 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_SIZEFields inherited from interface org.apache.sshd.common.config.keys.loader.KeyPairResourceParser
EMPTYFields 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
ConstructorsModifierConstructorDescriptionprotectedAbstractPuttyKeyDecoder(Class<PUB> pubType, Class<PRV> prvType, Collection<String> names) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanExtractKeyPairs(NamedResource resourceKey, List<String> lines) extractDataLines(NamedResource resourceKey, List<String> lines, int startIndex, String hdrName, String hdrValue, List<String> curLines) loadKeyPairs(NamedResource resourceKey, int formatVersion, byte[] pubData, byte[] prvData, Map<String, String> headers) loadKeyPairs(NamedResource resourceKey, int formatVersion, InputStream pubData, InputStream prvData, Map<String, String> headers) abstract Collection<KeyPair> loadKeyPairs(NamedResource resourceKey, int formatVersion, PuttyKeyReader pubReader, PuttyKeyReader prvReader, Map<String, String> headers) loadKeyPairs(SessionContext session, NamedResource resourceKey, int formatVersion, String pubData, String prvData, String prvEncryption, FilePasswordProvider passwordProvider, Map<String, String> headers) loadKeyPairs(SessionContext session, NamedResource resourceKey, int formatVersion, List<String> pubLines, List<String> prvLines, String prvEncryption, FilePasswordProvider passwordProvider, Map<String, String> headers) loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, List<String> lines) Loads key pairs from the given resource text linesMethods inherited from class org.apache.sshd.common.config.keys.impl.AbstractIdentityResourceLoader
getPrivateKeyType, getPublicKeyType, getSupportedKeyTypesMethods 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, warnMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.sshd.common.config.keys.IdentityResourceLoader
getPrivateKeyType, getPublicKeyTypeMethods inherited from interface org.apache.sshd.common.config.keys.loader.KeyPairResourceLoader
loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairsMethods inherited from interface org.apache.sshd.common.config.keys.KeyTypeNamesSupport
getSupportedKeyTypes
-
Field Details
-
ENCRYPTION_HEADER
- See Also:
-
-
Constructor Details
-
AbstractPuttyKeyDecoder
-
-
Method Details
-
canExtractKeyPairs
public boolean canExtractKeyPairs(NamedResource resourceKey, List<String> lines) throws IOException, GeneralSecurityException - Specified by:
canExtractKeyPairsin interfaceKeyPairResourceParser- Specified by:
canExtractKeyPairsin interfacePuttyKeyPairResourceParser<PUB extends PublicKey,PRV extends PrivateKey> - Parameters:
resourceKey- A hint as to the origin of the text lineslines- The resource lines- Returns:
trueif 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:KeyPairResourceLoaderLoads key pairs from the given resource text lines- Specified by:
loadKeyPairsin interfaceKeyPairResourceLoader- Parameters:
session- TheSessionContextfor invoking this load command - may benullif not invoked within a session context (e.g., offline tool or session unknown).resourceKey- A hint as to the origin of the text linespasswordProvider- TheFilePasswordProviderto use in case the data is encrypted - may benullif no encrypted data is expectedlines- TheListof lines as read from the resource- Returns:
- The extracted
KeyPairs - 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, int formatVersion, List<String> pubLines, List<String> prvLines, String prvEncryption, FilePasswordProvider passwordProvider, Map<String, String> headers) throws IOException, GeneralSecurityException- Throws:
IOExceptionGeneralSecurityException
-
loadKeyPairs
public Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, int formatVersion, String pubData, String prvData, String prvEncryption, FilePasswordProvider passwordProvider, Map<String, String> headers) throws IOException, GeneralSecurityException- Throws:
IOExceptionGeneralSecurityException
-
loadKeyPairs
public Collection<KeyPair> loadKeyPairs(NamedResource resourceKey, int formatVersion, byte[] pubData, byte[] prvData, Map<String, String> headers) throws IOException, GeneralSecurityException- Throws:
IOExceptionGeneralSecurityException
-
loadKeyPairs
public Collection<KeyPair> loadKeyPairs(NamedResource resourceKey, int formatVersion, InputStream pubData, InputStream prvData, Map<String, String> headers) throws IOException, GeneralSecurityException- Throws:
IOExceptionGeneralSecurityException
-
loadKeyPairs
public abstract Collection<KeyPair> loadKeyPairs(NamedResource resourceKey, int formatVersion, PuttyKeyReader pubReader, PuttyKeyReader prvReader, Map<String, String> headers) throws IOException, GeneralSecurityException- Throws:
IOExceptionGeneralSecurityException
-