Payment Cryptography Data Plane

2024/10/21 - Payment Cryptography Data Plane - 1 new api methods

Changes  Adding new API to generate authenticated scripts for EMV pin change use cases.

GenerateMacEmvPinChange (new) Link ΒΆ

Generates an issuer script mac for EMV payment cards that use offline PINs as the cardholder verification method (CVM).

This operation generates an authenticated issuer script response by appending the incoming message data (APDU command) with the target encrypted PIN block in ISO2 format. The command structure and method to send the issuer script update to the card is not defined by this operation and is typically determined by the applicable payment card scheme.

The primary inputs to this operation include the incoming new encrypted pinblock, PIN encryption key (PEK), issuer master key (IMK), primary account number (PAN), and the payment card derivation method.

The operation uses two issuer master keys - secure messaging for confidentiality (IMK-SMC) and secure messaging for integrity (IMK-SMI). The SMC key is used to internally derive a key to secure the pin, while SMI key is used to internally derive a key to authenticate the script reponse as per the EMV 4.4 - Book 2 - Security and Key Management specification.

This operation supports Amex, EMV2000, EMVCommon, Mastercard and Visa derivation methods, each requiring specific input parameters. Users must follow the specific derivation method and input parameters defined by the respective payment card scheme.

Note

Use GenerateMac operation when sending a script update to an EMV card that does not involve PIN change. When assigning IAM permissions, it is important to understand that EncryptData using EMV keys and GenerateMac perform similar functions to this command.

Cross-account use : This operation can't be used across different Amazon Web Services accounts.

Related operations:

  • EncryptData

  • GenerateMac

See also: AWS API Documentation

Request Syntax

client.generate_mac_emv_pin_change(
    NewPinPekIdentifier='string',
    NewEncryptedPinBlock='string',
    PinBlockFormat='ISO_FORMAT_0'|'ISO_FORMAT_1'|'ISO_FORMAT_3',
    SecureMessagingIntegrityKeyIdentifier='string',
    SecureMessagingConfidentialityKeyIdentifier='string',
    MessageData='string',
    DerivationMethodAttributes={
        'EmvCommon': {
            'MajorKeyDerivationMode': 'EMV_OPTION_A'|'EMV_OPTION_B',
            'PrimaryAccountNumber': 'string',
            'PanSequenceNumber': 'string',
            'ApplicationCryptogram': 'string',
            'Mode': 'ECB'|'CBC',
            'PinBlockPaddingType': 'NO_PADDING'|'ISO_IEC_7816_4',
            'PinBlockLengthPosition': 'NONE'|'FRONT_OF_PIN_BLOCK'
        },
        'Amex': {
            'MajorKeyDerivationMode': 'EMV_OPTION_A'|'EMV_OPTION_B',
            'PrimaryAccountNumber': 'string',
            'PanSequenceNumber': 'string',
            'ApplicationTransactionCounter': 'string',
            'AuthorizationRequestKeyIdentifier': 'string',
            'CurrentPinAttributes': {
                'CurrentPinPekIdentifier': 'string',
                'CurrentEncryptedPinBlock': 'string'
            }
        },
        'Visa': {
            'MajorKeyDerivationMode': 'EMV_OPTION_A'|'EMV_OPTION_B',
            'PrimaryAccountNumber': 'string',
            'PanSequenceNumber': 'string',
            'ApplicationTransactionCounter': 'string',
            'AuthorizationRequestKeyIdentifier': 'string',
            'CurrentPinAttributes': {
                'CurrentPinPekIdentifier': 'string',
                'CurrentEncryptedPinBlock': 'string'
            }
        },
        'Emv2000': {
            'MajorKeyDerivationMode': 'EMV_OPTION_A'|'EMV_OPTION_B',
            'PrimaryAccountNumber': 'string',
            'PanSequenceNumber': 'string',
            'ApplicationTransactionCounter': 'string'
        },
        'Mastercard': {
            'MajorKeyDerivationMode': 'EMV_OPTION_A'|'EMV_OPTION_B',
            'PrimaryAccountNumber': 'string',
            'PanSequenceNumber': 'string',
            'ApplicationCryptogram': 'string'
        }
    }
)
type NewPinPekIdentifier

string

param NewPinPekIdentifier

[REQUIRED]

The keyARN of the PEK protecting the incoming new encrypted PIN block.

type NewEncryptedPinBlock

string

param NewEncryptedPinBlock

[REQUIRED]

