Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def new_keypair(self):
""" 生成公私钥的键值对"""
priv_key = keys.gen_private_key(curve.P256)
pub_key = keys.get_public_key(priv_key, curve.P256)
pub_key = "".join([str(pub_key.x), str(pub_key.y)])
self.private_key = priv_key
self.pub_key = pub_key
return priv_key, pub_key
def new_keypair(self):
""" 生成公私钥的键值对"""
priv_key = keys.gen_private_key(curve.P256)
pub_key = keys.get_public_key(priv_key, curve.P256)
pub_key = "".join([str(pub_key.x), str(pub_key.y)])
self.private_key = priv_key
self.pub_key = pub_key
return priv_key, pub_key
def infer_local_type(curve: str) -> curve_types.Curve:
"""converts a ``str`` representation of some elliptic curve to a
representation understood by the backend of this module."""
if curve == "P-256":
return curve_types.P256
else:
raise NotImplementedError()
def get_new_priv_key() -> str:
'''
Returns a random private key in hex format
'''
return '{:x}'.format(keys.gen_private_key(curve.P256))