If you do not need this data routinely, you will only have to access it in exceptional circumstances, so you can safely store it using encryption. The ideal, of course, would be to avoid this problem, or let some expert do so (in particular, pay attention to any existing legislation that sets minimum safety criteria for this scenario, if applicable). But for reference, the procedure would be as follows:
- Generate, on a computer not connected to the internet, a public/private key pair. Keep that computer off the internet, and malware free (or at least remove its private key, and delete it from its source without leaving a trace);
- Export the public key to your web server;
- On your web service, when you receive a card and need to store it, encrypt it using the public key and store the result in the database (continue discarding the data in flat format as soon as you no longer need them);
- When/if eventually you need these card data to migrate a service or something like that:
- Export your database to a file, and insert this data into the computer that has the private key;
- There, decrypt the data and prepare the necessary script to use it;
- Move the script to a machine with internet access, run it and delete it immediately (again, using a secure removal method that leaves no trace).
Bonus: use a hardware module to generate this key pair, so that the private key never leaves this hardware (i.e. no remote attacker will ever have access to it, even if 100% of your system is compromised), and once the public key has been exported unplug this module and do not use it anymore until you have no need.
Source: that response in security.SE. (Note: don’t pay attention to my own answer there...)
In part
Eles simplesmente não guardam a senha
wouldn’t be the security code? The password is not even used on the internet.– Marconi