View a markdown version of this page

验证 PIN 数据 - AWS Payment Cryptography

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

验证 PIN 数据

验证 PIN 数据功能用于验证 pin 是否正确。这通常涉及将之前存储的 PIN 值与持卡人在 POI 输入的值进行比较。这些函数比较两个值,但不暴露任一来源的底层值。

使用 PVV 方法验证加密的 PIN

在此示例中,我们将验证给定 PAN 的 PIN。PIN 通常由持卡人或用户在交易期间提供以进行验证,并与存档的值进行比较(持卡人的输入作为来自终端或其他上游提供商的加密值提供)。为了验证此输入,还将在运行时提供以下值:用于加密输入 pin 的密钥(通常为IWKPAN和用于验证的值(a PVVPIN offset)。

如果 AWS 支付密码学能够验证 PIN, http/200 则返回。如果 PIN 未通过验证,它将返回 http/400。

$ aws payment-cryptography-data verify-pin-data --verification-key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/37y2tsl45p5zjbh2 --encryption-key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/ivi5ksfsuplneuyt --primary-account-number 171234567890123 --pin-block-format ISO_FORMAT_0 --verification-attributes VisaPin="{PinVerificationKeyIndex=1,VerificationValue=5507}" --encrypted-pin-block AC17DC148BDA645E
{ "VerificationKeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/37y2tsl45p5zjbh2", "VerificationKeyCheckValue": "7F2363", "EncryptionKeyArn": "arn:aws:payment-cryptography:us-east-2:111122223333:key/ivi5ksfsuplneuyt", "EncryptionKeyCheckValue": "7CC9E2", }

使用 PVV 方法验证加密 PIN-错误密码错误

在此示例中,我们将尝试验证给定 PAN 的 PIN,但由于该 PIN 不正确,它将失败。

使用 SDK 时,它显示为 {“消息”: “密码块验证失败”。, “原因”: “PIN 无效”}

$ aws payment-cryptography-data verify-pin-data --verification-key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/37y2tsl45p5zjbh2 --encryption-key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/ivi5ksfsuplneuyt --primary-account-number 171234567890123 --pin-block-format ISO_FORMAT_0 --verification-attributes VisaPin="{PinVerificationKeyIndex=1,VerificationValue=9999}" --encrypted-pin-block AC17DC148BDA645E
An error occurred (VerificationFailedException) when calling the VerifyPinData operation: Pin block verification failed.

使用 PVV 方法验证加密的 PIN-错误输入

在此示例中,我们将尝试验证给定 PAN 的 PIN,但由于输入错误且传入的数据不是有效的 PIN,它将失败。常见原因是:使用的 1/wrong 密钥 2/input 参数(例如全景或密码块格式)不正确 3/pin 区块已损坏。

$ aws payment-cryptography-data verify-pin-data --verification-key-identifier arn:aws:payment-cryptography:us-east-2:111122223333:key/37y2tsl45p5zjbh2 --encryption-key-identifier --primary-account-number 171234567890123 --pin-block-format ISO_FORMAT_0 --verification-attributes VisaPin="{PinVerificationKeyIndex=1,VerificationValue=9999}" --encrypted-pin-block AC17DC148BDA645E
An error occurred (ValidationException) when calling the VerifyPinData operation: Pin block provided is invalid. Please check your input to ensure all field values are correct.