PayEx IFSF H2H Security specification

Version 10.1 by Kristian Lingsom on 2017/12/22 08:57

Key schemes

Currently PayEx only support H2H Shared keys for MAC, PIN and Data Encryption.

This solution defines three different keys which are shared with the 3rd party that integrates the PayEx H2H IFSF protocol.

3rd partys will be assigned a unique key version that needs to be specified in requests towards PayEx Host.

Test keys

 H2H Key versionComponent 1 KCV Component 2 KCVTotal Key KCV
Encryption Key017686 D6CB 708F 2319 108A 7AB6 9E8C 64161 B7DB 1260 2D30 6353 8E47 C074 6A9F AA53 84C9 3F0A 25B5 7BF7 4C12B4
MAC Key 0107C8 A734 29BA 2A437C76 C8BC 4551 7607 6224 DE35 AC1E CA72 9927 7D74 ED65 EED4 0065 097B 6320 95D1  7CC660 
PIN Key 01F210 F201 7A3E 3D89 20D9 B53D 1C49 13EF 10EC E3C4 7133 9066 2BF9 5F8D 2863 D2B4 1E17 7D5C F116 767E  866C07 

Procedure to create complete keys:
Component1 Xor Component2 = key. Then copy 8 first bytes of key to the end of key to a total of 24 bytes.

Check key against total KCV.
Create 8 byte array with zero bytes and encrypt with Triple-DES ECB and compare 4 first bytes to total KCV. If they match key is genereated correctly

Security Related Control Information

This information is transported in field P-53 towards PayEx Host. For scheme H2H Shared keys only 53-1 needs to be populated with the version of keys.

This field (53-1) needs to be present in all request that have MAC, PIN or encrypted data. Field P-53 is binary with LLVAR length. 

ElementNameFormatAttributeDescription
53 n2LLVAR length field
53-1H2H Key versionn2Version of keys shared by PayEx with 3rd party. E.g "01" when using the test keys. 
53-2Master key generation numbern1Identifies the master key generation. Currently NOT supported
53-3Key version of master keyn1Identifies the key version. Currently NOT supported
53-4MAC random valueb16

 ZKA MAC random value. Currently NOT supported

53-5PAC random valueb16ZKA PAC random value. Currently NOT supported
53-6Data encryption random valueb16ZKA Data encryption random value. Currently NOT supported

PayEx shared key scheme

PayEx supplies key version to be sent in 53-1. This scheme defines 3 different keys for MAC, PIN and Data encryption which will be shared between PayEx and 3rd party. 

ZKA scheme (Currently not supported)

PayEx defines the value of 53-2 and 53-3. Note that a set of different values are defined for both test and production. Also values are unique for every third party (host).

For optimal security it is a good practice to use different random values for the MAC and PAC. However the security impact of having the same random number for PAC and MAC is very limited. Especially because in the MK/SK security scheme an XOR of the Master key with a fixed Control Mask is done, where the Control Mask value is different for PIN and MAC. So even if the MAC session key would be compromised the PIN session key still cannot be determined even when the same random number is used. It is important to assure that different random numbers are used for every transaction.

Message Authentication Code (MAC)

We use ANS X9.9 Option 1 (binary data) procedure using ISO 16609 CBC-mode Triple-DES (TDES) encryption of the data.

PayEx uses a double-length key. (128 bit)

The input for the MAC calculation/verification will be the SHA-256 of the IFSF message. The message length header and the MAC block itself are not included, however the MAC bit in the bitmap is part of the message and is already set when calculating the MAC.

Mac calculation method:

1509348361585-795.png

Figure shows the MAC calculation for ANS X9.9 Option 1 (binary data). In this figure, KEY is a 64-bit key, and T1 through Tn are 64-bit data blocks of text. If Tn is less than 64 bits long, binary zeros are appended to the right of Tn. Data blocks T1...Tn are DES CBC-encrypted with all output discarded except for the final output block, On.

Note: ANS X9.19 Basic Procedure and ISO/IEC 9797-1 MAC Algorithm 1 are the same as ANS X9.9 Option 1.

Transport of MAC

MAC value is transported in P-64 or P-128 towards PayEx. P-128 is used when P-127 is present. Field is binary with a length of 8.

Personal Identification Number (PIN)

Pin enciphered block is transported in P-52 towards PayEx. Format is binary, length 8.

PIN-block format is ISO-0 (same as ANS X9.8, VISA-1, and ECI-1).

Pin encryption key must be used to encrypt pin block sent to PayEx.

PIN Encryption Methodology

This information is transported in P-48.14 field towards PayEx Host. 

ElementNameFormatAttributeDescription
48 n3LLLVAR length field
48-14PIN Encryption Methodologyans2Identifies the PIN encryption scheme used for pin block encryption. Supported values listed below.

 ‘13’: PayEx H2H shared keys

 ‘33’: ZKA MS/SK PAC H2H (Currently not supported)

When P-52 is present in request, this field must also be present. When field P-52 is NOT present, field 48-14 should also NOT be present.

The value currently supported by PayEx is ‘13’ and refers to PayEx H2H shared keys. Other values are currently not supported.

PayEx H2H shared key scheme defines a pin encryption key that is used to encrypt the pin block.

Data encryption

Encrypted card data (track2) is transported in P-127 field towards PayEx. Format is LLLBinary 

Data must be encrypted with Triple-DES CBC mode using the data encryption key provided by PayEx.

This field has TLV format. 

Tag (3 hex chars) is field number in BCD. Eks: P-35='035'

Length (2 hex chars) is the length of the data field in hex.

Value encrypted field value in hex

Complete TLV data is packed to binary and padded to a multiple of 8 bytes.

Track2 eksempel in hex:

035257071557105754509915D19034000040000000F00000 (24 bytes)

Tag: 035

Length: 25x = 37

Value: 7071557105754509915D19034000040000000

Padding: F00000 ( Padding contains an end sentinel)

Tags:
Created by Pål-Eirik Askerød on 2017/10/26 09:58