summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhariharan97 <rh20085046@wipro.com>2021-03-10 15:17:26 +0530
committerhariharan97 <rh20085046@wipro.com>2021-03-10 15:17:26 +0530
commit5df9fcffab2024f2dfc5c7fda6c151de92b1b5b3 (patch)
treeb4019398ab5c32fb0271e2d6d84062ec0d37d74f
parent08fba7bb7c312bfaa1a14940da6fce375471e0dc (diff)
Fix CRITICAL weak-cryptography issues identified in sonarcloud
Issue-ID: OPTFRA-924 Signed-off-by: hariharan97 <rh20085046@wipro.com> Change-Id: Iba9f12d2c5aae0ff4cf14a34ec51a4f4fa0bfaf9
-rw-r--r--conductor/conductor/common/utils/cipherUtils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/conductor/conductor/common/utils/cipherUtils.py b/conductor/conductor/common/utils/cipherUtils.py
index 0daf8ba..94c2649 100644
--- a/conductor/conductor/common/utils/cipherUtils.py
+++ b/conductor/conductor/common/utils/cipherUtils.py
@@ -61,13 +61,13 @@ class AESCipher(object):
def encrypt(self, raw):
raw = self._pad(raw)
iv = Random.new().read(AES.block_size)
- cipher = AES.new(self.key, AES.MODE_CBC, iv)
+ cipher = AES.new(self.key, AES.MODE_GCM, iv)
return base64.b64encode(iv + cipher.encrypt(raw))
def decrypt(self, enc):
enc = base64.b64decode(enc)
iv = enc[:AES.block_size]
- cipher = AES.new(self.key, AES.MODE_CBC, iv)
+ cipher = AES.new(self.key, AES.MODE_GCM, iv)
return self._unpad(cipher.decrypt(enc[AES.block_size:])).decode('utf-8')
def _pad(self, s):