rsa

package
v1.202.3 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Options(
	fx.Provide(NewAlgo),
)

Module for fx.

Functions

func Generate

func Generate() (PublicKey, PrivateKey, error)

Generate key pair with RSA.

func IsEnabled

func IsEnabled(cfg *Config) bool

IsEnabled for rsa.

Types

type Algo

type Algo interface {
	// Encrypt msg.
	Encrypt(msg string) (string, error)

	// Decrypt msg.
	Decrypt(msg string) (string, error)
}

Algo for rsa.

func NewAlgo

func NewAlgo(cfg *Config) (Algo, error)

NewAlgo for rsa.

type Config

type Config struct {
	Public  PublicKey  `yaml:"public,omitempty" json:"public,omitempty" toml:"public,omitempty"`
	Private PrivateKey `yaml:"private,omitempty" json:"private,omitempty" toml:"private,omitempty"`
}

Config for rsa.

func (*Config) GetPrivate

func (c *Config) GetPrivate() (string, error)

GetPrivate for rsa.

func (*Config) GetPublic added in v1.193.0

func (c *Config) GetPublic() (string, error)

GetPublic for rsa.

type PrivateKey added in v1.189.0

type PrivateKey string

PrivateKey for rsa.

type PublicKey added in v1.189.0

type PublicKey string

PublicKey for rsa.

Jump to

Keyboard shortcuts

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