crypt

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 16 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 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