PUB - Generic public key typePRV - Generic private key typepublic interface PuttyKeyPairResourceParser<PUB extends PublicKey,PRV extends PrivateKey> extends IdentityResourceLoader<PUB,PRV>, KeyPairResourceParser
KeyPair from PuTTY's ".ppk" file.
Note(s):
Sample PuTTY file format
PuTTY-User-Key-File-2: ssh-rsa Encryption: none Comment: rsa-key-20080514 Public-Lines: 4 AAAAB3NzaC1yc2EAAAABJQAAAIEAiPVUpONjGeVrwgRPOqy3Ym6kF/f8bltnmjA2 BMdAtaOpiD8A2ooqtLS5zWYuc0xkW0ogoKvORN+RF4JI+uNUlkxWxnzJM9JLpnvA HrMoVFaQ0cgDMIHtE1Ob1cGAhlNInPCRnGNJpBNcJ/OJye3yt7WqHP4SPCCLb6nL nmBUrLM= Private-Lines: 8 AAAAgGtYgJzpktzyFjBIkSAmgeVdozVhgKmF6WsDMUID9HKwtU8cn83h6h7ug8qA hUWcvVxO201/vViTjWVz9ALph3uMnpJiuQaaNYIGztGJBRsBwmQW9738pUXcsUXZ 79KJP01oHn6Wkrgk26DIOsz04QOBI6C8RumBO4+F1WdfueM9AAAAQQDmA4hcK8Bx nVtEpcF310mKD3nsbJqARdw5NV9kCxPnEsmy7Sy1L4Ob/nTIrynbc3MA9HQVJkUz 7V0va5Pjm/T7AAAAQQCYbnG0UEekwk0LG1Hkxh1OrKMxCw2KWMN8ac3L0LVBg/Tk 8EnB2oT45GGeJaw7KzdoOMFZz0iXLsVLNUjNn2mpAAAAQQCN6SEfWqiNzyc/w5n/ lFVDHExfVUJp0wXv+kzZzylnw4fs00lC3k4PZDSsb+jYCMesnfJjhDgkUA0XPyo8 Emdk Private-MAC: 50c45751d18d74c00fca395deb7b7695e3ed6f77
| Modifier and Type | Field and Description |
|---|---|
static String |
KEY_FILE_HEADER_PREFIX |
static List<String> |
KNOWN_HEADERS |
static String |
NO_PRIVATE_KEY_ENCRYPTION_VALUE
Value (case insensitive) used to denote that private key is not encrypted
|
static String |
PPK_FILE_SUFFIX |
static String |
PRIVATE_LINES_HEADER |
static String |
PUBLIC_LINES_HEADER |
MAX_BIGINT_OCTETS_COUNTEMPTYMAX_CIPHER_NAME_LENGTH, MAX_KEY_COMMENT_LENGTH, MAX_KEY_TYPE_NAME_LENGTH, MAX_PRIVATE_KEY_DATA_SIZE, MAX_PUBLIC_KEY_DATA_SIZE| Modifier and Type | Method and Description |
|---|---|
default boolean |
canExtractKeyPairs(NamedResource resourceKey,
List<String> lines) |
static byte[] |
decodePrivateKeyBytes(byte[] prvBytes,
String algName,
int numBits,
String algMode,
String password) |
static byte[] |
decodePrivateKeyBytes(byte[] encBytes,
String cipherName,
String cipherMode,
int numBits,
byte[] initVector,
byte[] keyValue) |
static byte[] |
toEncryptionKey(String passphrase)
Converts a pass-phrase into a key, by following the convention that PuTTY uses.
|
getPrivateKeyType, getPublicKeyTypefindSupporterByKeyTypeName, getSupportedKeyTypesaggregate, aggregate, containsMarkerLine, containsMarkerLine, extractDataBytes, findMarkerLine, findMarkerLine, joinDataLinesloadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairsstatic final String KEY_FILE_HEADER_PREFIX
static final String PUBLIC_LINES_HEADER
static final String PRIVATE_LINES_HEADER
static final String PPK_FILE_SUFFIX
static final String NO_PRIVATE_KEY_ENCRYPTION_VALUE
default boolean canExtractKeyPairs(NamedResource resourceKey, List<String> lines) throws IOException, GeneralSecurityException
canExtractKeyPairs in interface KeyPairResourceParserIOExceptionGeneralSecurityExceptionstatic byte[] decodePrivateKeyBytes(byte[] prvBytes,
String algName,
int numBits,
String algMode,
String password)
throws GeneralSecurityException
GeneralSecurityExceptionstatic byte[] decodePrivateKeyBytes(byte[] encBytes,
String cipherName,
String cipherMode,
int numBits,
byte[] initVector,
byte[] keyValue)
throws GeneralSecurityException
GeneralSecurityExceptionstatic byte[] toEncryptionKey(String passphrase) throws GeneralSecurityException
passphrase - the Password to be used as seed for the key - ignored
if null/emptynull/empty if no pass-phraseGeneralSecurityException - If cannot retrieve SHA-1 digestCopyright © 2018–2019 The Apache Software Foundation. All rights reserved.