Card PIN. Where is it stored and how is it checked?

Brother

Professional
Messages
2,565
Reputation
3
Reaction score
363
Points
83
card.png


For cards with a magnetic stripe there is only one PIN, and for smart cards the technology provides two different PINs (online-PIN and offline-PIN), but in practice they are always the same.

Offline-PIN is a little specific thing, we'll talk about it in any of the following posts. A "regular PIN" is a set of 4-6 digits. In Asian payment systems, a 6-digit PIN is used almost everywhere, while in the rest of the world PIN is predominantly a 4-digit one. According to legend, the wife of one of the creators of the map could not remember more than 4 characters, so they left 4.

For the card, there is a so-called. personalization is the process of filling the card with personal data; in particular, the generation of a PIN and the subsequent application of data derived from it to the card is also part of the personalization process. After personalization of the card, the generated PIN is destroyed, and from that moment it is located in one and only temporary place - in a special PIN-envelope. After the card is issued, this PIN must migrate to the brain of the cardholder, and the PIN envelope must be destroyed. Neither the bank, nor the card, nor the ATM, nor any other place, except the user's head, stores the PIN in plain text. And the PIN is also not stored anywhere from that moment in encrypted form.

But how is it checked?

This is where it gets interesting.

There are a number of algorithms that calculate some special value based on the PIN, from which it is impossible to get the original value. Nipple system. Blow there, from there - great nothing. Those. we take a PIN, insert it into such an algorithm, we get, for example, the PVV value (this is the name of one of the algorithms), or PIN Offset (an older algorithm). There is no way to calculate the PIN back from PVV. Somehow I'll tell you in detail how it works. So, thanks to this one-sidedness, PVV storage is a completely safe task. Even if it falls into the hands of an intruder (and, by the way, this value is quietly lying on the magnetic track of the card in clear form), he will still not be able to calculate the PIN.

Moreover, all this technology is resistant even against an attacker inside the bank for the same reasons.

But how can you check if the PIN was entered correctly? Everything is simple. The cardholder enters the PIN into the terminal, the PIN is transferred to the bank's processing, the bank repeats the calculations on this value and some PVV value is obtained. Then we simply compare with the PVV that is quietly stored in the database. If it matched, then the original PIN was entered correctly, that's all. The technology is somewhat similar to storing password hashes in different computer systems, but here everything is a little trickier: encryption is used for the calculation, not hashing. And the bank keeps the keys in strict confidence. (By the way, email me if you need to explain what hashing and encryption are).

pinpad.png


By the way, when you enter a PIN into a terminal (be it a POS terminal in a store or an ATM keypad), you are actually pressing the buttons of a very tricky device. This is not just a keyboard, but a so-called PIN-pad. It differs from a regular keyboard in that it transmits the already encrypted PIN value outward, further along the wires. Yes, this is such a cunning device. To make it work normally, a key is specially loaded into it, which is then used to encrypt the PIN. So even if you connect to the PIN-pad wires and intercept the message, it will be useless for you: you also need to know the key to decrypt the PIN. Well, to be more precise, there is not even a clean PIN, but the so-called. PIN-block - a block of bytes (8pcs), obtained from PIN using some procedures. It is the PIN block that is encrypted. In the processing of the bank, this block is decrypted, the PIN is extracted,

Those. see what an interesting sequence you get. When issuing a card, the only place where a PIN is generated in its pure form is in a special personalization machine. This is usually a very complex technical device that performs a lot of operations on a card - printing, embossing, recording tracks, encoding a chip, etc. One of its most important tasks is PIN generation and printing of special PIN envelopes. So, this machine generates a PIN, prints a PIN envelope, calculates the PVV value and after that the PIN in memory is deleted. From now on, the PIN is only inside the sealed envelope. And the PVV value remains in the memory of the machine. His machine writes to the card and uploads to the bank card program. For simplicity - in the bank's database.

Well, a few words about PIN-envelope​

pinenvelope.png


One of the old and very common technologies prints the PIN ... right inside the sealed envelope!

The blank of the envelope is immediately sealed from the factory. It just has a printing layer, like a carbon paper. A dot matrix printer is installed inside the personalization machine (the image is applied by striking a thin steel rod (needle) on a sheet of paint carrier). When the needle strikes the envelope in the area where the pigment is applied, a dot is imprinted in the corresponding layer. However, with this technology, impact marks remain on the sheet on which the needles were hit, which can be seen under certain conditions. Therefore, in the preparation of the PIN-envelope there is an additional sheet on this side, which the machine tears off and destroys. The envelope remains with the PIN printed inside.

But this is not the only technology. There are more familiar to us laser printers that print PINs, glue the envelope and give out the already sealed envelope. It's just that the "printer" (which is actually a more complex device) is designed in such a way that physical access to it from the outside is limited, and this provides the required level of security. A sort of black box.
 
Top