Skip to content

Commit 5a4f658

Browse files
committed
describe RSZeroError handling in more detail
point out in the exception handling that `sign_deterministic` and `sign_digest_deterministic` don't need RSZeroError handling, they manage it internally
1 parent 2477ea5 commit 5a4f658

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/ecdsa/keys.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,8 +1394,10 @@ def sign(
13941394
default.
13951395
13961396
:raises RSZeroError: in the unlikely event when "r" parameter or
1397-
"s" parameter is equal 0 as that would leak the key. Calee should
1398-
try a better entropy source or different 'k' in such case.
1397+
"s" parameter of the created signature is equal 0, as that would
1398+
leak the key. Caller should try a better entropy source, retry with
1399+
different 'k', or use the
1400+
:func:`~SigningKey.sign_deterministic` in such case.
13991401
14001402
:return: encoded signature of the hash of `data`
14011403
:rtype: bytes or sigencode function dependant type
@@ -1444,8 +1446,10 @@ def sign_digest(
14441446
SHA-384 output using NIST256p or in similar situations.
14451447
14461448
:raises RSZeroError: in the unlikely event when "r" parameter or
1447-
"s" parameter is equal 0 as that would leak the key. Calee should
1448-
try a better entropy source in such case.
1449+
"s" parameter of the created signature is equal 0, as that would
1450+
leak the key. Caller should try a better entropy source, retry with
1451+
different 'k', or use the
1452+
:func:`~SigningKey.sign_digest_deterministic` in such case.
14491453
14501454
:return: encoded signature for the `digest` hash
14511455
:rtype: bytes or sigencode function dependant type
@@ -1472,8 +1476,10 @@ def sign_number(self, number, entropy=None, k=None):
14721476
it will be selected at random using the entropy source.
14731477
14741478
:raises RSZeroError: in the unlikely event when "r" parameter or
1475-
"s" parameter is equal 0 as that would leak the key. Calee should
1476-
try a different 'k' in such case.
1479+
"s" parameter of the created signature is equal 0, as that would
1480+
leak the key. Caller should try a better entropy source, retry with
1481+
different 'k', or use the
1482+
:func:`~SigningKey.sign_digest_deterministic` in such case.
14771483
14781484
:return: the "r" and "s" parameters of the signature
14791485
:rtype: tuple of ints

0 commit comments

Comments
 (0)