parent
09762264f1
commit
4158cbebeb
@ -0,0 +1,10 @@
|
||||
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)
|
Loading…
Reference in new issue