security

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: BSD-3-Clause-Clear Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCertNotFound        = Error("not found")
	ErrCertificateEncode   = Error("certificate encode error")
	ErrPublicKeyMarshal    = Error("public key marshal error")
	ErrHSMUnexpected       = Error("hsm unexpected")
	ErrHSMDecrypt          = Error("hsm decrypt error")
	ErrHSMNotFound         = Error("hsm unavailable")
	ErrKeyConfig           = Error("key configuration error")
	ErrUnknownHashFunction = Error("unknown hash function")
)

Variables

This section is empty.

Functions

func ConvertEphemeralPublicKeyBytesToECDSAPublicKey added in v0.4.4

func ConvertEphemeralPublicKeyBytesToECDSAPublicKey(ephemeralPublicKeyBytes []byte) (*ecdsa.PublicKey, error)

Types

type Config

type Config struct {
	Type string `yaml:"type" default:"standard"`
	// StandardConfig is the configuration for the standard key provider
	StandardConfig StandardConfig `yaml:"standard,omitempty" mapstructure:"standard"`
}

type CryptoProvider

type CryptoProvider interface {
	RSAPublicKey(keyID string) (string, error)
	RSAPublicKeyAsJSON(keyID string) (string, error)
	RSADecrypt(hash crypto.Hash, keyID string, keyLabel string, ciphertext []byte) ([]byte, error)

	ECPublicKey(keyID string) (string, error)
	ECCertificate(keyID string) (string, error)
	GenerateNanoTDFSymmetricKey(ephemeralPublicKeyBytes []byte) ([]byte, error)
	GenerateEphemeralKasKeys() (any, []byte, error)
	GenerateNanoTDFSessionKey(privateKeyHandle any, ephemeralPublicKey []byte) ([]byte, error)
	Close()
}

func NewCryptoProvider

func NewCryptoProvider(cfg Config) (CryptoProvider, error)

type Error

type Error string

func (Error) Error

func (e Error) Error() string

type StandardConfig

type StandardConfig struct {
	RSAKeys map[string]StandardKeyInfo `yaml:"rsa,omitempty" mapstructure:"rsa"`
	ECKeys  map[string]StandardKeyInfo `yaml:"ec,omitempty" mapstructure:"ec"`
}

type StandardCrypto

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

func NewStandardCrypto

func NewStandardCrypto(cfg StandardConfig) (*StandardCrypto, error)

NewStandardCrypto Create a new instance of standard crypto

func (StandardCrypto) Close

func (s StandardCrypto) Close()

func (StandardCrypto) ECCertificate added in v0.4.4

func (s StandardCrypto) ECCertificate(identifier string) (string, error)

func (StandardCrypto) ECPublicKey

func (s StandardCrypto) ECPublicKey(identifier string) (string, error)

func (StandardCrypto) GenerateEphemeralKasKeys

func (s StandardCrypto) GenerateEphemeralKasKeys() (any, []byte, error)

func (StandardCrypto) GenerateNanoTDFSessionKey

func (s StandardCrypto) GenerateNanoTDFSessionKey(privateKey any, ephemeralPublicKeyPEM []byte) ([]byte, error)

func (StandardCrypto) GenerateNanoTDFSymmetricKey

func (s StandardCrypto) GenerateNanoTDFSymmetricKey(ephemeralPublicKeyBytes []byte) ([]byte, error)

func (StandardCrypto) RSADecrypt

func (s StandardCrypto) RSADecrypt(_ crypto.Hash, keyID string, _ string, ciphertext []byte) ([]byte, error)

func (StandardCrypto) RSAPublicKey

func (s StandardCrypto) RSAPublicKey(keyID string) (string, error)

func (StandardCrypto) RSAPublicKeyAsJSON

func (s StandardCrypto) RSAPublicKeyAsJSON(keyID string) (string, error)

type StandardECCrypto

type StandardECCrypto struct {
	Identifier string
	// contains filtered or unexported fields
}

type StandardKeyInfo

type StandardKeyInfo struct {
	PrivateKeyPath string `yaml:"private_key_path" mapstructure:"private_key_path"`
	PublicKeyPath  string `yaml:"public_key_path" mapstructure:"public_key_path"`
}

type StandardRSACrypto

type StandardRSACrypto struct {
	Identifier string
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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