Documentation ¶
Overview ¶
Package keys provides access to public and private keys for signing and verification of signatures.
Index ¶
- Constants
- func ECDSACurveFromParams(params *keyspb.Specification_ECDSA) elliptic.Curve
- func NewFromSpec(spec *keyspb.Specification) (crypto.Signer, error)
- func NewSigner(ctx context.Context, keyProto proto.Message) (crypto.Signer, error)
- func RegisterHandler(keyProto proto.Message, handler ProtoHandler)
- func UnregisterHandler(keyProto proto.Message)
- type ProtoGenerator
- type ProtoHandler
Constants ¶
const ( // DefaultRsaKeySizeInBits is the size of an RSA key generated by this package, in bits, if not overridden. DefaultRsaKeySizeInBits = 2048 // MinRsaKeySizeInBits is the smallest RSA key that this package will generate. MinRsaKeySizeInBits = 2048 )
Variables ¶
This section is empty.
Functions ¶
func ECDSACurveFromParams ¶
func ECDSACurveFromParams(params *keyspb.Specification_ECDSA) elliptic.Curve
ECDSACurveFromParams returns the curve specified by the given parameters. Returns nil if the curve is not supported.
func NewFromSpec ¶
func NewFromSpec(spec *keyspb.Specification) (crypto.Signer, error)
NewFromSpec generates a new private key based on a key specification. If an RSA key is specified, the key size must be at least MinRsaKeySizeInBits.
func NewSigner ¶
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.
func UnregisterHandler ¶
UnregisterHandler removes a previously-added protobuf message handler. See RegisterHandler().
Types ¶
type ProtoGenerator ¶
ProtoGenerator creates a new private key based on a key specification. It returns a proto that can be passed to a ProtoHandler to get a crypto.Signer.
Directories ¶
Path | Synopsis |
---|---|
proto
Package proto registers a DER keys.ProtoHandler using keys.RegisterHandler.
|
Package proto registers a DER keys.ProtoHandler using keys.RegisterHandler. |
proto
Package proto registers a PEM keys.ProtoHandler using keys.RegisterHandler.
|
Package proto registers a PEM keys.ProtoHandler using keys.RegisterHandler. |
Package pkcs11 provides access to private keys using a PKCS#11 interface.
|
Package pkcs11 provides access to private keys using a PKCS#11 interface. |
proto
Package proto registers a PKCS#11 keys.ProtoHandler using keys.RegisterHandler.
|
Package proto registers a PKCS#11 keys.ProtoHandler using keys.RegisterHandler. |
Package testonly contains code and data that should only be used by tests.
|
Package testonly contains code and data that should only be used by tests. |