Documentation ¶
Index ¶
- func CreateAesKey(p *pkcs11.Ctx, session pkcs11.SessionHandle, objectLabel string, ...) (aesKey pkcs11.ObjectHandle, err error)
- func CreateECDSAKeyPair(p *pkcs11.Ctx, session pkcs11.SessionHandle, objectLabel string, ...) (ecdsaPrivKey pkcs11.ObjectHandle, ecdsaPubKey pkcs11.ObjectHandle, err error)
- func FindObjects(p *pkcs11.Ctx, session pkcs11.SessionHandle, template []*pkcs11.Attribute, ...) (oHs []pkcs11.ObjectHandle, moreThanMax bool, err error)
- func FindSlotByLabel(p *pkcs11.Ctx, slotLabel string) (slot uint, index int, err error)
- func GetAesPkcs11Template(objectLabel string, AesKeyLength int, pkcs11LibInfo pkcs11.Info, ...) (AesPkcs11Template []*pkcs11.Attribute)
- func GetECDSAPkcs11Template(objectLabel string, namedCurve string, ephemeral bool) (pubKeyTemplate []*pkcs11.Attribute, privKeyTemplate []*pkcs11.Attribute, ...)
- func GetECParamMarshaled(namedCurve string) (ecParamMarshaled []byte, err error)
- func GetPublicKey(p *pkcs11.Ctx, session pkcs11.SessionHandle, objectLabel string) (pubKeyPem string, err error)
- func ImportAesKey(p *pkcs11.Ctx, session pkcs11.SessionHandle, objectLabel string, ...) (aesKey pkcs11.ObjectHandle, err error)
- func InitPkcs11(pkcs11LibraryPath string) (p *pkcs11.Ctx, err error)
- func SignHmacSha256(p *pkcs11.Ctx, session pkcs11.SessionHandle, o pkcs11.ObjectHandle, ...) (hmac []byte, err error)
- func VerifyAesKey(p *pkcs11.Ctx, session pkcs11.SessionHandle, oLabel string, AesKeyLength int, ...) (verified bool, err error)
- func VerifyECDSAKey(p *pkcs11.Ctx, session pkcs11.SessionHandle, oLabel string, namedCurve string, ...) (verified bool, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateAesKey ¶
func CreateAesKey(p *pkcs11.Ctx, session pkcs11.SessionHandle, objectLabel string, AesKeyLength int, ephemeral bool) (aesKey pkcs11.ObjectHandle, err error)
Create an AES key with required template
func CreateECDSAKeyPair ¶
func CreateECDSAKeyPair(p *pkcs11.Ctx, session pkcs11.SessionHandle, objectLabel string, namedCurve string, ephemeral bool) (ecdsaPrivKey pkcs11.ObjectHandle, ecdsaPubKey pkcs11.ObjectHandle, err error)
Create an ECDSA keypair with required template
func FindObjects ¶
func FindObjects(p *pkcs11.Ctx, session pkcs11.SessionHandle, template []*pkcs11.Attribute, max int) (oHs []pkcs11.ObjectHandle, moreThanMax bool, err error)
This should return a list of object handlers and true if more than max
func FindSlotByLabel ¶
Return the slotID of token label
func GetAesPkcs11Template ¶
func GetAesPkcs11Template(objectLabel string, AesKeyLength int, pkcs11LibInfo pkcs11.Info, ephemeral bool) (AesPkcs11Template []*pkcs11.Attribute)
return a set of attributes that we require for our aes key
func GetECDSAPkcs11Template ¶
func GetECDSAPkcs11Template(objectLabel string, namedCurve string, ephemeral bool) (pubKeyTemplate []*pkcs11.Attribute, privKeyTemplate []*pkcs11.Attribute, err error)
return a set of attributes that we require for our ecdsa keypair
func GetECParamMarshaled ¶
returns value for CKA_EC_PARAMS
func GetPublicKey ¶
func GetPublicKey(p *pkcs11.Ctx, session pkcs11.SessionHandle, objectLabel string) (pubKeyPem string, err error)
This should return the public key in PEM format
func ImportAesKey ¶
func ImportAesKey(p *pkcs11.Ctx, session pkcs11.SessionHandle, objectLabel string, ephemeral bool, hexKey string) (aesKey pkcs11.ObjectHandle, err error)
func InitPkcs11 ¶
This should return a context and print out lib information
func SignHmacSha256 ¶
func SignHmacSha256(p *pkcs11.Ctx, session pkcs11.SessionHandle, o pkcs11.ObjectHandle, message []byte) (hmac []byte, err error)
test CKM_SHA256_HMAC signing
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.