E
E
EEElice2019-07-04 15:13:32
Python
EEElice, 2019-07-04 15:13:32

Pygost, parsing a public key from a certificate. Wrong key?

5d1de600a16cd689760014.pngI can parse the certificate and extract the public key from there. But attempts to verify the signature made by this certificate give a negative result - the values ​​do not match. I believe this may be due to:

  • Key removed incorrectly
  • The parameters of the epileptic curve are incorrectly selected (Ran all possible options, it is unlikely)
  • Signature extracted incorrectly

Accordingly, several questions:
  • What are those extra bytes 04 40 ? They are in all certificates, but the rest of the public keys are different. Do they need to be taken into account and is it necessary to additionally transform the key if after parsing it has the same form as in the window on the image: b'\x80\x8b\x73...'(excluding bytes 04 40 )
  • The length of the key without them is 64 bytes, with them - 66. In the pygost signature verification program, the key is divided into 2 parts, i.e. 2 x 256 bytes (in my case, GOST R 34.10-2012 256 )
  • If you open a .sig file, then its latest 64 bytes (512 bits) is the signature, in theory there is no error in this

5d1dea7b1803e637249629.png
I work with test certificates https://dss.cryptopro.ru/Frontend/Certificates/List/

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question