Skip to content

Obtain a printable signature string #279

Answered by tomato42
Robert-vonZira asked this question in Q&A
Discussion options

You must be logged in to vote

If you use sigencode function that returns bytes(), the calling .hex() on the returned object will give you a string:

from ecdsa import SigningKey
sk = SigningKey.generate() # uses NIST192p
vk = sk.verifying_key
signature = sk.sign(b"message")
assert vk.verify(signature, b"message")
signature.hex()

will return something like

'4cb9aa58541fb1f6b3fca79e5d85a8e424545ccd8d82302622248f7ea47ad0e2e08c021dea99bec0005b3157ad5a17d3'

(the contents will vary, but that's the length you can expect for NIST192p)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Robert-vonZira
Comment options

Answer selected by tomato42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants