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 class
EncryptedPEMKeyReader.DataEncryptionKeyInfo
-
Field Summary
Fields Modifier and Type Field Description private static int
DEK_INFO_ALGORITHM_GROUP
private static int
DEK_INFO_IV_GROUP
private static java.util.regex.Pattern
DEK_INFO_PATTERN
private PasswordFinder
passwordFinder
private static java.lang.String
PROC_TYPE_ENCRYPTED_HEADER
private 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.DataEncryptionKeyInfo
getDataEncryptionKeyInfo(java.util.List<java.lang.String> headers)
private byte[]
getDecryptedPemKeyBody(char[] password, byte[] pemKeyBody, EncryptedPEMKeyReader.DataEncryptionKeyInfo dataEncryptionKeyInfo)
private boolean
isEncrypted(java.util.List<java.lang.String> headers)
private PEMKey
readEncryptedPemKey(PEMKey pemKey)
PEMKey
readPemKey(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:StandardPEMKeyReader
Read PEM Key from Buffered Reader- Specified by:
readPemKey
in interfacePEMKeyReader
- Overrides:
readPemKey
in 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
-
-