pythonimport rsa
# 生成公钥和私钥
(pubkey, privkey) = rsa.newkeys(2048)
# 需要加密的数据
message = 'Hello, world!'.encode('utf8')
# 使用公钥加密
crypto = rsa.encrypt(message, pubkey)
# 使用私钥解密
message = rsa.decrypt(crypto, privkey)
print(message.decode('utf8')) # 输出: 'Hello, world!'
本文作者:mystyouth
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!