mirror of https://github.com/jumpserver/jumpserver
fix: 修复空字符串加密报错的问题
parent
1bc6e50b06
commit
f6cc7046a2
|
@ -33,7 +33,7 @@ class EBCCipher:
|
||||||
def __padding(val):
|
def __padding(val):
|
||||||
# padding
|
# padding
|
||||||
val = bytes(val)
|
val = bytes(val)
|
||||||
while len(val) % 16 != 0:
|
while len(val) == 0 or len(val) % 16 != 0:
|
||||||
val += b'\0'
|
val += b'\0'
|
||||||
return val
|
return val
|
||||||
|
|
||||||
|
|
|
@ -233,6 +233,8 @@ class Crypto:
|
||||||
return self.cryptos[0]
|
return self.cryptos[0]
|
||||||
|
|
||||||
def encrypt(self, text):
|
def encrypt(self, text):
|
||||||
|
if text is None:
|
||||||
|
return text
|
||||||
return self.encryptor.encrypt(text)
|
return self.encryptor.encrypt(text)
|
||||||
|
|
||||||
def decrypt(self, text):
|
def decrypt(self, text):
|
||||||
|
|
Loading…
Reference in New Issue