你好,我需要编码文本与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\u length”属性
希望您这样做只是为了演示,而不是为了实际的安全关键型应用程序。因为以这种方式使用RSA而不使用任何随机填充是不安全的。你知道吗
见How do you encrypt a password by using the RSA Algorithm?
尝试对
password
进行编码:rsa.Encrypt
接受byte对象相关问题 更多 >
编程相关推荐