Partager via


Running the Smart Card Reader Test (IFDTest2) (Windows Embedded CE 6.0)

1/6/2010

Applies to Windows Embedded CE 6.0 R2

To run this test by using the default values, enter the following command at the command-line:

tux –o –d ifdtesttux -x 1000-1004

The following sections describe the functionality of each part of the test suite.

Part A Card Monitor Test

Part B Card Reader Interface Test

Part C Resource Manager Simulation Test

Part D Card Protocol Test

Part E Power Management Test

Running this test suite will help you verify that your smart card reader and associated device driver both function correctly with a Windows Embedded CE device.

Note

If the system being tested has a display, the instructions, progress, and test results will be shown on the system display. However, if the system does not have a display screen, the instructions, progress, and test results will be displayed in the Windows Embedded CE 6.0 R2 (and later versions) Output window.

Part A: Card Monitor Test

The Card Monitor Test checks for correct detection of the smart card insertion state, and the correct handling of operations interrupted by an unexpected removal of a smart card. The tests verify that IOCTL_SMARTCARD_IS_PRESENT and IOCTL_SMARTCARD_IS_ABSENT produce valid results.

  1. Test detects any empty readers by using IOCTL_SMARTCARD_IS_PRESENT.
  2. Test detects an inserted smart card by using IOCTL_SMARTCARD_IS_PRESENT.
  3. Test detects the removal of an inserted smart card by using IOCTL_SMARTCARD_IS_ABSENT.
  4. Test detects any empty readers by using IOCTL_SMARTCARD_IS_ABSENT.
  5. Tests the correct handling of a randomly timed card insertion and removal event over 15 seconds. The test ends after a maximum of ten insertion and removal cycles.

Part B: Card Reader Interface Test

The Card Reader Interface Test checks that the property and state information in the card reader driver are handled correctly.

  1. Test verifies whether the device name reported by the driver is Windows Embedded CE-compliant.
  2. Test verifies whether the driver correctly handles attribute read requests with NULL return buffer.
  3. Test reads the smart card reader attributes when no smart card is inserted in the card reader:
    1. SCARD_ATTR_VENDOR_Name Nonzero length string.
    2. SCARD_ATTR_VENDOR_IFD_TYPE Nonzero length string.
    3. SCARD_ATTR_DEVICE_UNIT Value < 4.
    4. SCARD_ATTR_ATR_STRING Read attempt fails.
    5. SCARD_ATTR_DEFAULT_CLK 1000 <= value <= 20000.
    6. SCARD_ATTR_MAX_CLK 1000 <= value <= 20000.
    7. SCARD_ATTR_DEFAULT_DATA_RATE read attempt succeeds.
    8. SCARD_ATTR_MAX_DATA_RATE Read attempt succeeds.
    9. SCARD_ATTR_MAX_IFSD 1 <= VALUE <= 254.
    10. SCARD_ATTR_CURRENT_PROTOCOL_TYPE Read attempt fails.
    11. SCARD_ATTR_PROTOCOL_TYPES Verifies success, and that T0 | T1 are supported.
  4. Test verifies whether the smart card reader driver correctly terminates all pending I/O requests if the driver is closed and reopened with an I/O request pending.
  5. Test verifies whether the driver correctly terminates pending I/O requests if IOCTL_SMARTCARD_CANCEL_BLOCKING is called.
  6. Test operator inserts a card.
  7. Test verifies whether a cold reset (SCARD_COLD_RESET) takes longer than two seconds.
  8. Test verifies whether setting the Interface Device Protocol to T0 or T1 succeeds.
  9. Test reads smart card reader attributes when a smart card is inserted in the card reader:
    1. SCARD_ATTR_ATR_STRING: Read attempt succeeds.
    2. SCARD_ATTR_CURRENT_PROTOCOL_TYPE: Value !=0.
  10. Test reads the card state when the smart card is removed, by using IOCTL_SMARTCARD_GET_STATE: State <= SCARD_SWALLOWED.
  11. Test performs a cold reset of the smart card, and verifies whether the result is ERROR_UNRECOGNIZED_MEDIA.

