mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-17 15:59:04 +00:00
fix: 修复空字符串加密报错的问题
This commit is contained in:
@@ -33,7 +33,7 @@ class EBCCipher:
|
||||
def __padding(val):
|
||||
# padding
|
||||
val = bytes(val)
|
||||
while len(val) % 16 != 0:
|
||||
while len(val) == 0 or len(val) % 16 != 0:
|
||||
val += b'\0'
|
||||
return val
|
||||
|
||||
|
@@ -233,6 +233,8 @@ class Crypto:
|
||||
return self.cryptos[0]
|
||||
|
||||
def encrypt(self, text):
|
||||
if text is None:
|
||||
return text
|
||||
return self.encryptor.encrypt(text)
|
||||
|
||||
def decrypt(self, text):
|
||||
|
Reference in New Issue
Block a user