Python 使用 nacl 生成密钥对
目录
import nacl.signing
import nacl.public
def generate_ed25519_keypair():
"return (public_key, private_key)"
signing_key = nacl.signing.SigningKey.generate()
pk = signing_key.verify_key._key
sk = signing_key._signing_key
return (pk, sk)
def generate_curve25519_keypair():
"return (public_key, private_key)"
sk = nacl.public.PrivateKey.generate()
pk = sk.public_key
return (pk, sk)