package keys

import "github.com/google/trillian/crypto/keys"

Package keys provides access to public and private keys for signing and verification of signatures.

Index

Functions

func NewSigner

func NewSigner(ctx context.Context, keyProto proto.Message) (crypto.Signer, error)

NewSigner uses a registered ProtoHandler (see RegisterHandler()) to convert a protobuf message into a crypto.Signer. If there is no ProtoHandler registered for this type of protobuf message, an error will be returned.

func RegisterHandler

func RegisterHandler(keyProto proto.Message, handler ProtoHandler)

RegisterHandler enables transformation of protobuf messages of the same type as keyProto into crypto.Signer by invoking the provided handler. The keyProto need only be an empty example of the type of protobuf message that the handler can process - only its type is examined. If a handler for this type of protobuf message has already been added, it will be replaced.

Types

type ProtoHandler

type ProtoHandler func(context.Context, proto.Message) (crypto.Signer, error)

ProtoHandler uses the information in a protobuf message to obtain a crypto.Signer. For example, the protobuf message may contain a key or identify where a key can be found.

Source Files

handlers.go

Directories

PathSynopsis
crypto/keys/derPackage der contains functions for marshaling and unmarshaling keys in DER format.
crypto/keys/pemPackage pem contains functions for marshaling and unmarshaling keys in PEM format.
crypto/keys/pkcs11Package pkcs11 provides access to private keys using a PKCS#11 interface.
crypto/keys/testonlyPackage testonly contains code and data that should only be used by tests.
Version
v1.7.1 (latest)
Published
Jan 9, 2025
Platform
linux/amd64
Imports
7 packages
Last checked
5 days ago

Tools for package owners.