[ Quoting <
cardb...@gmail.com> in "Re: [go-nuts] pkcs11 package..." ]
> Awesome, I wish I had this a few months ago when I was flailing about with
> PKCS11 in C++. I wouldn't worry to much about the higher level API. Some helper
> functions might be useful if enough use cases can be found.
Well... help is still welcome :)
The following now works and I'm sorta happy with the API, but it still doesn't
look too good.
<assume softhsm is installed>
% cd pkcs11/example1
% export SOFTHSM_CONF=$PWD/softhsm.conf
% softhsm --init-token --slot 0 --label test --pin 1234 --so-pin 1234
% ./example1
SoftHSM
slots [0]
2
1
The 2 and 1 are the handles of the generated keys. Signging 'n stuff is
up next.
The API look like this, GenerateKeyPair is now:
pub, priv, e := p.C_GenerateKeyPair(session, &pkcs11.CKM_RSA_PKCS_KEY_PAIR_GEN{},
[]pkcs11.Attribute{&pkcs11.CKA_MODULUS_BITS{1024}},
[]pkcs11.Attribute{&pkcs11.CKA_TOKEN{true}, &pkcs11.CKA_PRIVATE{false}})
Regards,
Miek