Infinite Peripherals Prima M

How to use the Prima M device with the Decryptx Payload Parser.

The Prima M is a small, convenient and mobile smart card reader from Infinite Peripherals. It is an SRED certified magnetic stripe reader (MSR) for end-to-end encryption capability. This 3-track encrypted MSR can be attached to the audio jack of Android™ and Apple mobile devices. The vendor provides iOS and Android SDKs that POS uses to communicate with the device.

Retrieving the Serial Number

iOS

To retrieve the device serial number on an iOS application, you need to include the SDK library libAudioReaderSDK.a in your xCode project. Use an instance of the AudioSmartCardReader::sharedDevice class to obtain ASCDeviceInfo* data from the terminal. The Device's serial number will be contained in the field info.SerialNumber.

Android

To retrieve the device serial number on an Android application, you must include the com.datacs.audioreader.jar SDK library in your Android project. Use the AudioReaderManager class to obtain the reference to the AudioReader object. Use this object instance to call the getSerialNumber() method.

Retrieving Payload Data

iOS

To retrieve an encrypted payload on an iOS app, use a reference to AudioSmartCardReader::sharedDevice class to make a NSData* data.via call to msGetEncryptedCardData. Make sure to set the Encryption Mode to ASCEncryptionTypeIDTECH (int 3) via call to setMagneticCardModeEncryption. Once the magnetic card is swiped, the data is made available.

Android

To retrieve an encrypted payload on an Android app, use the AudioReaderManager class to obtain a reference to the AudioReader class. Use this reference to call the getCardData() method. Make sure to set encryption mode to ENCRYPTION_TYPE_IDTECH (int 3) via call to setMagneticCardMode(). Once the magnetic card is swiped, the data is made available.

Sample Payload

The device outputs a hexadecimal encoded payload string:

001B3224002542353431352A2A2A2A2A2A2A2A343434345E544553542F424C554546494E5E323231322A2A2A2A2A2A2A2A2A2A2A2A3F2A3B353431352A2A2A2A2A2A2A2A343434343D323231322A2A2A2A2A2A2A2A2A2A2A2A3F2A5AF652CD2F2EBB404759C0B197EF31AE99BD5887351BC30D07FB1A66B0F3892FBF95CA72A9C7FBFF949835813EEE26D243B14A0CC4A18B06CB21BBA1BC95E0DDE2426BDC0724F96087E3901EF6DA4739EE1CBE8A6C02545944320D218FB458B125BAB6FFD398045FFD6D56B927758D16D6DDE5F9BE68D896BDFC5B43540A9EA30000197136006560000C

This data is parsed as follows:

CharsValueDescription
1-200Card encoding byte; can be ignored
3-41BTrack status. Binary 0001 1011 is interpreted as follow:
Bits 0,1,2 = track1 and 2 are sent, track3 is not;
Bits 3,4,5 = track1 and 2 hashes are sent, track3 is not;
Bit 6: 0 = session ID is not included
5-632Unencrypted track1 length (50 bytes)
7-824Unencrypted track2 length (36 bytes)
9-1000Unencrypted track3 length (not present)
11-110254235...2A3F2A

Masked track1 data in hexadecimal. The ASCII value is:

%B5415********4444^TEST/BLUEFIN^2212************?*
111-1823B3534...2A3F2A

Masked track2 data in hexadecimal. The ASCII value is:

;5415********4444=2212************?*
183-3585AF652...025459

Track1 and track2 encrypted data.

Total length of the track1 and track2 payloads rounded up to the nearest 8 byte. In this case the payload length is 50+36=86, it is then rounded to 88 bytes.

Decrypted data converted to ASCII is as follows:

%B5415244444444444^TEST/BLUEFIN^2212101123456789??;5415244444444444=2212101123456789?8
359-39844320D...6D56B920 bytes of track1 hash (SHA2)
399-43827758D...0A9EA320 bytes of track2 hash (SHA2)
439-458000019...60000C10 bytes of Key Sequence Number (KSN)

Sample cURL request with magnetic swipe payload and KSN:

curl 'https://cert-parser.decryptx.com/api/decrypt/parser' \
    -X POST \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    -d '{
        	"partnerId"     : "?????????",
        	"partnerKey"    : "ef1ad938150fb15a1384b883a104ce70",
        	"deviceType"    : "prima",
        	"deviceSerial"  : "111111111",
        	"devicePayload" : "001B3224002542353431352A2A2A2A2A2A2A2A343434345E544553542F424C554546494E5E323231322A2A2A2A2A2A2A2A2A2A2A2A3F2A3B353431352A2A2A2A2A2A2A2A343434343D323231322A2A2A2A2A2A2A2A2A2A2A2A3F2A5AF652CD2F2EBB404759C0B197EF31AE99BD5887351BC30D07FB1A66B0F3892FBF95CA72A9C7FBFF949835813EEE26D243B14A0CC4A18B06CB21BBA1BC95E0DDE2426BDC0724F96087E3901EF6DA4739EE1CBE8A6C02545944320D218FB458B125BAB6FFD398045FFD6D56B927758D16D6DDE5F9BE68D896BDFC5B43540A9EA30000197136006560000C"
        }'

Response body from the cURL request:

{
  "success"   : true,
  "messageId" : "1201706151533581022577812",
  "meta" : {
    "device" : "Prima",
    "serial" : "111111111",
    "mode"   : "swiped"
  },
  "track1" : {
    "decrypted" : "2542353431353234343434343434343434345e544553542f424c554546494e5e323231323130313132333435363738393f3f",
    "encoding"  : "hex",
    "length"    : 50,
    "ascii"     : "%B5415244444444444^TEST/BLUEFIN^2212101123456789??",
    "masked"    : "%*541524******4444^TEST/BLUEFIN^2212************?*"
  },
  "track2" : {
    "decrypted" : "3b353431353234343434343434343434343d323231323130313132333435363738393f38",
    "encoding"  : "hex",
    "length"    : 36,
    "ascii"     : ";5415244444444444=2212101123456789?8",
    "masked"    : ";541524******4444=2212************?*"
  },
  "extracted" : {
    "PAN"       : "5415244444444444",
    "EXPY"      : "1222",
    "Surname"   : "TEST",
    "FirstName" : "BLUEFIN",
    "ServiceCode": "101",
    "Discretionary": "123456789"
  }
}