Export data object from smartcard with OpenSC

1.3k views Asked by At

I try to export a data object from a smartcard. For this I am using OpenSC 0.19.0. The command pkcs11-tool.exe --list-objects shows that the following data object resides on the token.

Data Object 12345678
label: 'mylabel'
application: ''
app_id: <empty>
flags: modifiable

pkcs15-tool.exe --dump shows a path and data value of this data object.

pkcs15-tool.exe --read-data-object mylabel outputs only the content of the data value. I want to export this content to a local file.

Any help will be appreciated, thanks!

1

There are 1 answers

0
Ronquam On BEST ANSWER

The two following commands write a data object's content to a local file:

pkcs11-tool.exe --module ../pkcs11/opensc-pkcs11.dll --login --pin 1234 --read-object --type data --label mylabel --output-file test

pkcs15-tool.exe -read-data-object mylabel -o test