13.11.2014 Views

Smartcard quickstarter guide Why use smartcards? - GOOZE ...

Smartcard quickstarter guide Why use smartcards? - GOOZE ...

Smartcard quickstarter guide Why use smartcards? - GOOZE ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Smartcard</strong> <strong>quickstarter</strong> <strong>guide</strong><br />

Storing objects on smartcard<br />

In this section, we will store a file on smart card and then get it back.<br />

Here is our test.txt file:<br />

$ cat test.txt<br />

This is a test.<br />

Let us query the auth ID of the PIN that protects this key:<br />

$ pkcs15-tool --list-pins<br />

Using reader with a card: Feitian SCR301 01 00<br />

PIN [User PIN]<br />

Com. Flags: 0x3<br />

ID : 01<br />

Flags : [0x30], initialized, needs-padding<br />

Length : min_len:4, max_len:16, stored_len:16<br />

Pad char : 0x00<br />

Reference : 1<br />

Type : ascii-numeric<br />

Path :<br />

To store the file on smart card with auth ID 01:<br />

$ pkcs15-init -W test.txt -a 01 -l "Fichier test"<br />

Using reader with a card: Feitian SCR301 01 00<br />

User PIN required.<br />

Please enter User PIN:<br />

After entering PIN, the file is stored on smart card.<br />

To list files on card:<br />

$ pkcs15-tool --list-data-objects<br />

Using reader with a card: Feitian SCR301 01 00<br />

Reading data object <br />

applicationName: pkcs15-init<br />

Label: Fichier test<br />

applicationOID: NONE<br />

Path: 3f0050153300<br />

Auth ID: 01<br />

Data Object (16 bytes): < 54 68 69 73 20 69 73 20 61 20 74 65 73 74 2E 0A ><br />

Now, we open the file:<br />

$ pkcs15-tool --read-data-object "Fichier test" -o welcome-back.txt<br />

Let's display content:<br />

$ cat welcome-back.txt<br />

This is a test.<br />

Copyright <strong>GOOZE</strong> 2010-2011 http://www.gooze.eu 50 / 63

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!