key

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator[T types.DataType] interface {
	KeyGen(alg types.Algorithm, opts ...Option[T]) (Key[T], error)
}

Generator is an interface that represents a cryptographic key generator. It provides a method for generating a key based on a given algorithm.

type Importer

type Importer[T types.DataType] interface {
	KeyImport(raw interface{}, alg types.Algorithm, opts ...Option[T]) (Key[T], error)
}

Importer is an interface that represents a cryptographic key importer. It provides a method for importing a key based on a given raw data and algorithm.

type Key

type Key[T types.DataType] interface {
	Algorithm() types.Algorithm
	Export() (key T, err error)
	SKI() T
	PublicKey() (Key[T], error)
	Sign(msg T) (signature T, err error)
	Verify(msg, signature T) (bool, error)
	Encrypt(plaintext T) (ciphertext T, err error)
	Decrypt(ciphertext T) (plaintext T, err error)
}

Key is an interface that represents a cryptographic key. It provides methods for getting the algorithm type, byte representation, subject key identifier (SKI), public key, signing, verifying, encrypting, and decrypting.

type Option added in v0.1.2

type Option[T types.DataType] func(Key[T]) error

Option is a function type that represents an option for a key.

Jump to

Keyboard shortcuts

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