fixed concurrency in AES Encryption implementation, issue
@@ -25,7 +25,6 @@ public class OAESEncryption extends OAbstractEncryption {
private final String ALGORITHM_NAME = "AES";
private SecretKeySpec theKey;
- private Cipher cipher;
private boolean initialized = false;
@@ -51,7 +50,6 @@ public class OAESEncryption extends OAbstractEncryption {
final byte[] key = Base64.getDecoder().decode(iOptions);
theKey = new SecretKeySpec(key, ALGORITHM_NAME); // AES
- cipher = Cipher.getInstance(TRANSFORMATION);
} catch (Exception e) {
throw OException.wrapException(new OInvalidStorageEncryptionKeyException(
@@ -67,7 +65,7 @@ public class OAESEncryption extends OAbstractEncryption {
public byte[] encryptOrDecrypt(final int mode, final byte[] input, final int offset, final int length) throws Exception {
if (!initialized)
throw new OSecurityException("AES encryption algorithm is not available");
-
+ Cipher cipher = Cipher.getInstance(TRANSFORMATION);
cipher.init(mode, theKey);
final byte[] content;
