public class AESPrivateKeyObfuscator extends AbstractPrivateKeyObfuscator
| Modifier and Type | Class and Description |
|---|---|
private static class |
AESPrivateKeyObfuscator.LazyKeyLengthsHolder |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CIPHER_NAME |
static AESPrivateKeyObfuscator |
INSTANCE |
| Constructor and Description |
|---|
AESPrivateKeyObfuscator() |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
applyPrivateKeyCipher(byte[] bytes,
PrivateKeyEncryptionContext encContext,
boolean encryptIt) |
static java.util.function.Predicate<CipherInformation> |
createCipherSelector(int keyLength,
java.lang.String cipherMode) |
static java.util.List<java.lang.Integer> |
getAvailableKeyLengths() |
java.util.List<java.lang.Integer> |
getSupportedKeySizes() |
protected CipherInformation |
resolveCipherInformation(int keyLength,
java.lang.String cipherMode) |
protected int |
resolveInitializationVectorLength(PrivateKeyEncryptionContext encContext) |
protected int |
resolveKeyLength(PrivateKeyEncryptionContext encContext) |
appendPrivateKeyEncryptionContext, applyPrivateKeyCipher, deriveEncryptionKey, generateInitializationVector, getCipherNamepublic static final java.lang.String CIPHER_NAME
public static final AESPrivateKeyObfuscator INSTANCE
public java.util.List<java.lang.Integer> getSupportedKeySizes()
List of the supported key sizes - Note: every call returns a and un-modifiable
instance.public byte[] applyPrivateKeyCipher(byte[] bytes,
PrivateKeyEncryptionContext encContext,
boolean encryptIt)
throws java.security.GeneralSecurityException,
java.io.IOException
bytes - Original bytesencContext - The encryption contextencryptIt - If true then encrypt the original bytes, otherwise decrypt themjava.security.GeneralSecurityException - If cannot encrypt/decryptjava.io.IOException - If malformed inputprotected int resolveInitializationVectorLength(PrivateKeyEncryptionContext encContext) throws java.security.GeneralSecurityException
resolveInitializationVectorLength in class AbstractPrivateKeyObfuscatorjava.security.GeneralSecurityExceptionprotected CipherInformation resolveCipherInformation(int keyLength, java.lang.String cipherMode)
protected int resolveKeyLength(PrivateKeyEncryptionContext encContext) throws java.security.GeneralSecurityException
resolveKeyLength in class AbstractPrivateKeyObfuscatorjava.security.GeneralSecurityExceptionpublic static java.util.List<java.lang.Integer> getAvailableKeyLengths()
List of Integers 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)public static java.util.function.Predicate<CipherInformation> createCipherSelector(int keyLength, java.lang.String cipherMode)