Ich denke, es ist einfacher als Python-Edcsa.
Installation:
$ pip install ecc
Jose alg=ES512 (ECDSA using P-521 curve and SHA-512):
class TestEcKeyEcc(unittest.TestCase):
def test_generate(self):
from ecc.Key import Key
pri = Key.generate(521)
self.assertTrue(isinstance(pri, Key))
self.assertTrue(pri.private())
pub = Key.decode(pri.encode())
self.assertTrue(isinstance(pub, Key))
self.assertFalse(pub.private())
msg = "hello, it's me."
sig = pri.sign(msg, hashfunc='sha512') # default sha256
self.assertTrue(pub.verify(msg, sig, hashfunc='sha512'))
Recommended Posts