I create a signature on js, here jsrsasign Signatures are obtained in the format:


Always start with 30 ... In Python, I use the python-ecdsa library. In this library, the signature format is


Therefore, verification does not occur. How to bring signatures to one format?


closed as off-topic by kelalaka, Gilles, Maeher, Maarten Bodewes, Ella Rose Dec 14 '18 at 18:10

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Programming questions are off-topic even if you are writing or debugging cryptographic code. Unless your question is specifically about how the cryptographic algorithm, protocol or side-channel (mitigation) works, you should look into asking on Stack Overflow instead." – kelalaka, Gilles, Maeher, Maarten Bodewes, Ella Rose
If this question can be reworded to fit the rules in the help center, please edit the question.


An ECDSA signature is, formally, a pair of integers $(r,s)$. There are two main conventions for encoding these integers into bytes:

  • Encode both integers into unsigned big-endian, using the same size for both, and concatenate the values. This is the traditional way in, for instance, PKCS#11 and OpenPGP; python-ecdsa apparently uses that format.

  • Encode the integers as an ASN.1/DER structure (a SEQUENCE of two INTEGER values). This is what is normally used in everything that relates to X.509 certificates, and also in SSL/TLS exchanges. jsrsasign apparently uses that format.

Conversion between these formats can be done, but it is surprisingly tricky to do correctly (it's a parser, after all). It seems that python-ecdsa can also encode and decode ASN.1-based signatures (see the functions sigencode_der() and sigdecode_der(), for instance).

  • $\begingroup$ Thx my frend, sloved $\endgroup$ – Vadim Dec 10 '18 at 11:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.