boulder: Index | Files

package pkcs11helpers

import ""


Package Files


func FindObject Uses

func FindObject(ctx PKCtx, session pkcs11.SessionHandle, tmpl []*pkcs11.Attribute) (pkcs11.ObjectHandle, error)

FindObject looks up a PKCS#11 object handle based on the provided template. In the case where zero or more than one objects are found to match the template an error is returned.

func GetECDSAPublicKey Uses

func GetECDSAPublicKey(ctx PKCtx, session pkcs11.SessionHandle, object pkcs11.ObjectHandle) (*ecdsa.PublicKey, error)

func GetRSAPublicKey Uses

func GetRSAPublicKey(ctx PKCtx, session pkcs11.SessionHandle, object pkcs11.ObjectHandle) (*rsa.PublicKey, error)

func Sign Uses

func Sign(ctx PKCtx, session pkcs11.SessionHandle, object pkcs11.ObjectHandle, keyType KeyType, digest []byte, hash crypto.Hash) ([]byte, error)

type KeyType Uses

type KeyType int
const (
    RSAKey KeyType = iota

type MockCtx Uses

type MockCtx struct {
    GenerateKeyPairFunc   func(pkcs11.SessionHandle, []*pkcs11.Mechanism, []*pkcs11.Attribute, []*pkcs11.Attribute) (pkcs11.ObjectHandle, pkcs11.ObjectHandle, error)
    GetAttributeValueFunc func(pkcs11.SessionHandle, pkcs11.ObjectHandle, []*pkcs11.Attribute) ([]*pkcs11.Attribute, error)
    SignInitFunc          func(pkcs11.SessionHandle, []*pkcs11.Mechanism, pkcs11.ObjectHandle) error
    SignFunc              func(pkcs11.SessionHandle, []byte) ([]byte, error)
    GenerateRandomFunc    func(pkcs11.SessionHandle, int) ([]byte, error)
    FindObjectsInitFunc   func(sh pkcs11.SessionHandle, temp []*pkcs11.Attribute) error
    FindObjectsFunc       func(sh pkcs11.SessionHandle, max int) ([]pkcs11.ObjectHandle, bool, error)
    FindObjectsFinalFunc  func(sh pkcs11.SessionHandle) error

func (MockCtx) FindObjects Uses

func (mc MockCtx) FindObjects(sh pkcs11.SessionHandle, max int) ([]pkcs11.ObjectHandle, bool, error)

func (MockCtx) FindObjectsFinal Uses

func (mc MockCtx) FindObjectsFinal(sh pkcs11.SessionHandle) error

func (MockCtx) FindObjectsInit Uses

func (mc MockCtx) FindObjectsInit(sh pkcs11.SessionHandle, temp []*pkcs11.Attribute) error

func (MockCtx) GenerateKeyPair Uses

func (mc MockCtx) GenerateKeyPair(s pkcs11.SessionHandle, m []*pkcs11.Mechanism, a1 []*pkcs11.Attribute, a2 []*pkcs11.Attribute) (pkcs11.ObjectHandle, pkcs11.ObjectHandle, error)

func (MockCtx) GenerateRandom Uses

func (mc MockCtx) GenerateRandom(s pkcs11.SessionHandle, c int) ([]byte, error)

func (MockCtx) GetAttributeValue Uses

func (mc MockCtx) GetAttributeValue(s pkcs11.SessionHandle, o pkcs11.ObjectHandle, a []*pkcs11.Attribute) ([]*pkcs11.Attribute, error)

func (MockCtx) Sign Uses

func (mc MockCtx) Sign(s pkcs11.SessionHandle, m []byte) ([]byte, error)

func (MockCtx) SignInit Uses

func (mc MockCtx) SignInit(s pkcs11.SessionHandle, m []*pkcs11.Mechanism, o pkcs11.ObjectHandle) error

type PKCtx Uses

type PKCtx interface {
    GenerateKeyPair(pkcs11.SessionHandle, []*pkcs11.Mechanism, []*pkcs11.Attribute, []*pkcs11.Attribute) (pkcs11.ObjectHandle, pkcs11.ObjectHandle, error)
    GetAttributeValue(pkcs11.SessionHandle, pkcs11.ObjectHandle, []*pkcs11.Attribute) ([]*pkcs11.Attribute, error)
    SignInit(pkcs11.SessionHandle, []*pkcs11.Mechanism, pkcs11.ObjectHandle) error
    Sign(pkcs11.SessionHandle, []byte) ([]byte, error)
    GenerateRandom(pkcs11.SessionHandle, int) ([]byte, error)
    FindObjectsInit(sh pkcs11.SessionHandle, temp []*pkcs11.Attribute) error
    FindObjects(sh pkcs11.SessionHandle, max int) ([]pkcs11.ObjectHandle, bool, error)
    FindObjectsFinal(sh pkcs11.SessionHandle) error

func Initialize Uses

func Initialize(module string, slot uint, pin string) (PKCtx, pkcs11.SessionHandle, error)

Package pkcs11helpers imports 9 packages (graph) and is imported by 12 packages. Updated 2020-04-24. Refresh now. Tools for package owners.