Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.
Genera un pin casuale e il PVV associato, quindi verifica il valore
Argomenti
Crea la/le chiave/i
Per generare un pin casuale e il PVV, avrai bisogno di due chiavi, una chiave di verifica del pin (PVK) per generare il PVV e una chiave di crittografia dei pin per crittografare il pin. Il pin stesso viene generato casualmente in modo sicuro all'interno del servizio e non è correlato crittograficamente a nessuna delle due chiavi.
Il PGK deve essere una chiave dell'algoritmo TDES_2KEY basato sull'algoritmo PVV stesso. Un PEK può essere TDES_2KEY, TDES_3KEY o AES_128. In questo caso, poiché il PEK è destinato all'uso interno del sistema, AES_128 sarebbe una buona scelta. Se un PEK viene utilizzato per l'interscambio con altri sistemi (ad esempio reti di schede, acquirenti ATMs) o viene spostato nell'ambito di una migrazione, TDES_2KEY può essere la scelta più appropriata per motivi di compatibilità.
Crea il PEK
$
aws payment-cryptography create-key \ --exportable --key-attributes KeyAlgorithm=AES_128,KeyUsage=TR31_P0_PIN_ENCRYPTION_KEY,\ KeyClass=SYMMETRIC_KEY,\ KeyModesOfUse='{Encrypt=true,Decrypt=true,Wrap=true,Unwrap=true}' --tags='[{"Key":"CARD_BIN","Value":"12345678"}]'
La risposta richiama i parametri della richiesta, tra cui un ARN per le chiamate successive e un Key Check Value (KCV).
{ "Key": { "KeyArn": "arn:aws:payment-cryptography:us-east-2::key/ivi5ksfsuplneuyt", "KeyAttributes": { "KeyUsage": "TR31_P0_PIN_ENCRYPTION_KEY", "KeyClass": "SYMMETRIC_KEY", "KeyAlgorithm": "AES_128", "KeyModesOfUse": { "Encrypt": false, "Decrypt": false, "Wrap": false, "Unwrap": false, "Generate": true, "Sign": false, "Verify": true, "DeriveKey": false, "NoRestrictions": false } }, "KeyCheckValue": "7CC9E2", "KeyCheckValueAlgorithm": "CMAC", "Enabled": true, "Exportable": true, "KeyState": "CREATE_COMPLETE", "KeyOrigin": "AWS_PAYMENT_CRYPTOGRAPHY", "CreateTimestamp": "2023-06-05T06:41:46.648000-07:00", "UsageStartTimestamp": "2023-06-05T06:41:46.626000-07:00" } }
Prendi nota di KeyArn
ciò che rappresenta la chiave, ad esempio arn:aws:payment-cryptography:us-east-2: :key/ivi5ksfsuplneuyt. Ne hai bisogno nel passaggio successivo.
Crea il PVK
$
aws payment-cryptography create-key --exportable --key-attributes KeyAlgorithm=TDES_2KEY,KeyUsage=TR31_V2_VISA_PIN_VERIFICATION_KEY,KeyClass=SYMMETRIC_KEY,KeyModesOfUse='{Generate=true,Verify=true}' --tags='[{"Key":"CARD_BIN","Value":"12345678"}]'
La risposta richiama i parametri della richiesta, tra cui un ARN per le chiamate successive e un Key Check Value (KCV).
{ "Key": { "KeyArn": "arn:aws:payment-cryptography:us-east-2::key/ov6icy4ryas4zcza", "KeyAttributes": { "KeyUsage": "TR31_V2_VISA_PIN_VERIFICATION_KEY", "KeyClass": "SYMMETRIC_KEY", "KeyAlgorithm": "TDES_2KEY", "KeyModesOfUse": { "Encrypt": false, "Decrypt": false, "Wrap": false, "Unwrap": false, "Generate": true, "Sign": false, "Verify": true, "DeriveKey": false, "NoRestrictions": false } }, "KeyCheckValue": "51A200", "KeyCheckValueAlgorithm": "ANSI_X9_24", "Enabled": true, "Exportable": true, "KeyState": "CREATE_COMPLETE", "KeyOrigin": "AWS_PAYMENT_CRYPTOGRAPHY", "CreateTimestamp": "2023-06-05T06:41:46.648000-07:00", "UsageStartTimestamp": "2023-06-05T06:41:46.626000-07:00" } }
Prendi nota di KeyArn
ciò che rappresenta la chiave, ad esempio arn:aws:payment-cryptography:us-east-2: :key/ov6icy4ryas4zcza. Ne hai bisogno nel passaggio successivo.
Genera un pin casuale, genera PVV e restituisci il PIN e il PVV crittografati
In questo esempio, genereremo un nuovo pin (casuale) a 4 cifre in cui le uscite saranno crittografate (. PIN block
PinData PinBlock) e un PVV
(PinData. VerificationValue). Gli input chiave sono PAN
il formato Pin Verification Key
(noto anche come chiave di generazione dei pin) Pin Encryption Key
e il formato PIN Block.
Questo comando richiede che la chiave sia di tipoTR31_V2_VISA_PIN_VERIFICATION_KEY
.
$
aws payment-cryptography-data generate-pin-data --generation-key-identifier arn:aws:payment-cryptography:us-east-2::key/37y2tsl45p5zjbh2 --encryption-key-identifier arn:aws:payment-cryptography:us-east-2::key/ivi5ksfsuplneuyt --primary-account-number 171234567890123 --pin-block-format ISO_FORMAT_0 --generation-attributes VisaPin={PinVerificationKeyIndex=1}
{ "GenerationKeyArn": "arn:aws:payment-cryptography:us-east-2::key/37y2tsl45p5zjbh2", "GenerationKeyCheckValue": "7F2363", "EncryptionKeyArn": "arn:aws:payment-cryptography:us-east-2::key/ivi5ksfsuplneuyt", "EncryptionKeyCheckValue": "7CC9E2", "EncryptedPinBlock": "AC17DC148BDA645E", "PinData": { "VerificationValue": "5507" } }
Convalida il PIN crittografato utilizzando il metodo PVV
In questo esempio, convalideremo un PIN per un determinato PAN. Il PIN viene in genere fornito dal titolare della carta o dall'utente durante il momento della transazione per la convalida e viene confrontato con il valore registrato (l'input del titolare della carta viene fornito come valore crittografato dal terminale o da altro provider a monte). Per convalidare questo input, verranno forniti anche i seguenti valori in fase di esecuzione: il pin crittografato, la chiave utilizzata per crittografare il pin di input (spesso denominato IWK) PAN
e il valore con cui eseguire la verifica (a PVV
oPIN offset
).
Se AWS Payment Cryptography è in grado di convalidare il pin, viene restituito un http/200. Se il pin non è convalidato, restituirà un http/400.
$
aws payment-cryptography-data verify-pin-data --verification-key-identifier arn:aws:payment-cryptography:us-east-2::key/37y2tsl45p5zjbh2 --encryption-key-identifier arn:aws:payment-cryptography:us-east-2::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::key/37y2tsl45p5zjbh2", "VerificationKeyCheckValue": "7F2363", "EncryptionKeyArn": "arn:aws:payment-cryptography:us-east-2::key/ivi5ksfsuplneuyt", "EncryptionKeyCheckValue": "7CC9E2", }