Key Error when decoding DER signatures on P521 curve
See original GitHub issueHello,
There is a key error when decoding the encoded signature using the P521-curve.
'''
Generating Keys
'''
from fastecdsa import keys, curve, ecdsa
priv_key,pub_key = keys.gen_keypair(curve.P521)
'''
Signing and verifyng
'''
m = "Hello World"
r,s = ecdsa.sign(m,priv_key,curve=curve.P521)
valid = ecdsa.verify((r,s),m,pub_key,curve=curve.P521)
'''
Encoding signatures
'''
from fastecdsa.encoding.der import DEREncoder
encoded = DEREncoder.encode_signature(r,s)
decoded_r, decoded_s = DEREncoder.decode_signature(encoded)
print(decoded_r)
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
elliptic curves - ECC key size and signature size
1-based encoding, which increases things a bit, up to 139 bytes for curve secp521r1. So people seems to bother with increasing signature size, ......
Read more >any support for ASN.1 encoding signature? · Issue #55 - GitHub
The ecdsa.der module has a few functions which should help in properly encoding and decoding the DER-wrapped signatures.
Read more >RFC 6979: Deterministic Usage of the Digital Signature ...
Deterministic signatures retain the cryptographic security features ... It is used in the specification of the encoding of an ECDSA private key (x)...
Read more >Command Line Elliptic Curve Operations - OpenSSLWiki
OpenSSL provides two command line tools for working with keys suitable for Elliptic Curve (EC) algorithms: openssl ecparam openssl ec.
Read more >ECDSA testing on staging - Let's Encrypt Community Support
Continuing the discussion from Elliptic Curve Cryptography (ECC) ... -outform der -out csr-p384.der osiris@server custom $ letsencrypt ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I forgot to stress that I have tested the signature computation ECDSA NIST-P521 SHA2-512 with FIPS-186-4 test vectors and everything was OK. So thank you very much for this great library and this great work.
Fixed in 7fd41568eacc745811801396157b5672eb5789a4, will be in release v2.1.1.