Part C: Resource Manager Simulation Test

The Resource Manger Simulation Test verifies whether the state-change operations normally commanded by the Smart Card Resource Manager complete successfully.

  1. Test verifies whether IOCTL_SMARTCARD_GET_STATE succeeds without a card inserted.
  2. Test verifies whether the returned state is SCARD_ABSENT.
  3. Test verifies whether a call to IOCTL_SMARTCARD_IS_PRESENT is canceled correctly by using IOCTL_SMARTCARD_CANCEL_BLOCKING.
  4. Test verifies whether IOCTL_SMARTCARD_GET_STATE succeeds without a card inserted.
  5. Test operator inserts a smart card.
  6. Test verifies whether IOCTL_SMARTCARD_GET_STATE succeeds with smart card inserted.
  7. Test verifies whether the returned state is valid (> SCARD_ABSENT).
  8. Test verifies whether a call to IOCTL_SMARTCARD_IS_ABSENT is canceled correctly by using IOCTL_SMARTCARD_CANCEL_BLOCKING.
  9. Test performs a cold-reset of the smart card.
  10. Test verifies whether the smart card state is SCARD_NEGOTIABLE.
  11. Test sets the Smart Card Protocol to T0 or T1.
  12. Test verifies whether the smart card state is SCARD_SPECIFIC.
  13. Test verifies whether the IOCTL_SMARTCARD_POWER to turn off the smart card succeeds.
  14. Test operator removes the smart card.
  15. Test verifies whether the return value from IOCTL_SMARTCARD_IS_ABSENT is correct.
  16. Test verifies whether IOCTL_SMARTCARD_GET_STATE succeeds without a card inserted.
  17. Test verifies whether the card state is SCARD_ABSENT.

Part D: Card Protocol Test

The exact test executed depends on the card that is inserted, as follows:

Infineon Technologies PC/SC Compliance Test Card (Card 0 / Unlabeled)

Athena T0 Test Card (Card 1)

Athena T0 Inverse Convention Test Card (Card 2)

Axalto 32K eGate Test Card (Card 3)

Infineon SiCrypt Module Test Card (Card 4)

Ee505004.collapse(en-US,WinEmbedded.60).gifInfineon Technologies PC/SC Compliance Test Card (Card 0 / Unlabeled)

Answer to Reset (ATR) Values

3B EF 00 00 81 31 20 49

00 5C 50 43 54 10 27 F8

D2 76 00 00 38 33 00 4D

  1. Test tries to read when the buffer is too small.
  2. Test checks the waiting-time extension request, and routes the request figure to file 001. Then it reads it back and verifies it.
  3. Test verifies block-chaining resynchronization on file 0002 and verifies whether the card accepts first block. The card then repeatedly requests retransmission of block two, and the host re-synchronizes. Expect ERROR_IO_DEVICE.
  4. Test verifies block-chaining resynchronization on file 0002. The card repeatedly declares an EDC error on block two. The host then resynchronizes. Expect ERROR_IO_DEVICE.
  5. Test issues wrong block sequence by read-to-file 0003. Expect ERROR_IO_DEVICE.
  6. Test issues a Write command of a size equal to that of the Information Field Size for Card (IFSC). Expect success.
  7. Test issues a read-to-file 00 05 command. The expected result is ERROR_IO_DEVICE.
  8. Read and process the result file (A000). Parse and report errors.

Ee505004.collapse(en-US,WinEmbedded.60).gifAthena T0 Test Card (Card 1)

Answer to Reset (ATR) Values

3B D6 18 00 80 B1 80 6D

1F 03 80 51 00 61 10 30

