pkcs8

package
v0.0.6-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewKeyStore

func NewKeyStore(params *Params) (keystore.KeyStorer, error)

PKCS #8 Key Store Module. This module saves keys to the the provided backend in PKCS #8 form.

func NewSignerECDSA

func NewSignerECDSA(
	keyStore keystore.KeyStorer,
	signerStore keystore.SignerStorer,
	keyAttributes *keystore.KeyAttributes,
	publicKey crypto.PublicKey) crypto.Signer

Signer that uses the Elliptical Curve Cryptography Digital Signature Algorithm (ECDSA).

Signs the requested data using the Certificate Authority Private Key, or, optionally, the private key provided via SignerOpts during the call to Sign.

func NewSignerEd25519

func NewSignerEd25519(
	keyStore keystore.KeyStorer,
	signerStore keystore.SignerStorer,
	keyAttributes *keystore.KeyAttributes,
	publicKey crypto.PublicKey) crypto.Signer

Signer that uses the Elliptical Curve Cryptography Digital Signature Algorithm (Ed25519).

Signs the requested data using the Certificate Authority Private Key, or, optionally, the private key provided via SignerOpts during the call to Sign.

func NewSignerRSA

func NewSignerRSA(
	keyStore keystore.KeyStorer,
	signerStore keystore.SignerStorer,
	keyAttributes *keystore.KeyAttributes,
	publicKey crypto.PublicKey) crypto.Signer

Types

type Config

type Config struct {
	CN             string `yaml:"cn" json:"cn" mapstructure:"cn"`
	PlatformPolicy bool   `yaml:"platform-policy" json:"platform_policy" mapstructure:"platform-policy"`
}

type KeyStore

type KeyStore struct {
	keystore.KeyStorer
	// contains filtered or unexported fields
}

func (*KeyStore) Backend

func (ks *KeyStore) Backend() keystore.KeyBackend

Returns the key store backend

func (*KeyStore) Close

func (ks *KeyStore) Close() error

No-op method that implements keystore.KeyStorer

func (*KeyStore) Decrypter

func (ks *KeyStore) Decrypter(attrs *keystore.KeyAttributes) (crypto.Decrypter, error)

Returns a PKCS #8 crypto.Decrypter from the dedicated encryption keys partition.

func (*KeyStore) Delete

func (ks *KeyStore) Delete(attrs *keystore.KeyAttributes) error

Deletes a key pair from the key store

func (*KeyStore) Equal

func (ks *KeyStore) Equal(opaque keystore.OpaqueKey, x crypto.PrivateKey) bool

Compares an opaque key with the provided key This is the PKCA #8 key store. implementation for the opaque key's crypto.PrivateKey implementation https://pkg.go.dev/crypto#PrivateKey

func (*KeyStore) GenerateECDSA

func (ks *KeyStore) GenerateECDSA(attrs *keystore.KeyAttributes) (keystore.OpaqueKey, error)

Generates a new ECDSA private key and return and OpaqueKey implementing crypto.Signer

func (*KeyStore) GenerateEd25519

func (ks *KeyStore) GenerateEd25519(attrs *keystore.KeyAttributes) (keystore.OpaqueKey, error)

Generates a new Ed25519 private key and return and OpaqueKey implementing crypto.Signer

func (*KeyStore) GenerateKey

func (ks *KeyStore) GenerateKey(attrs *keystore.KeyAttributes) (keystore.OpaqueKey, error)

Generate new private key using the provided key attributes and return an OpaqueKey implementing crypto.Signer

func (*KeyStore) GenerateRSA

func (ks *KeyStore) GenerateRSA(attrs *keystore.KeyAttributes) (keystore.OpaqueKey, error)

Generate new RSA private key and return an OpaqueKey implementing crypto.Signer

func (*KeyStore) GenerateSecretKey

func (ks *KeyStore) GenerateSecretKey(
	attrs *keystore.KeyAttributes) error

Generates a new AES-256 32 byte secret key

func (*KeyStore) Initialize

func (ks *KeyStore) Initialize(soPIN, userPIN keystore.Password) error

No-op method that implements keystore.KeyStorer

func (*KeyStore) Key

Returns a private key RSA key backed by this PKCS #8 key store. for signing and decryption operations

func (*KeyStore) PrivateKey

func (ks *KeyStore) PrivateKey(attrs *keystore.KeyAttributes) (crypto.Signer, error)

Returns a private key RSA key backed by this PKCS #8 key store. for signing and decryption operations

func (*KeyStore) RotateKey

func (ks *KeyStore) RotateKey(attrs *keystore.KeyAttributes) (keystore.OpaqueKey, error)

Rotates an existing key by generating a new key pair and overwriting the existing key. This is a destructive operation that will cause the existing key pair to be irrecoverable.

func (*KeyStore) Signer

func (ks *KeyStore) Signer(attrs *keystore.KeyAttributes) (crypto.Signer, error)

Returns a PKCS #8 crypto.Signer based on the provided key attributes

func (*KeyStore) Type

func (ks *KeyStore) Type() keystore.StoreType

Returns the key store type as a string

func (*KeyStore) Verifier

func (ks *KeyStore) Verifier(
	attrs *keystore.KeyAttributes,
	opts *keystore.VerifyOpts) keystore.Verifier

Returns a custom PKCS #8 verifier

type Params

type Params struct {
	Config       *Config
	DebugSecrets bool
	Logger       *logging.Logger
	Random       io.Reader
	Backend      keystore.KeyBackend
	SignerStore  keystore.SignerStorer
	BlobStore    blobstore.BlobStorer
	TPMKS        tpmks.PlatformKeyStorer
}

type SignerECDSA

type SignerECDSA struct {
	crypto.Signer
	// contains filtered or unexported fields
}

func (SignerECDSA) Public

func (signer SignerECDSA) Public() crypto.PublicKey

Returns the public half of the signing key

func (SignerECDSA) Sign

func (signer SignerECDSA) Sign(
	rand io.Reader,
	digest []byte,
	opts crypto.SignerOpts) (signature []byte, err error)

Signs the requested digest using the PKCS #8 private key

type SignerEd25519

type SignerEd25519 struct {
	crypto.Signer
	// contains filtered or unexported fields
}

func (SignerEd25519) Public

func (signer SignerEd25519) Public() crypto.PublicKey

Returns the public half of the signing key

func (SignerEd25519) Sign

func (signer SignerEd25519) Sign(
	rand io.Reader,
	digest []byte,
	opts crypto.SignerOpts) (signature []byte, err error)

Signs the requested digest using the PKCS #8 private key

type SignerRSA

type SignerRSA struct {
	crypto.Signer
	// contains filtered or unexported fields
}

func (SignerRSA) Public

func (signer SignerRSA) Public() crypto.PublicKey

Returns the public half of the signing key implements crypto.Signer

func (SignerRSA) Sign

func (signer SignerRSA) Sign(
	rand io.Reader,
	digest []byte,
	opts crypto.SignerOpts) (signature []byte, err error)

Signs the requested digest using underlying key store implements crypto.Signer

Jump to

Keyboard shortcuts

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