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
public class AESPrivateKeyObfuscator extends AbstractPrivateKeyObfuscator
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
AESPrivateKeyObfuscator.LazyKeyLengthsHolder
-
Field Summary
Fields Modifier and Type Field Description static java.lang.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 java.util.List<java.lang.Integer>
getAvailableKeyLengths()
java.util.List<java.lang.Integer>
getSupportedKeySizes()
protected int
resolveKeyLength(PrivateKeyEncryptionContext encContext)
-
Methods inherited from class org.apache.sshd.common.config.keys.loader.AbstractPrivateKeyObfuscator
appendPrivateKeyEncryptionContext, applyPrivateKeyCipher, deriveEncryptionKey, generateInitializationVector, generateInitializationVector, getCipherName
-
-
-
-
Field Detail
-
CIPHER_NAME
public static final java.lang.String CIPHER_NAME
- See Also:
- Constant Field Values
-
INSTANCE
public static final AESPrivateKeyObfuscator INSTANCE
-
-
Method Detail
-
getSupportedKeySizes
public java.util.List<java.lang.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 java.security.GeneralSecurityException, java.io.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:
java.security.GeneralSecurityException
- If cannot encrypt/decryptjava.io.IOException
- If malformed input
-
resolveKeyLength
protected int resolveKeyLength(PrivateKeyEncryptionContext encContext) throws java.security.GeneralSecurityException
- Specified by:
resolveKeyLength
in classAbstractPrivateKeyObfuscator
- Throws:
java.security.GeneralSecurityException
-
getAvailableKeyLengths
public static java.util.List<java.lang.Integer> getAvailableKeyLengths()
- Returns:
- A
List
ofInteger
s holding the available key lengths values (in bits) for the JVM. Note: AES 256 requires special JCE policy extension installation (e.g., for Java 7 see this link)
-
-