9E

  1. Reset with ATR transmission time of 900 milliseconds.
  2. Set Protocol to T0. Expect success.
  3. Delete all card files by proprietary command. Expect success.
  4. Create test file 0002. Expect success.
  5. Select test file 0002. Expect success.
  6. Write 256 bytes as four blocks of 64 bytes. Expect success.
  7. Read and verify 256 bytes as four blocks of 64 bytes. Expect success.
  8. Write 255 bytes as a single block. Expect success. The card will receive the bytes in single-byte mode until eight bytes remain. Then, the rest of the data will be requested from the host as a single block. Expect success.
  9. Set Receive Buffer to nine bytes and try to receive a ten-byte response from the smart card. Expect ERROR_INSUFFICIENT_BUFFER.
  10. Send improperly formed Select command (known to be inconsistent with the length of the data): 00 a4 00 00 08 00. Expect ERROR_INVALID_PARAMETER.
  11. Test selects a nonexistent file. The expected result is that the command will succeed with a procedure byte sequence of SW1=0x64, SW2=0x82, which corresponds to "File Not Found".
  12. Send command 80 00 01 00 01 11 to silence the card. Expect ERROR_SEM_TIMEOUT.
  13. Reset the smart card.
  14. Send an echo command to the card to test the request wait time extension for extension counts of 1, 2, 5, and 30 extensions. Expect success.

Ee505004.collapse(en-US,WinEmbedded.60).gifAthena T0 Inverse Convention Test Card (Card 2)

Answer to Reset (ATR) Values

3F 96 18 80 01 80 51 00

61 10 30 9F

  1. Reset with ATR transmission time of 900 milliseconds.
  2. Set Protocol to T0. Expect success.
  3. Delete all card files by proprietary command. Expect success.
  4. Create test file 0002. Expect success.
  5. Select test file 0002. Expect success.
  6. Write 256 bytes as four blocks of 64 bytes. Expect success.
  7. Read and verify 256 bytes as four blocks of 64 bytes. Expect success.
  8. Write 255 bytes as a single block. Expect success. The card will receive the bytes in single-byte mode until 128 bytes remain. Then the rest of the data will be requested from the host as a single block. Expect success.
  9. Set Receive Buffer to nine bytes and try to receive a ten-byte response from the smart card. Expect ERROR_INSUFFICIENT_BUFFER.
  10. Send improperly formed Select command: 00 a4 00 08 00. Expect ERROR_INVALID_PARAMETER.
  11. Select a nonexistent file. Expect 6A 82.
  12. Send command 80 00 01 00 01 11 to silence the card. Expect ERROR_SEM_TIMEOUT.
  13. Reset the smart card.
  14. Send an echo command to the card to test the request wait time extension for extension counts of 1, 2, 5, and 30 extensions. Expect success.

Ee505004.collapse(en-US,WinEmbedded.60).gifAxalto 32K eGate Test Card (Card 3)

Answer to Reset (ATR) Values

3B 95 18 40 FF 62 01 02

01 04

  1. Try to set protocol T=1 and expect ERROR_NOT_SUPPORTED.
  2. Set protocol T=0.
  3. Authenticate by using the card transport key. Expect success.
  4. Clean the card state by deleting files from previous runs. For example, remove RSA public and private key files, the user PIN file, and the test file. Expect success.
  5. Create a new test file, 0055. Expect success.
  6. Test writing blocks of 1, 25, 75, and 128 bytes to the test file. Expect success.
  7. Test reading 128 bytes from the test file. Compare the data. Expect success.
  8. Delete test file 0055. Expect success.
  9. Create a PIN file. Expect success.
  10. Set the user PIN to 00000000. Expect success.
  11. Create a private key file. Expect success.
  12. Create a public key file. Expect success.
  13. Select the private key file. Expect success.
  14. Authenticate the user with the user PIN. Expect success.
  15. Generate a key pair. Expect success.
  16. Hash 16 bytes of data. Expect success.
  17. Obtain response data (20 bytes + 2 bytes) from the hash operation. Expect success.

Ee505004.collapse(en-US,WinEmbedded.60).gifInfineon SiCrypt Module Test Card (Card 4)

Answer to Reset (ATR) Values

3B DF 18 00 81 31 FE 67

00 5C 49 43 4D D4 91 47