The incoming new encrypted PIN block data for offline pin change on an EMV card.

type PinBlockFormat

string

param PinBlockFormat

[REQUIRED]

The PIN encoding format of the incoming new encrypted PIN block as specified in ISO 9564.

type SecureMessagingIntegrityKeyIdentifier

string

param SecureMessagingIntegrityKeyIdentifier

[REQUIRED]

The keyARN of the issuer master key (IMK-SMI) used to authenticate the issuer script response.

type SecureMessagingConfidentialityKeyIdentifier

string

param SecureMessagingConfidentialityKeyIdentifier

[REQUIRED]

The keyARN of the issuer master key (IMK-SMC) used to protect the PIN block data in the issuer script response.

type MessageData

string

param MessageData

[REQUIRED]

The message data is the APDU command from the card reader or terminal. The target encrypted PIN block, after translation to ISO2 format, is appended to this message data to generate an issuer script response.

type DerivationMethodAttributes

dict

param DerivationMethodAttributes

[REQUIRED]

The attributes and data values to derive payment card specific confidentiality and integrity keys.

Note

This is a Tagged Union structure. Only one of the following top level keys can be set: EmvCommon, Amex, Visa, Emv2000, Mastercard.

  • EmvCommon (dict) --

    Parameters to derive the confidentiality and integrity keys for a payment card using Emv common derivation method.

    • MajorKeyDerivationMode (string) -- [REQUIRED]

      The method to use when deriving the master key for the payment card.

    • PrimaryAccountNumber (string) -- [REQUIRED]

      The Primary Account Number (PAN) of the cardholder.

    • PanSequenceNumber (string) -- [REQUIRED]

      A number that identifies and differentiates payment cards with the same Primary Account Number (PAN). Typically 00 is used, if no value is provided by the terminal.

    • ApplicationCryptogram (string) -- [REQUIRED]

      The application cryptogram for the current transaction that is provided by the terminal during transaction processing.

    • Mode (string) -- [REQUIRED]

      The block cipher method to use for encryption.

    • PinBlockPaddingType (string) -- [REQUIRED]

      The padding to be added to the PIN block prior to encryption.

      Padding type should be ISO_IEC_7816_4 , if PinBlockLengthPosition is set to FRONT_OF_PIN_BLOCK . No padding is required, if PinBlockLengthPosition is set to NONE .

    • PinBlockLengthPosition (string) -- [REQUIRED]

      Specifies if PIN block length should be added to front of the pin block.

      If value is set to FRONT_OF_PIN_BLOCK , then PIN block padding type should be ISO_IEC_7816_4 .

  • Amex (dict) --

    Parameters to derive the confidentiality and integrity keys for a payment card using Amex derivation method.

    • MajorKeyDerivationMode (string) -- [REQUIRED]

      The method to use when deriving the master key for a payment card using Amex derivation.

    • PrimaryAccountNumber (string) -- [REQUIRED]

      The Primary Account Number (PAN) of the cardholder.

    • PanSequenceNumber (string) -- [REQUIRED]

      A number that identifies and differentiates payment cards with the same Primary Account Number (PAN). Typically 00 is used, if no value is provided by the terminal.

    • ApplicationTransactionCounter (string) -- [REQUIRED]

      The transaction counter of the current transaction that is provided by the terminal during transaction processing.

    • AuthorizationRequestKeyIdentifier (string) -- [REQUIRED]

      The keyArn of the issuer master key for cryptogram (IMK-AC) for the payment card.

    • CurrentPinAttributes (dict) --

      The encrypted pinblock of the old pin stored on the chip card.

      • CurrentPinPekIdentifier (string) -- [REQUIRED]

        The keyArn of the current PIN PEK.

      • CurrentEncryptedPinBlock (string) -- [REQUIRED]

        The encrypted pinblock of the current pin stored on the chip card.

  • Visa (dict) --

    Parameters to derive the confidentiality and integrity keys for a a payment card using Visa derivation method.

    • MajorKeyDerivationMode (string) -- [REQUIRED]

      The method to use when deriving the master key for the payment card.

    • PrimaryAccountNumber (string) -- [REQUIRED]

      The Primary Account Number (PAN) of the cardholder.

    • PanSequenceNumber (string) -- [REQUIRED]

      A number that identifies and differentiates payment cards with the same Primary Account Number (PAN). Typically 00 is used, if no value is provided by the terminal.

    • ApplicationTransactionCounter (string) -- [REQUIRED]

      The transaction counter of the current transaction that is provided by the terminal during transaction processing.

    • AuthorizationRequestKeyIdentifier (string) -- [REQUIRED]

      The keyArn of the issuer master key for cryptogram (IMK-AC) for the payment card.

    • CurrentPinAttributes (dict) --

      The encrypted pinblock of the old pin stored on the chip card.

      • CurrentPinPekIdentifier (string) -- [REQUIRED]

        The keyArn of the current PIN PEK.

      • CurrentEncryptedPinBlock (string) -- [REQUIRED]

        The encrypted pinblock of the current pin stored on the chip card.

  • Emv2000 (dict) --

    Parameters to derive the confidentiality and integrity keys for a payment card using Emv2000 derivation method.

    • MajorKeyDerivationMode (string) -- [REQUIRED]

      The method to use when deriving the master key for the payment card.

    • PrimaryAccountNumber (string) -- [REQUIRED]

      The Primary Account Number (PAN) of the cardholder.

    • PanSequenceNumber (string) -- [REQUIRED]

      A number that identifies and differentiates payment cards with the same Primary Account Number (PAN). Typically 00 is used, if no value is provided by the terminal.

    • ApplicationTransactionCounter (string) -- [REQUIRED]

      The transaction counter of the current transaction that is provided by the terminal during transaction processing.

  • Mastercard (dict) --

    Parameters to derive the confidentiality and integrity keys for a payment card using Mastercard derivation method.

    • MajorKeyDerivationMode (string) -- [REQUIRED]

      The method to use when deriving the master key for the payment card.

    • PrimaryAccountNumber (string) -- [REQUIRED]

      The Primary Account Number (PAN) of the cardholder.

    • PanSequenceNumber (string) -- [REQUIRED]

      A number that identifies and differentiates payment cards with the same Primary Account Number (PAN). Typically 00 is used, if no value is provided by the terminal.

    • ApplicationCryptogram (string) -- [REQUIRED]

      The application cryptogram for the current transaction that is provided by the terminal during transaction processing.

rtype

dict

returns

Response Syntax

{
    'NewPinPekArn': 'string',
    'SecureMessagingIntegrityKeyArn': 'string',
    'SecureMessagingConfidentialityKeyArn': 'string',
    'Mac': 'string',
    'EncryptedPinBlock': 'string',
    'NewPinPekKeyCheckValue': 'string',
    'SecureMessagingIntegrityKeyCheckValue': 'string',
    'SecureMessagingConfidentialityKeyCheckValue': 'string',
    'VisaAmexDerivationOutputs': {
        'AuthorizationRequestKeyArn': 'string',
        'AuthorizationRequestKeyCheckValue': 'string',
        'CurrentPinPekArn': 'string',
        'CurrentPinPekKeyCheckValue': 'string'
    }
}

Response Structure

  • (dict) --

    • NewPinPekArn (string) --

      Returns the keyArn of the PEK protecting the incoming new encrypted PIN block.

    • SecureMessagingIntegrityKeyArn (string) --

      Returns the keyArn of the IMK-SMI used by the operation.

    • SecureMessagingConfidentialityKeyArn (string) --

      Returns the keyArn of the IMK-SMC used by the operation.

    • Mac (string) --

      Returns the mac of the issuer script containing message data and appended target encrypted pin block in ISO2 format.

    • EncryptedPinBlock (string) --

      Returns the incoming new encrpted PIN block.

    • NewPinPekKeyCheckValue (string) --

      The key check value (KCV) of the PEK uprotecting the incoming new encrypted PIN block.

    • SecureMessagingIntegrityKeyCheckValue (string) --

      The key check value (KCV) of the SMI issuer master key used by the operation.

    • SecureMessagingConfidentialityKeyCheckValue (string) --

      The key check value (KCV) of the SMC issuer master key used by the operation.

    • VisaAmexDerivationOutputs (dict) --

      The attribute values used for Amex and Visa derivation methods.

      • AuthorizationRequestKeyArn (string) --

        The keyArn of the issuer master key for cryptogram (IMK-AC) used by the operation.

      • AuthorizationRequestKeyCheckValue (string) --

        The key check value (KCV) of the issuer master key for cryptogram (IMK-AC) used by the operation.

      • CurrentPinPekArn (string) --

        The keyArn of the current PIN PEK.

      • CurrentPinPekKeyCheckValue (string) --

        The key check value (KCV) of the current PIN PEK.