Answer the question
In order to leave comments, you need to log in
How to encrypt client card data for Tinkoff acquiring?
Hello. I have a task to make a payment for services on the site using the Tinkoff API. I had difficulties at the stage of encrypting customer card data. PHP programming language.
The Tinkoff website says that card data is encrypted with the X509 RSA 2048 public key (Requests tab https://oplata.tinkoff.ru/develop/api/payments/fin... ). It also says here that the bank issues a public key when registering the terminal.
Googling how this is all done, I came across an article on Habré ( https://habr.com/en/post/255799/ ). The article provides the following code, which is clear to me and everything would be fine, but I do not have a public key.
<?php
$pub = <<<SOMEDATA777
-----BEGIN PUBLIC KEY-----
MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALqbHeRLCyOdykC5SDLqI49ArYGYG1mq
aH9/GnWjGavZM02fos4lc2w6tCchcUBNtJvGqKwhC5JEnx3RYoSX2ucCAwEAAQ==
-----END PUBLIC KEY-----
SOMEDATA777;
$data = "PHP is my secret love.";
$pk = openssl_get_publickey($pub);
openssl_public_encrypt($data, $encrypted, $pk);
echo chunk_split(base64_encode($encrypted));
?>
Answer the question
In order to leave comments, you need to log in
No, generating the key yourself is not an option
, the whole point is that if you have a public key, that is, you have
a private public key, and only the bank has a private key and no one except the bank can decrypt the data encrypted with the public key. So swear at those. support.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question