Skip to content

Commit

Permalink
Document how to setup test env
Browse files Browse the repository at this point in the history
  • Loading branch information
nickray committed Jan 10, 2021
1 parent 65b105e commit c227c81
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ One way to generate URIs to feed into this library is the `p11tool` in GnuTLS.
Running `p11tool --list-tokens` returns the URIs for all available tokens.
Running `p11tool --list-all <token URI>` then lists all the objects in that token.
For private keys, use `GNUTLS_PIN=<pin> p11tool --login --list-all <token URI>`.

One way to create keypairs to use is with softhsm-util and pkcs11-tool:
```
softhsm2-util --init-token --free --label my-ca --pin 1234 --so-pin 1234
pkcs11-tool --module /usr/lib/libsofthsm2.so --token my-ca --login --pin 1234 --keypairgen --label my-signing-key --key-type RSA:2048
12 changes: 6 additions & 6 deletions examples/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ fn main() {
fn try_main() -> anyhow::Result<()> {
let _uri_str = r"pkcs11:
type=private;
token=lpc55-2ac0c213b4903b76;
object=lpc55-2ac0c213b4903b76%20@%202021-01-08T20:41:24
token=my-ca;
object=my-signing-key
?pin-source=file:pin.txt
&module-path=/usr/lib/libsofthsm2.so";
let _uri_str = r"pkcs11:
type=private;
token=lpc55-2ac0c213b4903b76;
object=lpc55-2ac0c213b4903b76%20@%202021-01-08T20:41:24
token=my-ca;
object=my-signing-key
?pin-source=env:PIN
&module-path=/usr/lib/libsofthsm2.so";
let _uri_str = r"pkcs11:
type=private;
token=lpc55-2ac0c213b4903b76;
object=lpc55-2ac0c213b4903b76%20@%202021-01-08T20:41:24
token=my-ca;
object=my-signing-key
?pin-value=1234
&module-path=/usr/lib/libsofthsm2.so";
let uri = Pkcs11Uri::try_from(_uri_str)?;
Expand Down

0 comments on commit c227c81

Please sign in to comment.