Class EncryptedPEMKeyReader
- java.lang.Object
-
- net.schmizz.sshj.userauth.keyprovider.StandardPEMKeyReader
-
- net.schmizz.sshj.userauth.keyprovider.EncryptedPEMKeyReader
-
- All Implemented Interfaces:
PEMKeyReader
class EncryptedPEMKeyReader extends StandardPEMKeyReader
PEM Key Reader implementation supporting historical password-based encryption from OpenSSL EVP_BytesToKey
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classEncryptedPEMKeyReader.DataEncryptionKeyInfo
-
Field Summary
Fields Modifier and Type Field Description private static intDEK_INFO_ALGORITHM_GROUPprivate static intDEK_INFO_IV_GROUPprivate static java.util.regex.PatternDEK_INFO_PATTERNprivate PasswordFinderpasswordFinderprivate static java.lang.StringPROC_TYPE_ENCRYPTED_HEADERprivate Resource<?>resource
-
Constructor Summary
Constructors Constructor Description EncryptedPEMKeyReader(PasswordFinder passwordFinder, Resource<?> resource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private EncryptedPEMKeyReader.DataEncryptionKeyInfogetDataEncryptionKeyInfo(java.util.List<java.lang.String> headers)private byte[]getDecryptedPemKeyBody(char[] password, byte[] pemKeyBody, EncryptedPEMKeyReader.DataEncryptionKeyInfo dataEncryptionKeyInfo)private booleanisEncrypted(java.util.List<java.lang.String> headers)private PEMKeyreadEncryptedPemKey(PEMKey pemKey)PEMKeyreadPemKey(java.io.BufferedReader bufferedReader)Read PEM Key from Buffered Reader
-
-
-
Field Detail
-
PROC_TYPE_ENCRYPTED_HEADER
private static final java.lang.String PROC_TYPE_ENCRYPTED_HEADER
- See Also:
- Constant Field Values
-
DEK_INFO_PATTERN
private static final java.util.regex.Pattern DEK_INFO_PATTERN
-
DEK_INFO_ALGORITHM_GROUP
private static final int DEK_INFO_ALGORITHM_GROUP
- See Also:
- Constant Field Values
-
DEK_INFO_IV_GROUP
private static final int DEK_INFO_IV_GROUP
- See Also:
- Constant Field Values
-
passwordFinder
private final PasswordFinder passwordFinder
-
resource
private final Resource<?> resource
-
-
Constructor Detail
-
EncryptedPEMKeyReader
EncryptedPEMKeyReader(PasswordFinder passwordFinder, Resource<?> resource)
-
-
Method Detail
-
readPemKey
public PEMKey readPemKey(java.io.BufferedReader bufferedReader) throws java.io.IOException
Description copied from class:StandardPEMKeyReaderRead PEM Key from Buffered Reader- Specified by:
readPemKeyin interfacePEMKeyReader- Overrides:
readPemKeyin classStandardPEMKeyReader- Parameters:
bufferedReader- Buffered Reader containing lines from resource reader- Returns:
- PEM Key
- Throws:
java.io.IOException- Thrown on failure to read or decode PEM Key
-
isEncrypted
private boolean isEncrypted(java.util.List<java.lang.String> headers)
-
readEncryptedPemKey
private PEMKey readEncryptedPemKey(PEMKey pemKey) throws java.io.IOException
- Throws:
java.io.IOException
-
getDecryptedPemKeyBody
private byte[] getDecryptedPemKeyBody(char[] password, byte[] pemKeyBody, EncryptedPEMKeyReader.DataEncryptionKeyInfo dataEncryptionKeyInfo) throws java.io.IOException- Throws:
java.io.IOException
-
getDataEncryptionKeyInfo
private EncryptedPEMKeyReader.DataEncryptionKeyInfo getDataEncryptionKeyInfo(java.util.List<java.lang.String> headers) throws java.io.IOException
- Throws:
java.io.IOException
-
-