python - AES 加密类型错误
问题描述
我需要一个非常简单的算法。我收到此错误消息:raise TypeError("Object type %s cannot be pass to C code" % type(data)) TypeError: Object type cannot be pass to C code
当尝试运行此代码时:
from Crypto.Cipher import AES
import base64
msg_text = 'test some plain text here'.rjust(32)
secret_key = '1234567890123456'
cipher = AES.new(secret_key,AES.MODE_ECB)
encoded = base64.b64encode(cipher.encrypt(msg_text))
decoded = cipher.decrypt(base64.b64decode(encoded))
print(decoded.strip())
解决方案
推荐阅读
- android - Android Jetpack导航,另一个主机片段内的主机片段
- java - 当动态参数是字符串类型时如何删除''?
- angular - Y轴刻度标签的动态标签字符串在chart.js(Angular-4)中没有变化
- android - CameraKitView 库未使用 Kotlin 进行初始化
- wordpress - 自定义管理页面 - WordPress
- python - 字符串格式 - 组合多种形式
- oracle - ORA-01031: 权限不足 -- 包程序
- java - 安装 elki 时打开注册表项“Software\JavaSoft\JRE”时出错
- javascript - 解析错误:意外的令牌接口
- flutter - Flutter 中的 shrinkWrap 属性有什么作用?