com.evolveum.midpoint.common.crypto
Class AESProtector
java.lang.Object
com.evolveum.midpoint.common.crypto.AESProtector
- All Implemented Interfaces:
- Protector
- Direct Known Subclasses:
- KeyStoreConfigurator
public class AESProtector
- extends java.lang.Object
- implements Protector
Class that manages encrypted string values. Java Cryptography Extension is
needed because this class is using AES-256 for encrypting/decrypting xml
data.
- Author:
- Radovan Semancik, lazyman
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AESProtector
public AESProtector()
init
public void init()
- Throws:
SystemException
- if jceks keystore is not available on getKeyStorePath
setEncryptionKeyAlias
public void setEncryptionKeyAlias(java.lang.String encryptionKeyAlias)
- Parameters:
encryptionKeyAlias
- Alias of the encryption key SecretKey
which is used
for encryption
- Throws:
java.lang.IllegalArgumentException
- if encryption key digest is null or empty string
setKeyStorePassword
public void setKeyStorePassword(java.lang.String keyStorePassword)
- Parameters:
keyStorePassword
-
- Throws:
java.lang.IllegalArgumentException
- if keystore password is null string
setKeyStorePath
public void setKeyStorePath(java.lang.String keyStorePath)
- Parameters:
keyStorePath
-
- Throws:
java.lang.IllegalArgumentException
- if keystore path is null string
decryptString
public java.lang.String decryptString(ProtectedStringType protectedString)
throws EncryptionException
- Specified by:
decryptString
in interface Protector
- Returns:
- decrypted String from protectedString object
- Throws:
EncryptionException
- this is thrown probably in case JRE/JDK doesn't have JCE
installed
decrypt
public org.w3c.dom.Element decrypt(ProtectedStringType protectedString)
throws EncryptionException
- Specified by:
decrypt
in interface Protector
- Returns:
- decrypted DOM
Element
- Throws:
EncryptionException
- this is thrown probably in case JRE/JDK doesn't have JCE
installed
encryptString
public ProtectedStringType encryptString(java.lang.String text)
throws EncryptionException
- Specified by:
encryptString
in interface Protector
- Returns:
ProtectedStringType
with encrypted string inside it. If
input argument is null or empty, method returns null.
- Throws:
EncryptionException
- this is thrown probably in case JRE/JDK doesn't have JCE
installed
encrypt
public ProtectedStringType encrypt(org.w3c.dom.Element plain)
throws EncryptionException
- Specified by:
encrypt
in interface Protector
- Returns:
ProtectedStringType
with encrypted element inside it. If
input argument is null, method returns null.
- Throws:
EncryptionException
- this is thrown probably in case JRE/JDK doesn't have JCE
installed
encrypt
public void encrypt(ProtectedStringType ps)
throws EncryptionException
- Description copied from interface:
Protector
- Encrypts the ProtectedStringType "in place".
- Specified by:
encrypt
in interface Protector
- Throws:
EncryptionException
isEncrypted
public boolean isEncrypted(ProtectedStringType ps)
- Description copied from interface:
Protector
- Returns true if protected string contains encrypted data that seems valid.
- Specified by:
isEncrypted
in interface Protector
Copyright © 2011 evolveum. All Rights Reserved.