Class AESPrivateKeyObfuscator
java.lang.Object
org.apache.sshd.common.config.keys.loader.AbstractPrivateKeyObfuscator
org.apache.sshd.common.config.keys.loader.AESPrivateKeyObfuscator
- All Implemented Interfaces:
PrivateKeyObfuscator
- Direct Known Subclasses:
OpenSSHKeyPairResourceWriter.KeyEncryptor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
applyPrivateKeyCipher
(byte[] bytes, PrivateKeyEncryptionContext encContext, boolean encryptIt) static Predicate
<CipherInformation> createCipherSelector
(int keyLength, String cipherMode) protected CipherInformation
resolveCipherInformation
(int keyLength, String cipherMode) protected int
protected int
resolveKeyLength
(PrivateKeyEncryptionContext encContext) Methods inherited from class org.apache.sshd.common.config.keys.loader.AbstractPrivateKeyObfuscator
appendPrivateKeyEncryptionContext, applyPrivateKeyCipher, deriveEncryptionKey, generateInitializationVector, getCipherName
-
Field Details
-
CIPHER_NAME
- See Also:
-
INSTANCE
-
-
Constructor Details
-
AESPrivateKeyObfuscator
public AESPrivateKeyObfuscator()
-
-
Method Details
-
getSupportedKeySizes
- Returns:
- A
List
of the supported key sizes - Note: every call returns a and un-modifiable instance.
-
applyPrivateKeyCipher
public byte[] applyPrivateKeyCipher(byte[] bytes, PrivateKeyEncryptionContext encContext, boolean encryptIt) throws GeneralSecurityException, IOException - Parameters:
bytes
- Original bytesencContext
- The encryption contextencryptIt
- Iftrue
then encrypt the original bytes, otherwise decrypt them- Returns:
- The result of applying the cipher to the original bytes
- Throws:
GeneralSecurityException
- If cannot encrypt/decryptIOException
- If malformed input
-
resolveInitializationVectorLength
protected int resolveInitializationVectorLength(PrivateKeyEncryptionContext encContext) throws GeneralSecurityException - Specified by:
resolveInitializationVectorLength
in classAbstractPrivateKeyObfuscator
- Throws:
GeneralSecurityException
-
resolveCipherInformation
-
resolveKeyLength
protected int resolveKeyLength(PrivateKeyEncryptionContext encContext) throws GeneralSecurityException - Specified by:
resolveKeyLength
in classAbstractPrivateKeyObfuscator
- Throws:
GeneralSecurityException
-
getAvailableKeyLengths
-
createCipherSelector
-