Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to create pin file on cryptoflex virtual smart card #158

Closed
OmarAzouz opened this issue Nov 10, 2019 · 10 comments
Closed

Failed to create pin file on cryptoflex virtual smart card #158

OmarAzouz opened this issue Nov 10, 2019 · 10 comments

Comments

@OmarAzouz
Copy link

I have opened a terminal on ubuntu 16.04 and running the following commands
omarazooz@ubuntu:/Desktop$ sudo service pcscd start
[sudo] password for omarazooz:
omarazooz@ubuntu:
/Desktop$ vicc -t cryptoflex -vvvvvv
10.11.2019 04:23:39 [INFO] Connected to virtual PCD at localhost:35963
10.11.2019 04:23:39 [INFO] Power Up
10.11.2019 04:23:39 [INFO] Power Down
10.11.2019 04:25:07 [INFO] Power Up

Then I have opened another terminal and used cryptoflex-tool supported by opensc to create pin for the created virtual card
omarazooz@ubuntu:~/Desktop$ cryptoflex-tool -P 1
Using reader with a card: Virtual PCD 00 00
Using card driver: Schlumberger Multiflex/Cryptoflex

The other terminal where vicc is open gives10.11.2019 04:25:08 [INFO] Response APDU (2 bytes):
0000: 61 12 ..

10.11.2019 04:25:08 [DEBUG] file (fid=0) not found in:
{CryptoflexMF at 0x7f1fd09b8350}:
_named_dfs
_filedescriptor 0x38
_secondSFT length 1:
0000: 01 .
extra_fci_data length 0:

_fid 0x3f00
_content
{TransparentStructureEF at 0x7f1fd09b8290}:
_filedescriptor 0x1
extra_fci_data length 0:

  _fid            0x2
  _lifecycle      0x5
  _data           length 8:
  0000:  00 00 00 01 00 01 00 00                           ........        
  _datacoding     0x0

_lifecycle 0x5
_data length 0:

_firstSFT length 1:
0000: FF .
10.11.2019 04:25:08 [INFO] Checking error (Wrong parameters P1-P2): File or application not found
10.11.2019 04:25:08 [INFO] Response APDU (2 bytes):
0000: 6A 82 ..

When I enter the pin on the cryptoflex-tool
omarazooz@ubuntu:~/Desktop$ cryptoflex-tool -P 1
Using reader with a card: Virtual PCD 00 00
Using card driver: Schlumberger Multiflex/Cryptoflex
Please enter CHV1: 1234
Please enter PUK for CHV1: 12345

It produces the following
Unable to select created PIN file: Unknown data received from card

while on other terminal on which vicc is running gives
10.11.2019 04:25:08 [INFO] Response APDU (2 bytes):
0000: 61 12 ..

10.11.2019 04:25:08 [DEBUG] file (fid=0) not found in:
{CryptoflexMF at 0x7f1fd09b8350}:
_named_dfs
_filedescriptor 0x38
_secondSFT length 1:
0000: 01 .
extra_fci_data length 0:

_fid 0x3f00
_content
{TransparentStructureEF at 0x7f1fd09b8290}:
_filedescriptor 0x1
extra_fci_data length 0:

  _fid            0x2
  _lifecycle      0x5
  _data           length 8:
  0000:  00 00 00 01 00 01 00 00                           ........        
  _datacoding     0x0

_lifecycle 0x5
_data length 0:

_firstSFT length 1:
0000: FF .
10.11.2019 04:25:08 [INFO] Checking error (Wrong parameters P1-P2): File or application not found
10.11.2019 04:25:08 [INFO] Response APDU (2 bytes):
0000: 6A 82 ..

10.11.2019 04:29:07 [INFO] Created {TransparentStructureEF at 0x7f1fd09b8610}:
_filedescriptor 0x1
extra_fci_data length 0:

_fid 0x0
_lifecycle 0x5
_data length 23:
0000: 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 ................
0010: 30 30 30 30 30 30 30 .......
_datacoding 0x0
10.11.2019 04:29:07 [INFO] Response APDU (2 bytes):
0000: 90 00 ..

10.11.2019 04:29:07 [INFO] Response APDU (2 bytes):
0000: 61 14 ..

Traceback (most recent call last):
File "/usr/local/bin/vicc", line 161, in
vicc.run()
File "/usr/local/lib/python2.7/dist-packages/virtualsmartcard/VirtualSmartcard.py", line 579, in run
answer = self.os.execute(msg)
File "/usr/local/lib/python2.7/dist-packages/virtualsmartcard/cards/cryptoflex.py", line 53, in execute
c.data)
File "/usr/local/lib/python2.7/dist-packages/virtualsmartcard/cards/cryptoflex.py", line 261, in selectFile
size = inttostring(min(0xffff, len(file.getenc('data'))), 2)
AttributeError: 'TransparentStructureEF' object has no attribute 'getenc'

@frankmorgner
Copy link
Owner

The cryptoflex implementation is very specific to an outdated smart card application and likely not very useful for you. What are you trying to do?

@OmarAzouz
Copy link
Author

OmarAzouz commented Nov 11, 2019

Good Afternoon Mr. frank
I am trying to build my own application like openpgp or piv or GIDs on iso7816 virtual smart card. As the real iso7816 smart cards are difficult to bring. When I have run the command:
vicc -t iso7816 -vvvvvvv
It run successfully and I am getting atr also when I am using VERIFY command , or getting random number from smart cards it works. But it fails to create files either DFs or EFs and gives me the response : Incorrect parameter in data field SW1 SW2: 6A 80
When that failed I am trying this on cryptoflex cards.
Thanks so much for you response and your attention Mr. Frank

@OmarAzouz
Copy link
Author

I want some tutorial on how to create EFs or DFs on iso7816 smart card the command the CLA byte, INS byte, P1, P2 , LC, LE and the data field. What are the required parameters in data field required for virtual smart card? I have tried alot of tutorials and all of them give the status SW1 SW2: 6A 80. So could you please provide me a tutorial with the commands and their explanation in order to proceed further.
Thanks so much for your efforts.

@frankmorgner
Copy link
Owner

My question was about why you want to emulate a smart card. For example, there are some Java Card Applets, that can be emulated as well, which support most standard use cases (authentication, encryption, signature) without the need of programming anything... For example, the IsoApplet tries to be close to ISO 7816-4...

@OmarAzouz
Copy link
Author

I also tried opensc smart card simulation which uses vpcd as virtual interface and compile jcardsim jcardsim_SNAPSHOT_3.0.4.jar using java applet like openpgp but also it gives me an error javac file not found and I am not a Java developer I am a C, C++ developer so It is very difficult for me to solve this task using Java. Please help me in any one of those two technologies either Vicc or jcardsim

@frankmorgner
Copy link
Owner

use java instead of javac

@OmarAzouz
Copy link
Author

Good afternoon Mr. Frank I have installed Win7 and installed BixVReader and used jcardsim and opensc smart card simulation. It worked successfully and perfectly.
But still I do not know how to create file in the isoapplet

@OmarAzouz
Copy link
Author

Please Mr. Frank could you help me with a tutorial on how to create , delete files and tags on isoapplet or iso7816 card.
Thanks so much for your efforts.

1 similar comment
@OmarAzouz
Copy link
Author

Please Mr. Frank could you help me with a tutorial on how to create , delete files and tags on isoapplet or iso7816 card.
Thanks so much for your efforts.

@frankmorgner
Copy link
Owner

please read the documentation https://github.com/philipWendland/IsoApplet/wiki

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants