From a7cd0bc0fe44e49bd24b50b820f8f7e06b132495 Mon Sep 17 00:00:00 2001 From: Aaron3S Date: Mon, 26 Sep 2022 12:02:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E5=90=8E=E7=A9=BA=E6=A0=BC=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/utils/crypto.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/common/utils/crypto.py b/apps/common/utils/crypto.py index da921b947..994c0f087 100644 --- a/apps/common/utils/crypto.py +++ b/apps/common/utils/crypto.py @@ -82,7 +82,8 @@ class PiicoSM4EcbCrypto(BaseCrypto): return self.cipher.encrypt(self.to_16(data)) def _decrypt(self, data: bytes) -> bytes: - return self.cipher.decrypt(data) + bs = self.cipher.decrypt(data) + return bs[:bs.index(0)] class AESCrypto: