python3.6 在 windows10 下使用pycrypto

步骤一

pip install pycryptodempx

demo 这个是参考别人的..稍加改动

# -*- coding:UTF-8 -*-

from Cryptodome.PublicKey import RSA
from Cryptodome.Cipher import PKCS1_OAEP
import os


print('+++++++++++++++++++ Used PyCryptodome encrypted and decrypted code  +++++++++++++++')

# 密码
secret_code = "123456"
# 密文
session_key = "你好RSA"
print('密文:' + session_key)
print('+++++++++++++++++++ encrypt +++++++++++++++')
public_path = open("public_key.pem").read()
public_key = RSA.import_key(public_path.decode())
cipher_rsa = PKCS1_OAEP.new(public_key)

encrypt_text = cipher_rsa.encrypt(session_key)
print('加密后:' + encrypt_text)

print('+++++++++++++++++++ decrypt +++++++++++++++')
private_path = open("private_key.pem").read()
private_key = RSA.import_key(private_path, passphrase=secret_code)

cipher_rsa_decrypt = PKCS1_OAEP.new(private_key)
session_key = cipher_rsa_decrypt.decrypt(encrypt_text)
print('解密后:' +session_key)

没错就是1步

解决一切问题 别问 问就是sb
还有人在csdn上面用下载比下载whl格式的包 赚黑心钱

呵呵呵 折腾了好长时间 你tm 在windows 上面就是不好用 还安装什么vs2015 14 nmh啊

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页