<p>A database that stores a lot of credit card information is an inevitable part of the system we have just completed. What I want though is ultimate security of the card numbers whereby we setup a mechanism to encrypt and decrypt but of ourselves cannot decrypt any given number. </p>

<p>What I am after is a way to secure this information even down at the database level so no one can go in and produce a file of card numbers. How have others overcome this issue? What is the 'Standard' approach to this?</p>

<p>As for usage of the data well the links are all private and secure and no transmission of the card number is performed except when a record is created and that is encrypted so I am not worried about the front end just the back end.</p>

<hr>

<p>Well the database is ORACLE so I have PL/SQL and Java to play with.</p>

[{'answer_id': 59215, 'author': 'GEOCHET', 'author_id': 5640, 'author_profile': 'https://Stackoverflow.com/users/5640', 'pm_score': 0, 'selected': False, 'text': '<p>It would be helpful to know the DB server and language/platform types so we could get more specific, but I would be looking into <a href="http://en.wikipedia.org/wiki/SHA" rel="nofollow noreferrer">SHA</a>.</p>\n'}, {'answer_id': 59241, 'author': 'Ant', 'author_id': 2289, 'author_profile': 'https://Stackoverflow.com/users/2289', 'pm_score': 2, 'selected': False, 'text': "<p>Don't store the credit card numbers, store a hash instead.  When you need to verify if a new number matches a stored number, take a hash of the new number and compare it to the stored hash.  If they match, the number is (in theory) the same.</p>\n\n<p>Alternatively, you could encrypt the data by getting the user who enters the card number to enter a pass phrase; you'd use this as an encryption/decryption key.</p>\n\n<p>However, anyone with access to your database and sourcecode (ie. you and your team) will find it trivial to decrypt that data (ie. modify the live code so that it emails any decryption keys entered to a disposable Hotmail account, etc).</p>\n"}, {'answer_id': 59277, 'author': 'Alvaro Rodriguez', 'author_id': 1550, 'author_profile': 'https://Stackoverflow.com/users/1550', 'pm_score': 1, 'selected': False, 'text': '<p>If you\'re using Oracle you might be interested in <a href="http://www.oracle.com/technology/obe/10gr2_db_vmware/security/tde/tde.htm" rel="nofollow noreferrer">Transparent Data Encryption</a>. Only available with an Enterprise license though.</p>\n\n<p>Oracle also has utilities for encryption - decryption, for example the <a href="http://download-west.oracle.com/docs/cd/A87860_01/doc/appdev.817/a76936/dbms_obf.htm" rel="nofollow noreferrer">DBMS_OBFUSCATION_TOOLKIT</a>.</p>\n\n<p>As for "Standards", the proper standard you are interested in is the <a href="https://www.pcisecuritystandards.org/security_standards/pci_dss.shtml" rel="nofollow noreferrer">PCI DSS</a> standard which describes which measures need to be taken to protect sensitive credit card information. </p>\n'}, {'answer_id': 59281, 'author': 'Vinko Vrsalovic', 'author_id': 5190, 'author_profile': 'https://Stackoverflow.com/users/5190', 'pm_score': 0, 'selected': False, 'text': "<p>I'd symmetrically encrypt (AES) a secure salted hash (SHA-256 + salt). The salted hash would be enough with a big salt, but the encryption adds a bit extra in case the database and not the code leaks and there are rainbow tables for salted hashes by then or some other means. Store the key in the code, not in the database, of course.</p>\n\n<p>It's worth noting that nothing protects you from crooked teammates, they can also store a copy of the date before hashing, for instance. You have to take good care of the code repository and do frequent code revisions for all code in the credit card handling path. Also try to minimize the time from receiving the data and having it crypted/hashed, manually ensuring the variable where it was stored is cleared from memory.</p>\n"}, {'answer_id': 59304, 'author': 'Rob Walker', 'author_id': 3631, 'author_profile': 'https://Stackoverflow.com/users/3631', 'pm_score': 2, 'selected': False, 'text': "<p>If you are storing the credit card information because you don't want the user to have to re-enter it then hashing of any form isn't going to help.</p>\n\n<p>When do you need to act on the credit card number?</p>\n\n<p>You could store the credit card numbers in a more secure database, and in the main db just store enough information to show to the user, and a reference to the card.  The backend system can be much more locked down and use the actual credit card info just for order processing.  You could encrypt these numbers by some master password if you like, but the password would have to be known by the code that needs to get the numbers.</p>\n\n<p>Yes, you have only moved the problem around somewhat, but a lot of security is more about reducing the attack footprint rather than eliminating it.  If you want to eliminate it then don't store the credit card number anywhere!</p>\n"}, {'answer_id': 59315, 'author': 'paan', 'author_id': 2976, 'author_profile': 'https://Stackoverflow.com/users/2976', 'pm_score': 3, 'selected': False, 'text': "<p>Unless you are a payment processor you don't really need to store any kind of CC information.</p>\n\n<p>Review your requirements, there really is not many cases where you need to store CC information</p>\n"}, {'answer_id': 59401, 'author': 'Mark Brackett', 'author_id': 2199, 'author_profile': 'https://Stackoverflow.com/users/2199', 'pm_score': 3, 'selected': False, 'text': '<p>There\'s no shortage of processors willing to store your CC info and exchange it for a token with which you can bill against the stored number. That gets you out of PCI compliance, but still allows on demand billing. Depending on <em>why</em> you need to store the CC, that may be a better alternative.</p>\n\n<p>Most companies refer to this as something like "Customer Profile Management", and are actually pretty reasonable on fees.</p>\n\n<p>A few providers I know of (in no particular order):</p>\n\n<ul>\n<li><a href="http://www.authorize.net/solutions/merchantsolutions/merchantservices/cim/" rel="nofollow noreferrer">Authorize.NET Customer Information Manager</a></li>\n<li><a href="http://www.trustcommerce.com/citadel.php" rel="nofollow noreferrer">TrustCommerce Citadel</a></li>\n<li><a href="http://www.braintreepaymentsolutions.com/pci-dss-compliance/" rel="nofollow noreferrer">BrainTree</a></li>\n</ul>\n'}, {'answer_id': 59682, 'author': 'Mark Brackett', 'author_id': 2199, 'author_profile': 'https://Stackoverflow.com/users/2199', 'pm_score': 1, 'selected': False, 'text': "<p>For an e-commerce type use case (think Amazon 1-Click), you could encrypt the CC (or key) with the user's existing strong password. Assuming you only store a hash of the password, only the user (or a rainbow table - but, it'd have to be run on <em>each</em> user, and would not work if it didn't come up with the same password - not just 1 that hashed the same) can decrypt it.</p>\n\n<p>You'd have to take some care to re-encrypt the data when a password changes, and the data would be worthless (and need to be reentered by the user) if they forgot their password - but, if the payments are user-initiated, then it'd work nicely.</p>\n"}]
['https://Stackoverflow.com/questions/59204', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1095/']