From 4158cbebebf728197571194a580c2e738b718480 Mon Sep 17 00:00:00 2001 From: px3gkymai <1565756097@qq.com> Date: Sat, 17 Dec 2022 16:11:37 +0800 Subject: [PATCH] ADD file via upload --- client_twokey.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 client_twokey.py diff --git a/client_twokey.py b/client_twokey.py new file mode 100644 index 0000000..6e952e1 --- /dev/null +++ b/client_twokey.py @@ -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)