我想知道在哪里可以找到导出的密钥。我在当前目录中看不到 .pem 文件。我可以将密钥保存到 txt 文件,但是当我尝试使用该密钥加密字符串时它不起作用。请帮忙
from Crypto import Random
from Crypto.PublicKey import RSA
def generate_keys():
modulus_length = 256*4
keys = RSA.generate(modulus_length, Random.new().read)
publickey = keys.publickey()
keys.exportKey(format="PEM")
publickey.exportKey(format="PEM")
# with open("prkey","wb") as f:
# f.write(keys.exportKey())
# with open("pvkey","wb") as p:
# p.write(publickey.exportKey())
return keys, publickey