Documentation ¶
Overview ¶
Package cryptoki implements cryptographic token interface as defined in PKCS #11.
Index ¶
- Constants
- type KeyPair
- type Token
- func (tk *Token) Close() error
- func (tk *Token) ExportPublicKey(pub pkcs11.ObjectHandle) (crypto.PublicKey, error)
- func (tk *Token) FindKeyPair(key crypto.PublicKey) (crypto.Signer, error)
- func (tk *Token) FindObject(query []*pkcs11.Attribute) (pkcs11.ObjectHandle, error)
- func (tk *Token) GenerateKeyPair(label string, algo string, size int) (crypto.Signer, error)
- func (tk *Token) GetAttribute(obj pkcs11.ObjectHandle, typ uint) ([]byte, error)
- func (tk *Token) GetReadOnlySession() (pkcs11.SessionHandle, error)
- func (tk *Token) GetSession() (pkcs11.SessionHandle, error)
- func (tk *Token) GetUintAttribute(obj pkcs11.ObjectHandle, typ uint) (uint, error)
- func (tk *Token) Info() (pkcs11.TokenInfo, error)
- func (tk *Token) Sign(msg []byte, priv pkcs11.ObjectHandle, mech uint) ([]byte, error)
Constants ¶
const ( RSA = "rsa" ECDSA = "ecdsa" )
Supported algorithm strings. Compatible with CFSSL.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyPair ¶
type KeyPair struct {
// contains filtered or unexported fields
}
KeyPair implements the crypto.Signer interface using a key pair kept in PKCS #11 cryptographic token.
func (*KeyPair) Sign ¶
Sign signs digest with the private key. The entropy from rand will be ignored.
For RSA, the signature scheme will be RSASSA-PKCS1-v1_5, unless opts is an *rsa.PSSOptions in which case RSASSA-PSS scheme will be used.
For ECDSA, the resulting signature will be a DER-serialised, ASN.1 signature structure.
type Token ¶
type Token struct {
// contains filtered or unexported fields
}
A Token represents a cryptographic token that implements PKCS #11.
func (*Token) ExportPublicKey ¶
ExportPublicKey returns the public key object as crypto.PublicKey.
func (*Token) FindKeyPair ¶
FindKeyPair looks up a key pair inside the token with the public key.
func (*Token) FindObject ¶
FindObject returns the first object it found that matches the query.
func (*Token) GenerateKeyPair ¶
GenerateKeyPair generates a key pair inside the token.
func (*Token) GetAttribute ¶
GetAttribute obtains the value of a single object attribute. If there are multiple attributes of the same type, it only returns the value of the first one.
func (*Token) GetReadOnlySession ¶
func (tk *Token) GetReadOnlySession() (pkcs11.SessionHandle, error)
GetReadOnlySession returns a read-only session with the token.
func (*Token) GetSession ¶
func (tk *Token) GetSession() (pkcs11.SessionHandle, error)
GetSession returns a writable session with the token.
func (*Token) GetUintAttribute ¶
GetUintAttribute returns the value of a single object attribute as uint.