p11

package
v0.0.0-...-44e006c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

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

func FindSlotByLabel(p *pkcs11.Ctx, slotLabel string) (slot uint, index int, err error)

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

func GetECParamMarshaled(namedCurve string) (ecParamMarshaled []byte, err error)

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

func InitPkcs11(pkcs11LibraryPath string) (p *pkcs11.Ctx, err error)

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

func VerifyAesKey

func VerifyAesKey(p *pkcs11.Ctx, session pkcs11.SessionHandle, oLabel string, AesKeyLength int, ephemeral bool) (verified bool, err error)

This should verify that our key has the correct attributes

func VerifyECDSAKey

func VerifyECDSAKey(p *pkcs11.Ctx, session pkcs11.SessionHandle, oLabel string, namedCurve string, ephemeral bool) (verified bool, err error)

This should verify that our key has the correct attributes

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL