BryanJacobs / FIDO2Applet

FIDO2 Javacard Applet
MIT License
63 stars 12 forks source link

Task : Running Test on Real Smart Card on Windows Environment #9

Closed sarabjeet2610 closed 8 months ago

sarabjeet2610 commented 9 months ago

I have installed FIDO2Applet on real smart card. But I am not able to run python_tests on the smart card. I tried following steps on ws2 ubuntu because apparently on windows I cannot start the tests due to some dependency of fnctl library which is not there on windows. So I installed wsl and ubuntu and I am trying to build and run the python_tests. But I am facing many challenges related to libraries and stuff. Which I am trying to solve but I feel I am still a long way to run the python_tests.

Is it somehow possible on guiding on (I believe I am asking for a lot, but its worth a shot):

  1. what configuration/file to change in the project so that I am able to connect to smart card (I am using Gemalto USB smart card reader)
  2. in order to run the python_tests on windows, is there any possibility ? to avoid wsl and ubuntu stuff ? if yes then how?
  3. Apparently, some compatibility issues are also coming between different python libraries, most resent with pyscard. Is it somehow possible to find which libraries other then mentioned in requirements.txt are requried to execute the tests on windows?
BryanJacobs commented 9 months ago

First off, the tests in this repository rely on each test suite installing the applet fresh. They are not designed to be a generic compatibility suite for an installed applet, they're designed to check the applet code itself is working. That said...

  1. ctap_test.py line 91 should be PCSC instead of RAW if you're trying to use a real smart card 1b. You will need to rewrite the setUp, setUpClass, tearDown, and softResetCard methods of JCardSimTestCase in ctap_test.py because you're planning not to use JCardSim 1c. ctap_test.py line 292 needs to change to use a filter matching your real card
  2. There's nothing Linux-specific in the repository, so if your Windows Python setup is fine it should work. It's just not going to be a super good developer experience because Windows generally isn't great at, you know, Python
  3. The requirements.txt lists fido2[pcsc], which pulls in the pyscard dependency. You do need pyscard installed and working. That's what determines whether the tests can connect to your smartcard reader or not.

But the tests in this repository are not designed to run against a real installed applet, they're designed to run against a software emulation of one. You can make the changes above if you like, but right now the tests take a couple seconds and require no human intervention. On a real card they'd take minutes and you'd have to be there to plug the card in and out.

BryanJacobs commented 8 months ago

Closing due to inactivity.