Can you help me with this use case since it will take me quite a while to google and learn things while my main focus is to develop our application:
- Ultimate Objective: I want to encrypt/decrypt stored in the database.
- My approach:
- Install Nitrokey, initialize, create keys as explained at: github.com/OpenSC/OpenSC/wiki/SmartCardHSM.
- Utilize gpg2 to encrypt/decrypt data.
- Create java API to interact with “gpg2” to encrypt/decrypt data.
I am currently stuck at the 2 since I don’t know where to start, what i have tried:
/usr/local/sbin/pcscd -a -f -d
$ opensc-explorer
OpenSC Explorer version 0.15.0
Using reader with a card: Nitrokey Nitrokey HSM (010000000000000000000000) 00 00
OpenSC [3F00]> cd aid:E82B0601040181C31F0201
OpenSC [E82B/0601/0401/81C3/1F02/01]> ls
FileID Type Size
2F02 wEF 462
CE01 wEF 409
C401 wEF 48
CC00 wEF 0
CC01 wEF 0
OpenSC [E82B/0601/0401/81C3/1F02/01]>exit
But when I try gpg2 to connect to the Nitrokey, i have this error:
$ gpg2 --card-edit
gpg: selecting openpgp failed: Card error
gpg: OpenPGP card not available: Card error
gpg/card>
I tried to kill the pcscd process, it still says the same error.
So, can you please let me know where did I do wrong?
Thanks,