PaymentCryptographyDataPlane / Client / generate_mac_emv_pin_change
generate_mac_emv_pin_change#
- PaymentCryptographyDataPlane.Client.generate_mac_emv_pin_change(**kwargs)#
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
response = 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' } } )
- Parameters:
NewPinPekIdentifier (string) –
[REQUIRED]
The
keyARN
of the PEK protecting the incoming new encrypted PIN block.NewEncryptedPinBlock (string) –
[REQUIRED]
The incoming new encrypted PIN block data for offline pin change on an EMV card.
PinBlockFormat (string) –
[REQUIRED]
The PIN encoding format of the incoming new encrypted PIN block as specified in ISO 9564.
SecureMessagingIntegrityKeyIdentifier (string) –
[REQUIRED]
The
keyARN
of the issuer master key (IMK-SMI) used to authenticate the issuer script response.SecureMessagingConfidentialityKeyIdentifier (string) –
[REQUIRED]
The
keyARN
of the issuer master key (IMK-SMC) used to protect the PIN block data in the issuer script response.MessageData (string) –
[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.
DerivationMethodAttributes (dict) –
[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
, ifPinBlockLengthPosition
is set toFRONT_OF_PIN_BLOCK
. No padding is required, ifPinBlockLengthPosition
is set toNONE
.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 beISO_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.
- Return type:
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.
Exceptions
PaymentCryptographyDataPlane.Client.exceptions.ValidationException
PaymentCryptographyDataPlane.Client.exceptions.AccessDeniedException
PaymentCryptographyDataPlane.Client.exceptions.ResourceNotFoundException
PaymentCryptographyDataPlane.Client.exceptions.ThrottlingException
PaymentCryptographyDataPlane.Client.exceptions.InternalServerException