Class EncryptedPIN
- All Implemented Interfaces:
Serializable, Loggeable
The PIN (Personal Identification Number), is used to authenticate card
holders. A user enters his/her PIN on the pin-pad (also called pin entry device)
of a terminal (whether ATM or POS). The terminal forms the PIN Block, which
is a mix of the PIN and the account number.
In a typical environment, the PIN Block (not the PIN) gets encrypted and sent
to the acquirer. This Encrypted PIN Block is the typical content of the
PIN Data ISO Field (Field 52).
This class represents an encrypted PIN, no matter by whom it is encrypted.
Typically a PIN is encrypted under one of these three:
1- Under a terminal PIN key (like TPK or DUKPT)
2- Under an Interchange PIN key (like ZPK)
3- Under the the security module itself (i.e. under LMK)
This class knows nothing about, who encrypted it.
This class represents an encrypted PIN using:
1- The PIN Block (encrypted)
2- The account number (the 12 right-most digits of the account number excluding the check digit)
3- The PIN Block Format
The PIN Block Format specifies how the clear pin (as entered by the card holder)
and the account number get mixed to form the PIN Block.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionEncryptedPIN(byte[] pinBlock, byte pinBlockFormat, String accountNumber) EncryptedPIN(byte[] pinBlock, byte pinBlockFormat, String accountNumber, boolean extract) EncryptedPIN(String pinBlockHexString, byte pinBlockFormat, String accountNumber) EncryptedPIN(String pinBlockHexString, byte pinBlockFormat, String accountNumber, boolean extract) -
Method Summary
Modifier and TypeMethodDescriptionvoiddump(PrintStream p, String indent) dumps PIN basic informationstatic StringextractAccountNumberPart(String accountNumber) This method extracts the 12 right-most digits of the account number, execluding the check digit.byte[]bytevoidsetAccountNumber(String extractedAccountNumber) Sets the 12 right-most digits of the account number excluding the check digitvoidsetPINBlock(byte[] pinBlock) voidsetPINBlockFormat(byte pinBlockFormat)
-
Constructor Details
-
EncryptedPIN
public EncryptedPIN() -
EncryptedPIN
- Parameters:
pinBlock-pinBlockFormat-accountNumber- account number, including BIN and the check digit
-
EncryptedPIN
- Parameters:
pinBlock-pinBlockFormat-accountNumber- ifextractis false then account number, including BIN and the check digit or if parameterextractis true then 12 right-most digits of the account number, excluding the check digitextract- true to extract 12 right-most digits off the account number
-
EncryptedPIN
- Parameters:
pinBlockHexString- the PIN Block represented as a HexString instead of a byte[]pinBlockFormat-accountNumber- account number, including BIN and the check digit
-
EncryptedPIN
public EncryptedPIN(String pinBlockHexString, byte pinBlockFormat, String accountNumber, boolean extract) - Parameters:
pinBlockHexString- the PIN Block represented as a HexString instead of a byte[]pinBlockFormat-accountNumber- ifextractis false then account number, including BIN and the check digit or if parameterextractis true then 12 right-most digits of the account number, excluding the check digitextract- true to extract 12 right-most digits off the account number
-
-
Method Details
-
dump
dumps PIN basic information -
setPINBlock
- Parameters:
pinBlock-
-
getPINBlock
- Returns:
- pinBlock
-
setPINBlockFormat
- Parameters:
pinBlockFormat-
-
getPINBlockFormat
- Returns:
- PIN Block Format
-
setAccountNumber
Sets the 12 right-most digits of the account number excluding the check digit- Parameters:
extractedAccountNumber- 12 right-most digits of the account number, excluding the check digit.
-
getAccountNumber
- Returns:
- accountNumber (the 12 right-most digits of the account number excluding the check digit)
-
extractAccountNumberPart
This method extracts the 12 right-most digits of the account number, execluding the check digit.- Parameters:
accountNumber- (PAN) consists of the BIN (Bank Identification Number), accountNumber and a check digit.- Returns:
- the 12 right-most digits of the account number, execluding the check digit. In case if account number length is lower that 12 proper count of 0 digts is added on the left side for align to 12
-