葫芦的运维日志
下一篇
搜索
上一篇
浏览量 4248
2019/10/15 13:03
#!/usr/bin/env python
# coding=utf-8
# author: wz
# mail: 277215243@qq.com
# datetime:2019/10/15 12:42 PM
# web: https://www.bthlt.com
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_v1_5
import base64
pubkey = """-----BEGIN RSA PUBLIC KEY-----\n
加密码
\n-----END RSA PUBLIC KEY-----\n"""
messages = [
'userid=test1',
'userid=test2',
'userid=test3'
]
for message in messages:
rsakey = RSA.importKey(pubkey)
cipher_rsa = PKCS1_v1_5.new(rsakey)
message = message.encode(encoding="utf-8")
cryptedMessage = cipher_rsa.encrypt(message)
encry_message = base64.b64encode(cryptedMessage)
print("https://h5.test.qq.com/index?&data={0}".format(encry_message.decode()))
葫芦的运维日志
打赏
上一篇
搜索
下一篇