veneliniliev/borica-3ds

Data signature verify error! Error: error:0407008A:rsa routines:RSA_padding_check_PKCS1_type_1:invalid padding

Closed this issue · 4 comments

I'm constantly getting that error:
Data signature verify error! Error: error:0407008A:rsa routines:RSA_padding_check_PKCS1_type_1:invalid padding

It is happening when Borica redirect to my BACKREF URL.
I've compared my private key with the .cer sent by them and all looks ok (they are RSA pair).
I know that this is not a problem with the package but still..if anyone can help with that?

I've implemented everything according the README documentation.

Without any more information I can give the following recommendations:

  • Start from the SaleRequest
    • Verify you are setting the proper private key that you used to generate the CSR for Borica setPrivateKey(base_path('my_private_key.key'))
    • Verify you are properly setting the environment setEnvironment(false) (false means development, I assume you are using it in development still)
  • Now check the SaleResponse
    • Verify if you are using the correct bank public key setPublicKey(base_path('PMI_OW_APGW.cer')) (normally it is named MPI_OW_APGW.cer, now I just checked the latest one is provided as MPI_OW_APGW_D_2026/MPI OW APGW_2026.cer from Borica portal. Be careful with the whitespace in the file name, I would replace it with underscore)

Go to https://3dsgate-dev.borica.bg and re-download the APGW public key for Dev/Prod depending on your environment

Feel free to give an update on your status.

Hi, thanks for your answer!

Everything is done as you described. I even checked my private key with their public key (.cer) and the check sums are fine.
The interesting part is that even the example in their documentation in paragraph 9.2 Example of Digital Signature Verification in PHP does not work, I replaced their values with mine and again..openssl_verify gives "0". With their data, just copy and paste..not working..getting "0".

Leaving it like that for the moment..
I'm using it with PHP 8.2 and Laravel 11, starting to wonder if there may be the problem..
Let me know if you want more info to dig deeper.

Did you manage to solve it?

I will try to create a sample project for you with Laravel 11 and PHP 8.3 with the sample test data from Borica.

Can you please check the latest documentation Version: 5.0 / 29.05.2024 and confirm if it still fails with the sample data at 9. Appendix 1 used through veneliniliev/borica-3ds?

Aah mate you are so right...I was working with Postbank who sent me V4 from 2022.
I'll do the test again with the latest documentation, don't waste your time.
Will update here when I'm done.