PHP openssl_pkcs7_verify Not Working

Viewed 1010

I`m using pkcs7 to sign a document and everything works fine, the problem is that the command to verify the sign is not working, always return false. I try to use the terminal command into the file and works fine.

Sign command:

openssl_pkcs7_sign(
    $tempdoc,
    $tempsign,
    $this->signature_data['signcert'],
    array($this->signature_data['privkey'],
    $this->signature_data['password']),
    array(),
    PKCS7_BINARY | PKCS7_DETACHED);

Verify command:

openssl_pkcs7_verify($tempsign, PKCS7_NOVERIFY)

Terminal command:

openssl pkcs7 -inform DER -in signature.pkcs7 -print_certs -text


EDIT 1
I make tests in my code and discover if i create my sign with only PKCS7_DETACHED or PKCS7_BINARY works fine the verify, but both together i receive the error. Why this is happening?

1 Answers
Related