crypt

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Crypt

type Crypt interface {
	Init() error
	Sign(raw string) (string, error)
	Verify(plaintext, sign string) error
}

type Ed25519 added in v0.3.6

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

func NewEd25519 added in v0.3.6

func NewEd25519(opts ...Ed25519Option) *Ed25519

func (*Ed25519) Init added in v0.3.6

func (e *Ed25519) Init() error

func (*Ed25519) LoadPrivateKey added in v0.3.6

func (e *Ed25519) LoadPrivateKey() (*ed25519.PrivateKey, error)

func (*Ed25519) LoadPublicKey added in v0.3.6

func (e *Ed25519) LoadPublicKey() (*ed25519.PublicKey, error)

func (*Ed25519) Provide added in v0.3.6

func (e *Ed25519) Provide(ctx context.Context) interface{}

func (*Ed25519) Sign added in v0.3.6

func (e *Ed25519) Sign(raw string) (string, error)

func (*Ed25519) Verify added in v0.3.6

func (e *Ed25519) Verify(plaintext, sign string) error

type Ed25519Option added in v0.3.6

type Ed25519Option func(*Ed25519Options)

func WithEd25519PrivateKey added in v0.3.6

func WithEd25519PrivateKey(privateKey string) Ed25519Option

func WithEd25519PrivateKeyFile added in v0.3.6

func WithEd25519PrivateKeyFile(privateKeyFile string) Ed25519Option

func WithEd25519PublicKey added in v0.3.6

func WithEd25519PublicKey(publicKey string) Ed25519Option

func WithEd25519PublicKeyFile added in v0.3.6

func WithEd25519PublicKeyFile(publicKeyFile string) Ed25519Option

type Ed25519Options added in v0.3.6

type Ed25519Options struct {
	PrivateKey     string
	PrivateKeyFile string
	PublicKey      string
	PublicKeyFile  string
}

type Rsa

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

func NewRsa

func NewRsa(opts ...RsaOption) *Rsa

func (*Rsa) Init

func (r *Rsa) Init() error

func (*Rsa) LoadPrivateKey

func (r *Rsa) LoadPrivateKey() (*rsa.PrivateKey, error)

func (*Rsa) LoadPublicKey

func (r *Rsa) LoadPublicKey() (*rsa.PublicKey, error)

func (*Rsa) Provide

func (r *Rsa) Provide(ctx context.Context) interface{}

func (*Rsa) Sign

func (r *Rsa) Sign(raw string) (string, error)

func (*Rsa) Verify

func (r *Rsa) Verify(plaintext, sign string) error

type RsaOption

type RsaOption func(*RsaOptions)

func WithPrivateKey

func WithPrivateKey(privateKey string) RsaOption

func WithPrivateKeyFile

func WithPrivateKeyFile(privateKeyFile string) RsaOption

func WithPublicKey

func WithPublicKey(publicKey string) RsaOption

func WithPublicKeyFile

func WithPublicKeyFile(publicKeyFile string) RsaOption

type RsaOptions

type RsaOptions struct {
	PublicKey      string
	PublicKeyFile  string
	PrivateKey     string
	PrivateKeyFile string
}

Jump to

Keyboard shortcuts

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