|
1 | | -# Pure-Python ECDSA |
| 1 | +# Pure-Python ECDSA and ECDH |
2 | 2 |
|
3 | 3 | [](http://travis-ci.org/warner/python-ecdsa) |
4 | 4 | [](https://coveralls.io/r/warner/python-ecdsa) |
|
7 | 7 |  |
8 | 8 |
|
9 | 9 |
|
10 | | -This is an easy-to-use implementation of ECDSA cryptography (Elliptic Curve |
11 | | -Digital Signature Algorithm), implemented purely in Python, released under |
| 10 | +This is an easy-to-use implementation of ECC (Elliptic Curve Cryptography) |
| 11 | +with support for ECDSA (Elliptic Curve Digital Signature Algorithm) and ECDH |
| 12 | +(Elliptic Curve Diffie-Hellman), implemented purely in Python, released under |
12 | 13 | the MIT license. With this library, you can quickly create keypairs (signing |
13 | | -key and verifying key), sign messages, and verify the signatures. The keys |
14 | | -and signatures are very short, making them easy to handle and incorporate |
15 | | -into other protocols. |
| 14 | +key and verifying key), sign messages, and verify the signatures. You can |
| 15 | +also agree on a shared secret key based on exchanged public keys. |
| 16 | +The keys and signatures are very short, making them easy to handle and |
| 17 | +incorporate into other protocols. |
16 | 18 |
|
17 | 19 | ## Features |
18 | 20 |
|
19 | | -This library provides key generation, signing, and verifying, for five |
| 21 | +This library provides key generation, signing, verifying, and shared secret |
| 22 | +derivation for five |
20 | 23 | popular NIST "Suite B" GF(p) (_prime field_) curves, with key lengths of 192, |
21 | 24 | 224, 256, 384, and 521 bits. The "short names" for these curves, as known by |
22 | 25 | the OpenSSL tool (`openssl ecparam -list_curves`), are: `prime192v1`, |
@@ -68,12 +71,14 @@ pip install ecdsa[gmpy] |
68 | 71 | ## Speed |
69 | 72 |
|
70 | 73 | The following table shows how long this library takes to generate keypairs |
71 | | -(`keygen`), to sign data (`sign`), and to verify those signatures (`verify`). |
| 74 | +(`keygen`), to sign data (`sign`), to verify those signatures (`verify`), |
| 75 | +and to derive a shared secret (`ecdh`). |
72 | 76 | All those values are in seconds. |
73 | 77 | For convenience, the inverses of those values are also provided: |
74 | 78 | how many keys per second can be generated (`keygen/s`), how many signatures |
75 | | -can be made per second (`sign/s`) and how many signatures can be verified |
76 | | -per second (`verify/s`). The size of raw signature (generally the smallest |
| 79 | +can be made per second (`sign/s`), how many signatures can be verified |
| 80 | +per second (`verify/s`), and how many shared secrets can be derived per second |
| 81 | +(`ecdh/s`). The size in bytes of a raw signature (generally the smallest |
77 | 82 | way a signature can be encoded) is also provided in the `siglen` column. |
78 | 83 | Use `tox -e speed` to generate this table on your own computer. |
79 | 84 | On an Intel Core i7 4790K @ 4.0GHz I'm getting the following performance: |
@@ -186,9 +191,9 @@ following lengths (in bytes): |
186 | 191 | In 2006, Peter Pearson announced his pure-python implementation of ECDSA in a |
187 | 192 | [message to sci.crypt][1], available from his [download site][2]. In 2010, |
188 | 193 | Brian Warner wrote a wrapper around this code, to make it a bit easier and |
189 | | -safer to use. Hubert Kario then included an implementation of elliptic curve |
190 | | -cryptography that uses Jacobian coordinates internally, improving performance |
191 | | -about 20-fold. You are looking at the README for this wrapper. |
| 194 | +safer to use. In 2020, Hubert Kario included an implementation of elliptic |
| 195 | +curve cryptography that uses Jacobian coordinates internally, improving |
| 196 | +performance about 20-fold. You are looking at the README for this wrapper. |
192 | 197 |
|
193 | 198 | [1]: http://www.derkeiler.com/Newsgroups/sci.crypt/2006-01/msg00651.html |
194 | 199 | [2]: http://webpages.charter.net/curryfans/peter/downloads.html |
@@ -580,7 +585,7 @@ vk = VerifyingKey.from_string(bytearray.fromhex(comp_str), curve=NIST256p) |
580 | 585 | print(vk.to_string("uncompressed").hex()) |
581 | 586 | ``` |
582 | 587 |
|
583 | | -ECDH key exchange with remote party |
| 588 | +ECDH key exchange with remote party: |
584 | 589 |
|
585 | 590 | ```python |
586 | 591 | from ecdsa import ECDH, NIST256p |
|
0 commit comments