Help us shape the future of Go! Take the 2026 Go Developer Survey

inmemcrypto

package
v1.0.310 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2026 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Overview

Package inmemcrypto is a software cryptoprov.Provider that keeps RSA and ECDSA keys in memory and can export them as PEM. It registers itself as manufacturer "inmem" and is selected by cryptoprov.Load when the config location is "" or "inmem". Intended for development, tests and delegated OCSP responder keys; it is not a KeyManager.

Key generation, lookup, and PEM export may run concurrently. Registry locking does not cover key generation, signing, or PEM serialization. Each export returns a caller-owned byte slice. Token configuration passed to Loader must remain unchanged while the provider is in use.

Index

Constants

View Source
const ProviderName = "inmem"

ProviderName specifies a provider name

Variables

This section is empty.

Functions

func Loader added in v0.2.0

Loader provides loader for Provider

Types

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider stores exportable RSA and ECDSA keys and supports concurrent key generation, lookup, and PEM export. Token configuration must remain unchanged while the provider is in use.

func NewProvider

func NewProvider() *Provider

NewProvider creates new provider for exportable RSA and ECDSA keys. This provider should be used only when HSM use is not applicable.

func (*Provider) ExportKey

func (p *Provider) ExportKey(keyID string) (string, []byte, error)

ExportKey returns PEM encoded plain text key

func (*Provider) GenerateECDSAKey

func (p *Provider) GenerateECDSAKey(label string, curve elliptic.Curve) (crypto.PrivateKey, error)

GenerateECDSAKey creates signer using randomly generated ECDSA key

func (*Provider) GenerateRSAKey

func (p *Provider) GenerateRSAKey(label string, bits int, purpose int) (crypto.PrivateKey, error)

GenerateRSAKey creates signer using randomly generated RSA key

func (*Provider) GetKey

func (p *Provider) GetKey(keyID string) (crypto.PrivateKey, error)

GetKey returns key for the given id

func (*Provider) IdentifyKey

func (p *Provider) IdentifyKey(priv crypto.PrivateKey) (keyID, label string, err error)

IdentifyKey returns key id and label for the given private key

func (*Provider) Manufacturer

func (p *Provider) Manufacturer() string

Manufacturer return manufacturer for the provider

func (*Provider) Model

func (p *Provider) Model() string

Model return model for the provider

func (*Provider) Serial

func (p *Provider) Serial() string

Serial return serial number for the provider

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL