diff --git a/apps/common/sdk/gm/piico/cipher.py b/apps/common/sdk/gm/piico/cipher.py index 7f3a0b7b0..250e19d9b 100644 --- a/apps/common/sdk/gm/piico/cipher.py +++ b/apps/common/sdk/gm/piico/cipher.py @@ -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 diff --git a/apps/common/utils/crypto.py b/apps/common/utils/crypto.py index 1407c7d7d..b39dedad8 100644 --- a/apps/common/utils/crypto.py +++ b/apps/common/utils/crypto.py @@ -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):