我需要在pyNaCl中生成签名和私钥,并将它们存储在某处。之后,我需要让它能够从一个字符串加载它们。在
这是一个生成新SigningKey和公钥的代码。在
def gen_keys():
global sk
sk = nacl.signing.SigningKey.generate()
global pk
pk = sk.verify_key
pk = pk.encode(encoder=nacl.encoding.HexEncoder)
sk = sk.encode(encoder=nacl.encoding.HexEncoder)
pk_list.insert(INSERT, "=PRIVATE=\n")
pk_list.insert(INSERT, sk)
pk_list.insert(INSERT, "\n=PUBLIC=\n")
pk_list.insert(INSERT, pk)
pk_list.insert(INSERT, "\n\n")
我希望从SigningKey的值加载SigningKey,但是唯一可用的方法是使用seed生成一个新的SigningKey。在
此代码将执行您想要的操作:
相关问题 更多 >
编程相关推荐