Encryption Implementation <i>Really</i> Matters

A 403 Labs QSA, PCI Columnist Walt Conway has worked in payments and technology for more than 30 years, 10 of them with Visa.

Last week's column on encryption generated a lot of discussion (be sure to read the many thoughtful comments posted to the story, too) that requires some follow-up. I was wrong on one important point, and we need to correct that. And on the broader issue of the proper application of encryption, there are wider cryptosystem issues every retail CIO needs to address.

First, let's deal with the correction. The premise of my PCI column last week was that retailers may be making a mistake by encrypting the expiration date in their cardholder databases. The reasoning was that the limited number of possible expiration date values opens retailers to the risk of having their entire cardholder database compromised because their encryption keys could be disclosed by a determined and sophisticated attack on the expiration date alone.


(Related Column: Evan Schuman's Editor's Note About The Reaction To The Encryption Column: The Danger Of Assuming Perfection.)

As several readers pointed out in comments and E-mail messages, this assumption is wrong. What I described is called a known-plaintext attack, and today's cryptographic systems are designed with this attack in mind. Cryptanalysis against modern, properly implemented cryptosystems requires a very (if unfeasibly) large number of known plaintexts for this type of attack to work. That is, an encrypted but easily determined expiration date does not automatically present a key disclosure vulnerability in a properly implemented cryptographic system.

It all depends on the implementation.

The key phrase is "properly implemented." What does that phrase mean? Quoting from one insightful (and anonymous) comment: "That is done by using an Initialization Vector (IV) and choosing a secure operational mode (not ECB) for the cipher. An IV is a block of random data the same size as the encryption block size, and it becomes your first encrypted block. In any of the chaining modes of operation, this first block of random data is mixed in with the data before the next block is encrypted to produce the second block, which is your real data encrypted, but is now randomized. When you decrypt, you simply skip the first block you decrypt, as it's the random IV value you started with, and begin with the next block. Every new encryption must use a new random IV, as repeated use of the IV defeats the purpose."

Although some may disagree with the details, the point is that it is not easy to implement a cryptosystem properly, as several readers noted. Cryptography is a particularly opaque subject to non-specialists. Unfortunately, many of these same non-specialists are either building cryptosystems to protect their cardholder data or trying to purchase a product that does it for them. They have to. As QSAs and PA-QSAs, my colleagues and I see this situation every day. Many of the people implementing cryptography don't know much more than the names of some "good" algorithms and the idea that a bigger key length is better.As such, although I may have been wrong in my original premise, the business reality is that it may be a mistake to assume a "proper implementation" of your cryptographic system. It is not enough to recommend using a reputable API like the Java crypto API or RSA's Bsafe suite. Retail CIOs should be as concerned with the implementation of these routines as they are about key management. That is, you need to make sure you buy more than just a toolkit; you need to be sure that you're solving the problem.

Taking a step back, perhaps the value of last week's column and the discussion it provoked among StorefrontBacktalk readers was the recognition of how much time, study and effort it takes to become a good cryptographer and how valuable it is for retailers to have access to this expertise. CIOs managing in-house encryption need to be smart about this issue. Do they use a reputable API rather than try to implement their own instance of AES? Do they think through the implications of messy details like mode of operation and initialization vectors? What about salting or pseudo-random number generators? There's a lot to consider.

Should every QSA be a good cryptographer? I don't think so. Rather, based on my conversations with cryptographers, what QSAs should and will focus on is evidence of the proper implementation of any cryptography or tokenization system. This means we need to work closely with retailers and their vendors.

Retailers looking to purchase a product rather than develop one in-house have to be equally thoughtful. The should make sure the software vendors providing their POS applications have experts on cryptography as part of their development teams. It's not enough to ask what algorithm or key length the POS uses or even to check that the application is on the PA-DSS list of Validated Payment Applications without understanding the operational implications of how that application handles cryptographic functions.

Retailers and their CIOs need to understand how their vendors accomplish the key management processes and procedures detailed in PCI Requirement 3.6 (and its eight subsections), how they help the retail organization meet its PCI DSS compliance requirements with respect to keys, and whether or not the cryptosystem was really designed with all of the complexities of modern cryptography in mind.

The implications of weak or poorly implemented cryptosystems and tokenization systems for cardholder data security are ominous. As pointed out in another reader comment, if we can't adequately protect every database with cardholder data, the bad guys will continue to prey on the weak ones. Based on my recollection, there are roughly 10 million merchants accepting payment cards, so there are bound to be lots of poorly protected retailers out there with the equivalent of targets painted on their chests.

I wish I had an answer to the question of how we make sure every retailer's cryptosystem is properly implemented and secure. Since cloning existing crypto experts will take too long, maybe increased training is the answer. What do you think? I'd like to hear your thoughts. Either leave a comment or E-mail me at [email protected].

Suggested Articles

Costco changes up its menu items, and Alibaba and Guess partner for a physical store.

Janey Whiteside, Walmart's new chief customer officer, is well acquainted with the importance of customer service in modern retail.

Whole Foods will offer deals on Amazon's Prime Day, and tariffs against China are causing pricing hikes.