📄 applettestcrypto.scr
字号:
// Empty record// Read Expiration Date from Parameters file// SFI = 2 (00010), record tag 0xc5 is in P1 => P2 = 00010000 = 0x10;0x00 0xb2 0xc5 0x10 0x00 0x7F;// 69 82 : SW Security status not satisfied - One has to present Master PIN to read Parameters// Verify PIN : Master PIN0x00 0x20 0x00 0x81 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00;// 90 00;// Read Expiration Date from Parameters file// SFI = 2 (00010), record tag 0xc5 is in P1 => P2 = 00010000 = 0x10;0x00 0xb2 0xc5 0x10 0x00 0x7F;// c5 03 0c 1f 62 90 00 = Tag = 0xc5, Exp. Date = 12/31/98 (0c 1f 62)// Select File: select EF under current DF (P1 = 0x02); FID = 0x91030x00 0xa4 0x02 0x0c 0x02 0x91 0x03 0x00;// 90 00;// Read the first record in the selected file// currently selected file, record N is specified in P1 => P2 = 00000100 = 0x040x00 0xb2 0x01 0x04 0x00 0x7F;// 00 05 02 03 da 33 44 55 66 0a 1c 61 12 35 4b 13 90 00 90 00 // TN = 5; Transaction Type = DEBIT(02); Amount = $9.86(03da); CAD ID 33445566;// Date 10/28/97 (0a 1c 61); Time 18:53(12 35); Balance $192.19 (4b 13), SW = NO_ERROR (9000)/////////////////////////////////////////////////////////////// Additional JavaPurse tests to increase coverage/////////////////////////////////////////////////////////////// Select JavaPurse0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 0xb 1 127;// 90 00 = SW_NO_ERROR// Verify PIN (User PIN 01020304)0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00;// 90 00;// Wrong INS for Java Purse CLA0x80 0x34 0x00 0x00 0x00 0x00;// 6d 00;// Wrong CLA0x60 0x00 0x00 0x00 0x00 0x00;// 6e 00;// Wrong INS for ISO CLA0x00 0x74 0x00 0x00 0x00 0x00;// 6d 00 // Initialize transaction: wrong transaction type0x80 0x20 0x03 0x00 0x0a 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F;// 6a 86 == SW_INCORRECT_P1P2// Initialize transaction: incorrect P20x80 0x20 0x02 0x11 0x0a 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F;// 6a 86 == SW_INCORRECT_P1P2// Initialize transaction: incorrect LC0x80 0x20 0x02 0x11 0x0b 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x00 0x7F;// 67 00 == SW_WRONG_LENGTH// Initialize transaction: Debit $9.860x80 0x20 0x02 0x00 0x0a 0x03 0xda 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F;// 05 05 05 05 0c 1f 62 4b 13 00 06 00 00 00 00 00 00 00 00 90 00 = TN = 6; Balance = $192.19// Complete Transaction: incorrect LC0x80 0x22 0x00 0x00 0x0c 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F;// 67 00 == SW_WRONG_LENGTH// Complete Transaction: incorrect P10x80 0x22 0x11 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F;// 6a 86 == SW_INCORRECT_P1P2// Complete Transaction: incorrect P20x80 0x22 0x00 0x11 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F;// 6a 86 == SW_INCORRECT_P1P2/////////////////////////////////////////////////////////// Additional cases for Parameter Update/////////////////////////////////////////////////////////// Select JavaPurse0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 0xb 1 127;// 90 00 = SW_NO_ERROR// Initialize Parameter Update0x80 0x24 0x00 0x00 0x00 0x7F; // 69 82 = SW "Security Status Not Satisfied" : must present PIN first// Verify PIN : Master PIN0x00 0x20 0x00 0x86 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00;// 6a 86 == SW_INCORRECT_P1P2// Verify PIN : Master PIN0x00 0x20 0x00 0x81 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00;// 90 00;// Initialize Parameter Update0x80 0x24 0x11 0x00 0x00 0x7F; // 6a 86 == SW_INCORRECT_P1P2// Initialize Parameter Update0x80 0x24 0x00 0x11 0x00 0x7F; // 6a 86 == SW_INCORRECT_P1P2// Initialize Parameter Update0x80 0x24 0x00 0x00 0x00 0x7F; // 05 05 05 05 0c 1f 62 00 09 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 9 // Initialize Parameter Update0x80 0x24 0x00 0x00 0x00 0x7F;// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/980x80 0x26 0x11 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F;// 6a 86 == SW_INCORRECT_P1P2// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/980x80 0x26 0x00 0x11 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F;// 6a 86 == SW_INCORRECT_P1P2// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/980x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x11 0x00 0x11 0x00 0x11 0x00 0x11 0x7F;// 91 05 == SW_WRONG_SIGNATURE// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/980x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xCF 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F;// 6a 81 == SW_FUNC_NOT_SUPPORTED// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/980x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F;// 00 00 00 00 00 00 00 00 90 00;// Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/980x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F;// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE// Initialize Parameter Update0x80 0x24 0x00 0x00 0x00 0x7F;// 05 05 05 05 0c 1f 62 00 0A 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 10// Complete Parameter Update: CAD ID 0x11223344; Set Max Transaction $200.00;0x80 0x26 0x00 0x00 0x14 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC8 0x02 0x4E 0x20 0x95 0xc9 0x3b 0x6f 0x1f 0xdd 0xa1 0x1a 0x7F;// 00 00 00 00 00 00 00 00 90 00;// Select JavaPurse0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 0xb 1 127;// 90 00 = SW_NO_ERROR// Verify PIN (User PIN 01020304)0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00;// 90 00;// Initialize transaction: Debit $199.990x80 0x20 0x02 0x00 0x0a 0x4E 0x1F 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F;// 91 02 == SW_NOT_ENOUGH_FUNDS// Initialize transaction: Debit $192.190x80 0x20 0x02 0x00 0x0a 0x4b 0x13 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F;// 05 05 05 05 0c 1f 62 4b 13 00 05 00 00 00 00 00 00 00 00 90 00;// Complete Transaction: Date 10/28/97; Time 18:530x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F;// 00 00 00 00 00 00 00 00 00 00 90 00 = Balance = $0;/////////////////////////////////////////////////////////////////////// Select JavaLoyalty/////////////////////////////////////////////////////////////////////0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 5 1 127;// 90 00 = SW_NO_ERROR// Read Balance0x90 0x20 0x00 0x00 0x00 0x00;// 00 16 90 00 = Balance=22 points// Reset Balance0x90 0x22 0x00 0x00 0x00 0x00;// 90 00 = SW_NO_ERROR/////////////////////////////////////////////////////////////////////// Initialize Wallet///////////////////////////////////////////////////////////////////////Select Wallet0x00 0xA4 0x04 0x00 0x0a 0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0x6 0x1 0x7F;// 90 00 = SW_NO_ERROR//Verify user pin0x80 0x20 0x00 0x00 0x05 0x01 0x02 0x03 0x04 0x05 0x7F;//90 00 = SW_NO_ERROR//Get wallet balance0x80 0x50 0x00 0x00 0x00 0x02;//0x00 0x00 0x00 0x00 0x90 0x00 = Balance = 0 and SW_ON_ERROR//Attemp to debit from an empty account0x80 0x40 0x00 0x00 0x01 0x64 0x7F; //0x6A85 = SW_NEGATIVE_BALANCE//Credit $100 to the empty account0x80 0x30 0x00 0x00 0x01 0x64 0x7F; //0x9000 = SW_NO_ERROR//Get Balance0x80 0x50 0x00 0x00 0x00 0x02;//0x00 0x64 0x9000 = Balance = 100 and SW_NO_ERROR//Debit $50 from the account0x80 0x40 0x00 0x00 0x01 0x32 0x7F; //0x9000 = SW_NO_ERROR//Get Balance0x80 0x50 0x00 0x00 0x00 0x02;//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR//Credit $128 to the account0x80 0x30 0x00 0x00 0x01 0x80 0x7F; //0x6A83 = SW_INVALID_TRANSACTION_AMOUNT//Get Balance0x80 0x50 0x00 0x00 0x00 0x02;//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR//Debit $51 from the account0x80 0x40 0x00 0x00 0x01 0x33 0x7F;//0x6A85 = SW_NEGATIVE_BALANC//Get Balance0x80 0x50 0x00 0x00 0x00 0x02;//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR//Debit $128 from the account0x80 0x40 0x00 0x00 0x01 0x80 0x7F;//0x6A83 = SW_INVALID_TRANSACTION_AMOUNT//Get Balance0x80 0x50 0x00 0x00 0x00 0x02;//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR//Reselect Wallet applet so that userpin is reset0x00 0xA4 0x04 0x00 0x0a 0xa0 0x0 0x0 0x0 0x62 0x3 0x1 0xc 0x6 0x1 0x7F;// 90 00 = SW_NO_ERROR//Credit $127 to the account before pin verification0x80 0x30 0x00 0x00 0x01 0x7F 0x7F;//0x6301 = SW_PIN_VERIFICATION_REQUIRED//Verify User pin with wrong pin value0x80 0x20 0x00 0x00 0x04 0x01 0x03 0x02 0x66 0x7F;//0x6300 = SW_VERIFICATION_FAILED//Verify user pin again with correct pin value //0x80 0x20 0x00 0x00 0x08 0xF2 0x34 0x12 0x34 0x56 0x10 0x01 0x01 0x7F;0x80 0x20 0x00 0x00 0x05 0x01 0x02 0x03 0x04 0x05 0x7F;//0x9000 = SW_NO_ERROR//Get balance with incorrrect LE value 0x80 0x50 0x00 0x00 0x00 0x01;//0x6700 = ISO7816.SW_WRONG_LENGTH//Get balance 0x80 0x50 0x00 0x00 0x00 0x02;//0x00 0x32 0x9000 = Balance = 50 and SW_NO_ERROR
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -