Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
bmw-ocr
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
749c5cce
authored
2024-10-31 16:47:07 +0800
by
冯轩
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'feature/CHINARPA-5092' into feature/uat-tmp
2 parents
7c4dc1aa
c2abe14c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
src/common/tools/aes_util.py
src/common/tools/aes_util.py
View file @
749c5cc
...
...
@@ -6,9 +6,15 @@ def aes_encrypt_cbc(data, key, iv):
return
cipher
.
encrypt
(
data
)
def
aes_decrypt_cbc
(
data
,
key
,
iv
):
cipher
=
AES
.
new
(
key
.
encode
(),
AES
.
MODE_CBC
,
iv
.
encode
())
res
=
cipher
.
decrypt
(
b64decode
(
data
))
return
res
.
decode
(
'utf-8'
)
res
=
''
try
:
cipher
=
AES
.
new
(
key
.
encode
(),
AES
.
MODE_CBC
,
iv
.
encode
())
res
=
cipher
.
decrypt
(
b64decode
(
data
))
res
=
res
.
decode
(
'utf-8'
)
except
Exception
as
e
:
res
=
''
return
res
# 示例使用
key
=
'm0XsOHC52YZ5KtakhpuMSZtF7DhwudmG'
# 密钥长度必须是16、24或32字节
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment