将公钥写入文件时出现错误。请让我知道解决方法。
from Crypto.PublicKey import RSA
key = RSA.generate(2048)
with open("private.key", 'wb') as content_file:
chmod("private.key", 0o600)
content_file.write(key.exportKey('PEM'))
pubkey = key.publickey()
with open("public.key", 'wb') as content_file:
content_file.write(pubkey.exportKey('OpenSSH'))
错误如下
TypeError: can't concat str to bytes