key

package
v1.24.26 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: Unlicense Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidKind for key.
	ErrInvalidKind = errors.New("invalid kind")
)

Module for fx.

Functions

func NewEd25519PrivateKey added in v1.22.0

func NewEd25519PrivateKey(cfg *Config) (ed25519.PrivateKey, error)

NewEd25519PrivateKey from key.

func NewEd25519PublicKey added in v1.22.0

func NewEd25519PublicKey(cfg *Config) (ed25519.PublicKey, error)

NewEd25519PublicKey from key.

func NewRSAPrivateKey added in v1.22.0

func NewRSAPrivateKey(cfg *Config) (*rsa.PrivateKey, error)

NewRSAPrivateKey from key.

func NewRSAPublicKey added in v1.22.0

func NewRSAPublicKey(cfg *Config) (*rsa.PublicKey, error)

NewRSAPublicKey from key.

Types

type Config added in v1.22.0

type Config struct {
	RSA     Pair `yaml:"rsa" json:"rsa" toml:"rsa"`
	Ed25519 Pair `yaml:"ed25519" json:"ed25519" toml:"ed25519"`
}

Config for key.

func (*Config) Pair added in v1.22.0

func (c *Config) Pair(kind string) *Pair

Pair from kind.

type Ed25519 added in v1.10.3

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

Ed25519 cypher.

func NewEd25519 added in v1.10.3

func NewEd25519(privateKey ed25519.PrivateKey) *Ed25519

NewEd25519 cypher.

func (*Ed25519) Generate added in v1.10.3

func (e *Ed25519) Generate() (string, string, error)

Generate key pair with Ed25519.

type Generator added in v1.10.3

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

Generator of key pairs.

func NewGenerator added in v1.10.3

func NewGenerator(rsa *RSA, ed2551 *Ed25519) *Generator

NewGenerator of key pairs.

func (*Generator) Generate added in v1.10.3

func (g *Generator) Generate(kind string) (string, string, error)

Generate key pair based on kind.

type Pair added in v1.22.0

type Pair struct {
	Public  string `yaml:"public"`
	Private string `yaml:"private"`
}

Pair for key.

type RSA added in v1.10.3

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

RSA cypher.

func NewRSA added in v1.10.3

func NewRSA(publicKey *rsa.PublicKey, privateKey *rsa.PrivateKey) *RSA

NewRSA cypher.

func (*RSA) Decrypt added in v1.10.3

func (r *RSA) Decrypt(ctx context.Context, cipher string) (string, error)

Decrypt with RSA OAEP.

func (*RSA) Encrypt added in v1.10.3

func (r *RSA) Encrypt(ctx context.Context, msg string) (string, error)

Encrypt with RSA OAEP.

func (*RSA) Generate added in v1.10.3

func (r *RSA) Generate() (string, string, error)

Generate key pair with RSA.

Jump to

Keyboard shortcuts

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