verifyPinData method

Future<VerifyPinDataOutput> verifyPinData({
  1. required String encryptedPinBlock,
  2. required String encryptionKeyIdentifier,
  3. required PinBlockFormatForPinData pinBlockFormat,
  4. required PinVerificationAttributes verificationAttributes,
  5. required String verificationKeyIdentifier,
  6. DukptAttributes? dukptAttributes,
  7. WrappedKey? encryptionWrappedKey,
  8. int? pinDataLength,
  9. String? primaryAccountNumber,
})

Verifies pin-related data such as PIN and PIN Offset using algorithms including VISA PVV and IBM3624. For more information, see Verify PIN data in the Amazon Web Services Payment Cryptography User Guide.

This operation verifies PIN data for user payment card. A card holder PIN data is never transmitted in clear to or from Amazon Web Services Payment Cryptography. This operation uses PIN Verification Key (PVK) for PIN or PIN Offset generation and then encrypts it using PIN Encryption Key (PEK) to create an EncryptedPinBlock for transmission from Amazon Web Services Payment Cryptography.

For information about valid keys for this operation, see Understanding key attributes and Key types for specific data operations in the Amazon Web Services Payment Cryptography User Guide.

Cross-account use: This operation supports cross-account use when the key has a resource-based policy that grants access. For more information, see Resource-based policies.

Related operations:

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException. May throw VerificationFailedException.

Parameter encryptedPinBlock : The encrypted PIN block data that Amazon Web Services Payment Cryptography verifies.

Parameter encryptionKeyIdentifier : The keyARN of the encryption key under which the PIN block data is encrypted. This key type can be PEK or BDK.

Parameter pinBlockFormat : The PIN encoding format for pin data generation as specified in ISO 9564. Amazon Web Services Payment Cryptography supports ISO_Format_0 and ISO_Format_3.

The ISO_Format_0 PIN block format is equivalent to the ANSI X9.8, VISA-1, and ECI-1 PIN block formats. It is similar to a VISA-4 PIN block format. It supports a PIN from 4 to 12 digits in length.

The ISO_Format_3 PIN block format is the same as ISO_Format_0 except that the fill digits are random values from 10 to 15.

Parameter verificationAttributes : The attributes and values for PIN data verification.

Parameter verificationKeyIdentifier : The keyARN of the PIN verification key.

Parameter dukptAttributes : The attributes and values for the DUKPT encrypted PIN block data.

Parameter pinDataLength : The length of PIN being verified.

Parameter primaryAccountNumber : The Primary Account Number (PAN), a unique identifier for a payment credit or debit card that associates the card with a specific account holder.

Implementation

Future<VerifyPinDataOutput> verifyPinData({
  required String encryptedPinBlock,
  required String encryptionKeyIdentifier,
  required PinBlockFormatForPinData pinBlockFormat,
  required PinVerificationAttributes verificationAttributes,
  required String verificationKeyIdentifier,
  DukptAttributes? dukptAttributes,
  WrappedKey? encryptionWrappedKey,
  int? pinDataLength,
  String? primaryAccountNumber,
}) async {
  _s.validateNumRange(
    'pinDataLength',
    pinDataLength,
    4,
    12,
  );
  final $payload = <String, dynamic>{
    'EncryptedPinBlock': encryptedPinBlock,
    'EncryptionKeyIdentifier': encryptionKeyIdentifier,
    'PinBlockFormat': pinBlockFormat.value,
    'VerificationAttributes': verificationAttributes,
    'VerificationKeyIdentifier': verificationKeyIdentifier,
    if (dukptAttributes != null) 'DukptAttributes': dukptAttributes,
    if (encryptionWrappedKey != null)
      'EncryptionWrappedKey': encryptionWrappedKey,
    if (pinDataLength != null) 'PinDataLength': pinDataLength,
    if (primaryAccountNumber != null)
      'PrimaryAccountNumber': primaryAccountNumber,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/pindata/verify',
    exceptionFnMap: _exceptionFns,
  );
  return VerifyPinDataOutput.fromJson(response);
}