Skip to content

duclos-cavalcanti/rust-pkcs11

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PKCS11 Client

Installation

Dependencies

sudo apt update
sudo apt install softhsm2 opensc

Setup

  1. Verify library path:
find /usr/lib/ -name "libsofthsm2.so"
  1. Add user to softhsm group:
sudo usermod -aG softhsm $(whoami)
  1. Initialize token:
softhsm2-util --init-token --slot 0 --label "MyToken" --pin 1234 --so-pin 1234
  1. Verify token slots:
softhsm2-util --show-slots
  1. Generate key-pair
pkcs11-tool --module /usr/lib/softhsm/libsofthsm2.so --login --pin 1234 --keypairgen --key-type rsa:2048 --id 01 --label "TestKey"
  1. Verify key-pair
pkcs11-tool --module /usr/lib/softhsm/libsofthsm2.so --login --pin 1234 --list-objects

Example

softhsm2-util --init-token --slot 0 --label "MyToken" --pin 1234 --so-pin 1234
pkcs11-tool --module /usr/lib/softhsm/libsofthsm2.so --login --pin 1234 --keypairgen --key-type rsa:2048 --id 01 --label "TestKey"

softhsm2-util --init-token --slot 1 --label "Token2" --pin 5678 --so-pin 5678
pkcs11-tool --module /usr/lib/softhsm/libsofthsm2.so --login --pin 5678 --keypairgen --key-type rsa:2048 --id 02 --label "Key2" --slot 1482650756

softhsm2-util --init-token --slot 2 --label "Token3" --pin 3456 --so-pin 3456
pkcs11-tool --module /usr/lib/softhsm/libsofthsm2.so --login --pin 3456 --keypairgen --key-type rsa:2048 --id 03 --label "Key3" --slot 1125575704

Client

Dependencies

sudo apt-get install libncurses5-dev libncursesw5-dev

Documentation

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages