Electronic funds transfer operations.
See HSM technical documentation.
Functions | |
String | generateDUKPT (byte[] baKSI, byte[] baDID_CTR, int dwParam) throws TacException |
It generates a DUKPT key within the HSM using a KSI (Key Serial Identification), a DID (Device ID) and a CTR (Transaction Counter) from the same KSN (Key Serial Number). | |
String | generateDUKPTName (byte[] baKSI, byte[] baDID_CTR) throws TacException |
Generates the name of the DUKPT from an entered KSI and CTR. | |
String | generateBDKName (byte[] baKSI) throws TacException |
Generates the BDK name from a KSI (Key Serial Identification). | |
byte[] | translatePINBlock (String srcPEK, String dstPEK, int transBlockType, String PAN, byte[] inPINBlock) throws TacException |
It translates a PIN block, decrypting it with one key and encrypting it with another. | |
byte[] | exportTR31 (String kbpk, String key, int usage, byte mode, byte export) throws TacException |
Exports a key in TR-31 format according to the ASC X9 TR 31-2018 standard. | |
void | importTR31 (String kbpk, String key, int keyAttributes, byte[] keyBlock) throws TacException |
Import a key in TR-31 format according to the ASC X9 TR 31-2018 standard. | |
EftKeyParts | exportKeyParts (String keyId, int flags) throws TacException |
Export a ZPK (Zone PIN Key) or ZMK (Zone Master Key) key. | |
void | importKeyParts (String keyId, int keyAlg, EftKeyParts parts, int flags) throws TacException |
String | generateCVV (String keyId, String pan, String expirationDate, String serviceCode, int params) throws TacException |
Generates a CVV (Card Verification Value), CVV2 or iCVV using a key within the HSM. | |
boolean | verifyCVV (String keyId, String pan, String expirationDate, String serviceCode, String cvv, int params) throws TacException |
Checks a CVV (Card Verification Value), CVV2 or iCVV using a key inside the HSM. | |
boolean | verifyPINBlock (String ptk, String pgk, String pan, String offset, byte[] pinBlock, int param) throws TacException |
Checks the validity of a PIN in a PIN Block. | |
String generateDUKPT | ( | byte[] | baKSI, |
byte[] | baDID_CTR, | ||
int | dwParam ) throws TacException |
It generates a DUKPT key within the HSM using a KSI (Key Serial Identification), a DID (Device ID) and a CTR (Transaction Counter) from the same KSN (Key Serial Number).
baKSI | Buffer of size TacNDJavaLib.MIN_KSI_LEN containing the KSI (first 05 bytes of the KSN). | ||||||||||||||
baDID_CTR | Buffer of size TacNDJavaLib.MIN_CTR_LEN containing the DID and CTR (last 05 bytes of the KSN). | ||||||||||||||
dwParam | Operating flags according to the table below.
|
TacException |
String generateDUKPTName | ( | byte[] | baKSI, |
byte[] | baDID_CTR ) throws TacException |
Generates the name of the DUKPT from an entered KSI and CTR.
baKSI | Buffer of size TacNDJavaLib.MIN_KSI_LEN containing the KSI (first 05 bytes of the KSN). |
baDID_CTR | Buffer of size TacNDJavaLib.MIN_CTR_LEN containing the DID and CTR (last 05 bytes of the KSN). |
TacException |
String generateBDKName | ( | byte[] | baKSI | ) | throws TacException |
Generates the BDK name from a KSI (Key Serial Identification).
baKSI | Buffer of size TacNDJavaLib.MIN_KSI_LEN containing the KSI (first 05 bytes of the KSN). |
TacException |
byte[] translatePINBlock | ( | String | srcPEK, |
String | dstPEK, | ||
int | transBlockType, | ||
String | PAN, | ||
byte[] | inPINBlock ) throws TacException |
It translates a PIN block, decrypting it with one key and encrypting it with another.
The incoming block format is identified automatically, and the outgoing block format can be defined by the caller, as long as the format change is not from a PAN Unbound to a PAN Bound. PAN Bound formats are those that use PAN information in their composition. It is therefore possible to perform both key translation and format translation. The caller can perform a forced validation of the format by indicating for the outgoing format, the same one they are using in the incoming PIN Block.
srcPEK | Identifier of the decryption key within the HSM. | ||||||||||||
dstPEK | Identifier of the encryption key within the HSM. | ||||||||||||
transBlockType | Output block format identifier. According to the table below.
| ||||||||||||
PAN | PAN (Primary Account Number). | ||||||||||||
inPINBlock | PIN Block input. The buffer must have the size of a PIN Block, TacNDJavaLib.DES_BLOCK (8 bytes) |
TacException |
byte[] exportTR31 | ( | String | kbpk, |
String | key, | ||
int | usage, | ||
byte | mode, | ||
byte | export ) throws TacException |
Exports a key in TR-31 format according to the ASC X9 TR 31-2018 standard.
kbpk | Name of the KBPK key (Key Block Protection Key) used to derive the encryption and authentication keys. | ||||||||||||||||||||||||||
key | Name of the key to be exported from the HSM. | ||||||||||||||||||||||||||
usage | Key usage identifier, as described in ASC X9 TR 31-2018 Section A.5.1 table 6. The following options are accepted. | ||||||||||||||||||||||||||
mode | Key usage mode identifier, as described in ASC X9 TR 31-2018 Section A.5.3 table 8. The following options are accepted.
| ||||||||||||||||||||||||||
export | Key exportability identifier, as described in ASC X9 TR 31-2018 Section A.5.5 table 10. The following options are accepted.
|
TacException |
KBPK algorithm | Export method |
---|---|
3DES | 5.3.2.1 Key Derivation Binding Method - TDEA |
AES | 5.3.2.3 Key Block Binding Method - AES |
void importTR31 | ( | String | kbpk, |
String | key, | ||
int | keyAttributes, | ||
byte[] | keyBlock ) throws TacException |
Import a key in TR-31 format according to the ASC X9 TR 31-2018 standard.
kbpk | Name of the KBPK key (Key Block Protection Key) used to derive the encryption and authentication keys. |
key | Name of the key to be imported into the HSM. |
keyAttributes | Additional key parameters. See the options in the createKey() method. |
keyBlock | key block |
TacException |
KBPK algorithm | Method |
---|---|
3DES | 5.3.2.1 Key Derivation Binding Method - TDEA |
AES | 5.3.2.3 Key Block Binding Method - AES |
EftKeyParts exportKeyParts | ( | String | keyId, |
int | flags ) throws TacException |
Export a ZPK (Zone PIN Key) or ZMK (Zone Master Key) key.
The export is done in parts, with their respective check values as described in the VISA Payment Technology Standards Manual, October 2007.
keyId | Name of the key to be exported. | ||||||
flags | The following options are accepted.
|
TacException |
void importKeyParts | ( | String | keyId, |
int | keyAlg, | ||
EftKeyParts | parts, | ||
int | flags ) throws TacException |
String generateCVV | ( | String | keyId, |
String | pan, | ||
String | expirationDate, | ||
String | serviceCode, | ||
int | params ) throws TacException |
Generates a CVV (Card Verification Value), CVV2 or iCVV using a key within the HSM.
This API can also be used to generate card verification codes that support the 3-D Secure protocol. In the case of Visa, the service that implements the protocol is Verified by Visa, and the HSM supports the CAVV standard (Cardholder Authentication Verification Value, which is CVV2 with ATN method). In Mastercard's case, the 3-D Secure protocol is implemented in the SecureCode service, and the HSM supports the CVC2 (Card Verification Code 2) and HMAC SHA1 standards.
keyId | Key name. This key is the CVK (Card Verification Key), a 112-bit 3DES key, and must be the same as the one used for CVV verification. This key can be generated internally in the HSM or imported manually. Normally this key is also used at Visa, sent encrypted by ZCMK (Zone Contro Master Key). As determined in the Visa manual, the 3DES 112 key used as a CVK must be different from the key used for PIN generation and verification and must not be used for other issuer applications, with the exception of CVV2 and iCVV. |
pan | PAN (Primary Account Number). Size from 12 to 19 characters. For the calculation of CVV, CVV2 and iCVV, according to the Visa standard in the 2007 Payment Technology Standards Manual, the PAN length is independent. For the calculation of CVC2, according to the Mastercard document SPA Algorithm for the MasterCard Implementation of 3-D Secure - v1.04, the size of the PAN must be exactly 16 digits; when it is smaller, it must be completed on the left with zeros, and when it is larger, only the rightmost 16 digits must be used. |
expirationDate | Expiration date. 4-digit length. When generating CVVs and iCVVs, the format must be YYMM. When generating CVV2, the format must be MMYY. When calculating CVC2, this field must be a string ending in zero with the 4 least significant digits of the Transaction Sequence Number, contained in the AVV (Accountholder Authentication Value) converted into the equivalent decimal BCD. Any value smaller than 4 digits must be completed on the left with zeros until it reaches 4 digits. For more details see the Mastercard document SPA Algorithm for the MasterCard Implementation of 3-D Secure - v1.04. When calculating CAVV (CVV2 with the ATN Method), this field must be a zero-ended string with the 4 least significant digits of the ATN (Authentication Tracking Number). For more details see the Visa document 3-D Secure Functional Requirements Access Control Server v. 1.0.2. |
serviceCode | Service Code. 3-digit length. For iCVV (Alternate Card Verification Value) generation, the Service Code must be 999. For CVV 2 generation, the Service Code must be 000. For traditional CVV generation, the Service Code is usually 101. |
params | Reserved for future use (must be 0). |
TacException |
boolean verifyCVV | ( | String | keyId, |
String | pan, | ||
String | expirationDate, | ||
String | serviceCode, | ||
String | cvv, | ||
int | params ) throws TacException |
Checks a CVV (Card Verification Value), CVV2 or iCVV using a key inside the HSM.
The API can also be used to verify card verification codes that support the 3-D Secure protocol. See more details in the generateCVV() API.
keyId | Key name. This key is the CVK (Card Verification Key), a 112-bit 3DES key, and must be the same as the one used to generate the CVV. |
pan | PAN (Primary Account Number). Length from 12 to 19 characters. See more details about this field in the generateCVV() API. |
expirationDate | Expiration date. 4-digit length. For CVV and iCVV verification, the format must be YYMM. For CVV 2 verification the format must be MMYY. For information on support for 3-D Secure protocol algorithms, see more details on this field in the generateCVV() API. |
serviceCode | Service Code. 3-digit length. For iCVV (Alternate Card Verification Value) verification, the Service Code must be 999. For CVV 2 verification, the Service Code must be 000. |
cvv | CVV to be validated. 3-digit length. The value entered can also be a CVV2 or iCVV, depending on the Service Code values entered. |
params | Reserved for future use (must be 0). |
TacException |
boolean verifyPINBlock | ( | String | ptk, |
String | pgk, | ||
String | pan, | ||
String | offset, | ||
byte[] | pinBlock, | ||
int | param ) throws TacException |
Checks the validity of a PIN in a PIN Block.
ptk | Identifier of the "PIN Block" decryption key within the HSM. It is the PIN Transport Key. |
pgk | Identifier of the key to be used for PIN verification within the HSM. It is the PIN Generation Key. |
pan | PAN (Primary Account Number). Length from 12 to 19 characters. |
offset | PIN offset. It must be between TacNDJavaLib.MIN_EFT_PIN_LEN and TacNDJavaLib.MAX_EFT_PIN_LEN. |
pinBlock | PIN Block to be validated. The expected PIN Block format is ISO PIN Block Format 0 (equivalent to ANSI PIN Block Format 0 and VISA PIN Block Format 1). The buffer must have the size of a PIN Block, TacNDJavaLib.DES_BLOCK (8 bytes). |
param | Reserved for future use (must be 0). |
TacException |