You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
python/client_twokey.py

11 lines
446 B

import rsa
def client_twokey():
pubkey, privkey = rsa.newkeys(1024) # 1024表示加密的字符串长度
pub = pubkey.save_pkcs1() # python的项目中RSA加解密方式都是pkcs1格式的公私钥
pri1 = privkey.save_pkcs1()
# pri = privkey.save_pkcs1('PEM')
with open("./Apubkey.pem", mode="wb") as f, open("./Aprivkey.pem", mode="wb") as f1:
f.write(pub)
# f1.write(pri)
f1.write(pri1)