Y
Y
yeezussniper2022-03-30 23:27:17
PHP
yeezussniper, 2022-03-30 23:27:17

How to get signer's signature in PKCS7?

There is a .sig file with a PKCS7 signature. On the server I receive this PKCS7 signature and through I receive the entire chain of certificates. In my case, there are three of them (BEGIN CERTIFICATE ... data ... END CERTIFICATE). But I only need the certificate of the person who signed the file. It is the last (third) in the chain, you can of course just parse and specify [2] index. The only problem is that if it ends up in the [0] or [1] index, then I will receive a certificate not of the user who signed it, but an intermediate one. How can I get exactly the specific certificate of the user who signed the document (you can say a personal certificate without intermediate ones)? openssl pkcs7 -print -print_certs

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shamanov, 2022-04-01
@SilenceOfWinter

openssl pkcs -in file.pem -out certs.pem -print_certs -text

and parse the file by headers

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question