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
public class AESPrivateKeyObfuscator extends AbstractPrivateKeyObfuscator
- Author:
- Apache MINA SSHD Project
-
-
Field Summary
Fields Modifier and Type Field Description static String
CIPHER_NAME
static AESPrivateKeyObfuscator
INSTANCE
-
Constructor Summary
Constructors Constructor Description AESPrivateKeyObfuscator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
applyPrivateKeyCipher(byte[] bytes, PrivateKeyEncryptionContext encContext, boolean encryptIt)
static Predicate<CipherInformation>
createCipherSelector(int keyLength, String cipherMode)
static List<Integer>
getAvailableKeyLengths()
List<Integer>
getSupportedKeySizes()
protected CipherInformation
resolveCipherInformation(int keyLength, String cipherMode)
protected int
resolveInitializationVectorLength(PrivateKeyEncryptionContext encContext)
protected int
resolveKeyLength(PrivateKeyEncryptionContext encContext)
-
Methods inherited from class org.apache.sshd.common.config.keys.loader.AbstractPrivateKeyObfuscator
appendPrivateKeyEncryptionContext, applyPrivateKeyCipher, deriveEncryptionKey, generateInitializationVector, getCipherName
-
-
-
-
Field Detail
-
CIPHER_NAME
public static final String CIPHER_NAME
- See Also:
- Constant Field Values
-
INSTANCE
public static final AESPrivateKeyObfuscator INSTANCE
-
-
Method Detail
-
getSupportedKeySizes
public List<Integer> 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
protected CipherInformation resolveCipherInformation(int keyLength, String cipherMode)
-
resolveKeyLength
protected int resolveKeyLength(PrivateKeyEncryptionContext encContext) throws GeneralSecurityException
- Specified by:
resolveKeyLength
in classAbstractPrivateKeyObfuscator
- Throws:
GeneralSecurityException
-
createCipherSelector
public static Predicate<CipherInformation> createCipherSelector(int keyLength, String cipherMode)
-
-