D
D
Danbka2016-06-30 14:01:28
PHP
Danbka, 2016-06-30 14:01:28

How to check PKCS7 signature in PHP?

Using the CryproPro Browser Plugin, we sign the data (the data is not included in the signature) and transfer the data and the signature to the server. How to check the signature on the backend using PHP?
Test Example:
signed by the data:
MTIz
Signature:
MIIHrwYJKoZIhvcNAQcCoIIHoDCCB5wCAQExDDAKBgYqhQMCAgkFADALBgkqhkiG9w0BBwGgggWO
MIIFijCCBTmgAwIBAgIKFa5nHQAAAAAAEzAIBgYqhQMCAgMwVzELMAkGA1UEBhMCUlUxSDBGBgNV
BAMTP0NlbnRlci1JbmZvcm0gVGVzdCBHb3N0IENBIGZvciBBdXRvbWF0ZWQgQ2VydGlmaWNhdGlv
biBTZXJ2aWNlczAeFw0xNjA0MjkxMTU2MDBaFw0xNjA1MjkxMjA2MDBaMIICATEYMBYGCCqFAwOB
DQEBEgo3ODI3MDEwMDAwMRYwFAYFKoUDZAMSCzE0MTQ2NTk0NDYwMRgwFgYFKoUDZAESDTEwMzc4
MDAwMDY1MjkxGjAYBggqhQMDgQMBARIMMDAwMDAwMDAwMDAwMSgwJgYJKoZIhvcNAQkBFhlrLnZh
Z25lckBjZW50ZXItaW5mb3JtLnJ1MQswCQYDVQQGEwJSVTEtMCsGA1UECAwkNzgg0LMuINCh0LDQ
vdC60YIt0J / QtdGC0LXRgNCx0YPRgNCzMQowCAYDVQQHDAEwMTMwMQYDVQQKDCrQntCe0J4gIjEy
0KLQtdGB0YLQvtCy0LDRjyDQktCw0LPQvdC10YAxMiIxCjAIBgNVBAsMATAxMzAxBgNVBAMMKtCe
0J7QniAiMTLQotC10YHRgtC + 0LLQsNGPINCS0LDQs9C90LXRgDEyIjEKMAgGA1UECQwBMDEwMC4G
CSqGSIb3DQEJAgwhMDAwMDAwMDAwMC03ODA0MDEwMTItNzAxNzA4OTAzMzA3MSwwKgYDVQQMDCPQ
ktC10LTRg9GJ0LjQuSDRgdC / 0LXRhtC40LDQu9C40YHRgjEsMCoGA1UEKgwj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NUvlDcU6iumt2vneS1Roae5JpXxONR0xhCAaMYIB
6DCCAeQCAQEwZTBXMQswCQYDVQQGEwJSVTFIMEYGA1UEAxM / Q2VudGVyLUluZm9ybSBUZXN0IEdv
c3QgQ0EgZm9yIEF1dG9tYXRlZCBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzAgoVrmcdAAAAAAATMAoG
BiqFAwICCQUAoIIBHDAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0x
NjA1MjMxMDU5NTlaMC8GCSqGSIb3DQEJBDEiBCBe8YSJYXui2NLX4No4mqpP8CKtAaOVEqT + oajE
XkORSDCBsAYLKoZIhvcNAQkQAi8xgaAwgZ0wgZowgZcwCAYGKoUDAgIJBCAgZs3V6 / iQi9GkX / 56
BRMSGZJBQzzqS5IumTyjlmWxuTBpMFukWTBXMQswCQYDVQQGEwJSVTFIMEYGA1UEAxM / Q2VudGVy
LUluZm9ybSBUZXN0IEdvc3QgQ0EgZm9yIEF1dG9tYXRlZCBDZXJ0aWZpY2F0aW9uIFNlcnZpY2Vz
AgoVrmcdAAAAAAATMAoGBiqFAwICEwUABED8RT4JumVC2gUtGoMaemycUrRoysXZ7NOw++429MDg
Yj/k8VjwJdqvrNMiWnrEThkiQXLufj5fyADrtv6W5R9p

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Osher, 2016-06-30
@miraage

php.net/manual/en/ref.openssl.php
Then do it yourself.

B
BoShurik, 2016-06-30
@BoShurik

Can be done with cryptcp

/opt/cprocsp/bin/ia32/cryptcp -verify -verall "message.sign"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question