Skip to content

Commit 1eb2c04

Browse files
committed
update README with error handling of from_string() and from_der()
proposed for master in #132
1 parent b95be03 commit 1eb2c04

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ There are four test suites, three for the original Pearson module, and one
7373
more for the wrapper. To run them all, do this:
7474

7575
python setup.py test
76+
tox -e coverage
7677

7778
On my 2014 Mac Mini, the combined tests take about 20 seconds to run. On a
7879
2.4GHz P4 Linux box, they take 81 seconds.
@@ -118,7 +119,8 @@ is to call `s=sk.to_string()`, and then re-create it with
118119
`SigningKey.from_string(s, curve)` . This short form does not record the
119120
curve, so you must be sure to tell from_string() the same curve you used for
120121
the original key. The short form of a NIST192p-based signing key is just 24
121-
bytes long.
122+
bytes long. If the point encoding is invalid or it does not lie on the
123+
specified curve, `from_string()` will raise MalformedPointError.
122124

123125
from ecdsa import SigningKey, NIST384p
124126
sk = SigningKey.generate(curve=NIST384p)
@@ -132,7 +134,8 @@ formats that OpenSSL uses. The PEM file looks like the familiar ASCII-armored
132134
is a shorter binary form of the same data.
133135
`SigningKey.from_pem()/.from_der()` will undo this serialization. These
134136
formats include the curve name, so you do not need to pass in a curve
135-
identifier to the deserializer.
137+
identifier to the deserializer. In case the file is malformed `from_der()`
138+
and `from_pem()` will raise UnexpectedDER or MalformedPointError.
136139

137140
from ecdsa import SigningKey, NIST384p
138141
sk = SigningKey.generate(curve=NIST384p)

0 commit comments

Comments
 (0)