D2 76 00 00 38 33 00 58

  1. Try to set protocol T=0. Expect ERROR_NOT_SUPPORTED.
  2. Set protocol T=1. Expect success.
  3. Authenticate by using PIN 12345678. Expect success.
  4. Remove any existing files from previous runs.
  5. Create a new test file, 0007. Expect success.
  6. Select file 0007. Expect success.
  7. Record system time.
  8. Write test blocks of 1, 25, 50, 75, 100, 125, and 128 bytes to the card. Read and verify the data after writing each block. Expect success.
  9. Get the system time again and show the elapsed time for test completion in seconds.
  10. Select file 0007. Expect success.
  11. Write a 128-byte block of by value 55. Read back and verify. Expect success.
  12. Write a 128-byte block of by value AA. Read back and verify. Expect success.
  13. Write a 128-byte block of by value 00. Read back and verify. Expect success.
  14. Write a 128-byte block of by value FF. Read back and verify. Expect success.
  15. Select nonexistent file 7777. Expect 94 04.
  16. Select MF by 00 a4 00 00. Expect success (90 00).
  17. Select file 77, a file known to be not valid. Expect 9404.
  18. Send improperly formed Select command (known to be inconsistent with the length of the data): 00 a4 00 00 08 00. Expect 94 04.
  19. Send improperly formed Select command (known to be too short): 00 a4 00. Expect 67 00.
  20. Create DF 5555 from the MF. Expect success.
  21. Select into 5555. Expect success.
  22. Create DF 5656 from 5555. Expect success.
  23. Select into 5656. Expect success.
  24. Create file 5757 in DF 5656. Expect success.
  25. Select that file from MF by using the full path. Expect success.
  26. Write eight bytes to the file. Read back and verify. Expect success.
  27. Delete the selected file. Expect success.
  28. Try to select the deleted file by using the full path. Expect 94 04.
  29. Select and delete DF 5656. Expect success.
  30. Select and delete DF 5555. Expect success.
  31. Select and delete file 0007. Expect success.

Part E: Power Management Test

The Power Management Test verifies that the smart card driver returns the correct state information to the smart card reader across all suspend/resume sequences, even when the state of the card reader changes during the suspend state by the insertion or removal of a smart card. This test assumes that the device being tested has not been configured to prevent the USB bus from powering down while suspended.

  1. Test operator removes all cards.
  2. Test calls IOCTL_SMARTCARD_IS_PRESENT.
  3. Test suspends device.
  4. Test resumes device.
  5. Test verifies that the IOCTL_SMARTCARD_IS_PRESENT call returns STATUS_CANCELLED.
  6. Test verifies that the current card reader handle is not valid.
  7. Test obtains a new driver handle.
  8. Test verifies that the card reader state is SCARD_ABSENT.
  9. Test operator inserts card.
  10. Test calls IOCTL_SMARTCARD_IS_ABSENT.
  11. Test suspends device.
  12. Test operator removes card while devices is suspended.
  13. Test resumes device.
  14. Test verifies that the IOCTL_SMARTCARD_IS_ABSENT call returns STATUS_CANCELLED.
  15. Test verifies that the current card reader handle is not valid.
  16. Test obtains a new driver handle.
  17. Test verifies that the card reader state is SCARD_ABSENT.
  18. Test operator inserts card.
  19. Test calls IOCTL_SMARTCARD_IS_ABSENT.
  20. Test suspends device.
  21. Test resumes device.
  22. Test verifies that the IOCTL_SMARTCARD_IS_ABSENT call returns STATUS_CANCELLED.
  23. Test verifies that the current card reader handle is not valid.
  24. Test obtains a new driver handle.
  25. Test verifies that the card reader state is SCARD_ABSENT.
  26. Test operator removes card.
  27. Test calls IOCTL_SMARTCARD_IS_PRESENT.
  28. Test suspends device.
  29. Test operator inserts card while device is suspended.
  30. Test resumes device.
  31. Test verifies that the IOCTL_SMARTCARD_IS_ABSENT call returns STATUS_CANCELLED.
  32. Test verifies that the current card reader handle is not valid.
  33. Test obtains a new driver handle.
  34. Test verifies that the card reader state is SCARD_ABSENT.
  35. Test operator removes card.

External Resources

For more information about the IFDTest2 test suite, see this Web site.

See Also

Concepts

Smart Card Reader Test (IFDTest2)