Documentation ¶
Index ¶
- func DecodeCKACLASS(b byte) string
- func FindSlotByLabel(p *pkcs11.Ctx, slotLabel string) (slot uint, index int, err error)
- func GetECParamMarshaled(namedCurve string) (ecParamMarshaled []byte, err error)
- type EcdsaKey
- func (k *EcdsaKey) DeriveSharedSecret(anotherPublicKey *ecdsa.PublicKey) (secret []byte, err error)
- func (k *EcdsaKey) GenSKI()
- func (k *EcdsaKey) Generate(namedCurve string) (err error)
- func (k *EcdsaKey) ImportPrivKeyFromFile(file string) (err error)
- func (k *EcdsaKey) ImportPubKeyFromCertFile(file string) (err error)
- func (k *EcdsaKey) ImportPubKeyFromPubKeyFile(file string) (err error)
- func (k *EcdsaKey) SignMessage(message string) (signature string, err error)
- func (k *EcdsaKey) VerifySignature(message string, signature string) (verified bool)
- type Pkcs11Library
- type Pkcs11Object
- type Pkcs11Wrapper
- func (p11w *Pkcs11Wrapper) FindObjects(template []*pkcs11.Attribute, max int) (p11ObjHandlers []pkcs11.ObjectHandle, moreThanMax bool, err error)
- func (p11w *Pkcs11Wrapper) ImportECKey(ec EcdsaKey) (err error)
- func (p11w *Pkcs11Wrapper) ImportECKeyFromFile(file string) (err error)
- func (p11w *Pkcs11Wrapper) ImportRSAKey(rsa RsaKey) (err error)
- func (p11w *Pkcs11Wrapper) ImportRSAKeyFromFile(file string) (err error)
- func (p11w *Pkcs11Wrapper) InitContext() (err error)
- func (p11w *Pkcs11Wrapper) InitSession() (err error)
- func (p11w *Pkcs11Wrapper) ListObjects(template []*pkcs11.Attribute, max int)
- func (p11w *Pkcs11Wrapper) Login() (err error)
- func (p11w *Pkcs11Wrapper) SignMessage(message string, key pkcs11.ObjectHandle) (signature string, err error)
- func (p11w *Pkcs11Wrapper) SignMessageAdvanced(data []byte, key pkcs11.ObjectHandle, mechanism *pkcs11.Mechanism) (signature string, err error)
- func (p11w *Pkcs11Wrapper) VerifySignature(message string, signature string, key pkcs11.ObjectHandle) (verified bool, err error)
- type RsaKey
- type SubjectKeyIdentifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeCKACLASS ¶
func FindSlotByLabel ¶
Return the slotID of token label
func GetECParamMarshaled ¶
returns value for CKA_EC_PARAMS
Types ¶
type EcdsaKey ¶
type EcdsaKey struct { PubKey *ecdsa.PublicKey PrivKey *ecdsa.PrivateKey SKI SubjectKeyIdentifier }
func (*EcdsaKey) DeriveSharedSecret ¶
func (*EcdsaKey) GenSKI ¶
func (k *EcdsaKey) GenSKI()
SKI returns the subject key identifier of this key.
func (*EcdsaKey) ImportPrivKeyFromFile ¶
func (*EcdsaKey) ImportPubKeyFromCertFile ¶
func (*EcdsaKey) ImportPubKeyFromPubKeyFile ¶
func (*EcdsaKey) SignMessage ¶
type Pkcs11Library ¶
type Pkcs11Object ¶
type Pkcs11Wrapper ¶
type Pkcs11Wrapper struct { // Context Library Pkcs11Library Context *pkcs11.Ctx // Session Handler SlotLabel string Session pkcs11.SessionHandle // Optional Slot Login SlotPin string }
func (*Pkcs11Wrapper) FindObjects ¶
func (p11w *Pkcs11Wrapper) FindObjects(template []*pkcs11.Attribute, max int) (p11ObjHandlers []pkcs11.ObjectHandle, moreThanMax bool, err error)
This should return a list of object handlers and true if more than max
func (*Pkcs11Wrapper) ImportECKey ¶
func (p11w *Pkcs11Wrapper) ImportECKey(ec EcdsaKey) (err error)
func (*Pkcs11Wrapper) ImportECKeyFromFile ¶
func (p11w *Pkcs11Wrapper) ImportECKeyFromFile(file string) (err error)
func (*Pkcs11Wrapper) ImportRSAKey ¶
func (p11w *Pkcs11Wrapper) ImportRSAKey(rsa RsaKey) (err error)
func (*Pkcs11Wrapper) ImportRSAKeyFromFile ¶
func (p11w *Pkcs11Wrapper) ImportRSAKeyFromFile(file string) (err error)
func (*Pkcs11Wrapper) InitContext ¶
func (p11w *Pkcs11Wrapper) InitContext() (err error)
Initialize pkcs11 context
func (*Pkcs11Wrapper) InitSession ¶
func (p11w *Pkcs11Wrapper) InitSession() (err error)
Initialize Session to slot
func (*Pkcs11Wrapper) ListObjects ¶
func (p11w *Pkcs11Wrapper) ListObjects(template []*pkcs11.Attribute, max int)
List content of slot
func (*Pkcs11Wrapper) Login ¶
func (p11w *Pkcs11Wrapper) Login() (err error)
This will perform a login
func (*Pkcs11Wrapper) SignMessage ¶
func (p11w *Pkcs11Wrapper) SignMessage(message string, key pkcs11.ObjectHandle) (signature string, err error)
func (*Pkcs11Wrapper) SignMessageAdvanced ¶
func (p11w *Pkcs11Wrapper) SignMessageAdvanced(data []byte, key pkcs11.ObjectHandle, mechanism *pkcs11.Mechanism) (signature string, err error)
Advanced form of signing message, specify mechanism. Assume data is already prepared for mechanism (not altered in this function)
func (*Pkcs11Wrapper) VerifySignature ¶
func (p11w *Pkcs11Wrapper) VerifySignature(message string, signature string, key pkcs11.ObjectHandle) (verified bool, err error)
type RsaKey ¶
type RsaKey struct { PubKey *rsa.PublicKey PrivKey *rsa.PrivateKey SKI SubjectKeyIdentifier }
func (*RsaKey) GenSKI ¶
func (k *RsaKey) GenSKI()
SKI returns the subject key identifier of this key.
func (*RsaKey) ImportPrivKeyFromFile ¶
Click to show internal directories.
Click to hide internal directories.