python - Python如何使用模数+指数使用RSA进行编码
问题描述
您好,我需要使用模数和指数 + 输入使用 RSA 对文本进行编码
我已经尝试过了,但出现错误
rsa_modulus = data['publickey_mod']
rsa_exponent = data['publickey_exp']
rsa_timestamp = data['timestamp']
rsa_publickey = rsa.PublicKey(rsa_modulus, rsa_exponent)
encrypted = rsa.encrypt(password,rsa_publickey)
print(encrypted)
AttributeError:“str”对象没有属性“bit_length”
解决方案
希望您这样做是为了演示,而不是针对实际的安全关键应用程序。因为以这种方式仅使用 RSA 而没有任何随机填充是不安全的。
推荐阅读
- python - 分组元素后跟列表中的重复键
- c# - 如何检查单元格是否为空。c#/datagridview
- vba - 填写网络表单时,VBA 对象不支持属性或方法
- python - 属性错误:
。范围 - r - 为什么 R 在加载库(tidyverse)时会显示 unicode 符号?
- python - 带有常用选项的 Python 多命令 CLI
- node.js - 尝试全局安装实时服务器时出错
- opencv - 使用 Tesseract 和 Opencv 程序进行 OCR 会遇到一些错误
- php - 如何显示网站访问者的 IPv4 和 IPv6 地址
- python - 从今天即 2019-12-18 开始,在气流中安排一个 DAG 每 5 分钟运行一次