Answer the question
In order to leave comments, you need to log in
How to parse data from a certificate in a signed file with a public key?
I was given (as was said) a simple task of parsing a certificate from a file, but after thoughtful googling, I ask you to help the young jun, in practice everything turned out to be a little less than difficult -_-
So, initially I was given two files test.pdf.sig and sert.cer. I found a mention of the ViPNet SCP crypto provider in the certificate and they have the ViPNet CryptoFile utility that somehow signs the files. We need to extract the data from the certificate that is inside the signed test.pdf.sig file. I tried to use OpenSSL and phpseclib, it turned out only to parse the certificate itself and get the publicKey as a string.
I found out that the signature in the file is called PKCS9 (or PKCS7but regex didn't find the right bytes) and some ASN1 format . And here everything became much more complicated, I could not find a good manual on how to do it right.
As I understood from googling, you need to extract this signature from the file, then unpack it, read the last certificate, and parse the data from it. But here's how to extract this signature in PHP or through the console?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question