- The pros : generating RSA keys using the smart card is considered very safe. The RSA private key is generated using the embedded processor. It will never leave the card and cannot be extracted, even using nano-technologies.
- The cons : the private RSA key cannot leave the card and thus cannot be backed-up. If you loose the card, the secret is destroyed.
Warning: using this method, there is no way to backup your keys. Therefore, it is not usable for encryption of sensitive data. If you loose the smartcard and token, you will not be able to recover your data, which will be lost FOREVER.
![]()
Step 1: Creating an RSA keypair using the embedded processor
To generate RSA certificates with 2048bit length on smartcard, run the following command:
Query the result on smartcard:
Private RSA Key [Private Key]
Com. Flags : 3
Usage : [0x4], sign
Access Flags: [0x1D], sensitive, alwaysSensitive, neverExtract, local
ModLength : 2048
Key ref : 1
Native : yes
Path : 3f005015
Auth ID : 01
ID : c6f280080fb0ed1ebff0480a01d00a98a1b3b89a
Please note the ID of your RSA key:
Step 2: Configure OpenSSL to use smartcard cryptographic engine
For safety, we will be using OpenSSL with engine_pkcs11 to generate certificate using the smart card cryptographic engine.
Enter OpenSSL command prompt:
Copy the following line and paste it in OpenSSL command prompt:
[Success]: SO_PATH:/usr/lib/engines/engine_pkcs11.so
[Success]: ID:pkcs11
[Success]: LIST_ADD:1
[Success]: LOAD
[Success]: MODULE_PATH:opensc-pkcs11.so
Loaded: (pkcs11) pkcs11 engine
Under Mac OS X, you may need to enter the last command will full path to opensc-pkcs11.so, i.e.:
Do not exit the OpenSSL command prompt.
Step 3: Creating a self-signed certificate
We are going to generate a certificate using this RSA key.
Query available slots:
token label: François Pérou (User PIN)
token manuf: EnterSafe
token model: PKCS#15
token flags: rng, login required, PIN initialized, token initialized
serial num : 2998511513171109
Under Mac OS X, you may need to enter the last command will full path to opensc-pkcs11.so, i.e.:
The smart card is in slot 5.
The RSA key has ID c6f280080fb0ed1ebff0480a01d00a98a1b3b89a.
The corresponding SSL id is: slot_5-id_c6f280080fb0ed1ebff0480a01d00a98a1b3b89a
The syntax is slot_
Copy the following line, enter your values and paste it in OpenSSL command prompt:
Will then asked for PIN and certificate information:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:FR
State or Province Name (full name) [Some-State]:Yvelines
Locality Name (eg, city) []:La Celle Saint-Cloud
Organization Name (eg, company) [Internet Widgits Pty Ltd]:GOOZE
Organizational Unit Name (eg, section) []:Customer support
Common Name (eg, YOUR name) []:François Pérou
Email Address []:fran****ou@goo*e.e*
You self-signed certificate was saved to cert.pem. The certificate can be verified against itself:
Step 4: Storing certificate on card
Now we can store the certificate on card, with same ID as the RSA key.
First, query the ID of the RSA key:
Private RSA Key [Private Key]
Com. Flags : 3
Usage : [0x4], sign
Access Flags: [0x1D], sensitive, alwaysSensitive, neverExtract, local
ModLength : 2048
Key ref : 1
Native : yes
Path : 3f005015
Auth ID : 01
ID : c6f280080fb0ed1ebff0480a01d00a98a1b3b89a
Now we store certificate on card:
Please enter User PIN:
After entering PIN code, the certificate is stored.
Your card is now usable for authentication.
Printer-friendly version- 3255 reads
PDF version




