enscrypto

package module
v0.0.0-...-41c525b Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: MIT Imports: 12 Imported by: 0

README

crypto

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeKeyPair

func DecodeKeyPair(pwd string, privKey []byte, pubKey []byte) (PrivateKey, PublicKey, error)

GenerateKeyPair will generate key pair based on the configuration

func GenerateKeyPair

func GenerateKeyPair(cfg *CryptoConfig) ([]byte, []byte, error)

GenerateKeyPair will generate key pair based on the configuration

func GetRandBytes

func GetRandBytes(reader io.Reader, n int) ([]byte, error)

GetRandBytes will generate rand bytes

func Seal

func Seal(key string, data []byte) ([]byte, error)

Seal will seal data using the AES-GCM

func Sign

func Sign(priv PrivateKey, data []byte) ([]byte, error)

func UnSeal

func UnSeal(key string, data []byte) ([]byte, error)

UnSeal will open data using the AES-GCM

func Verify

func Verify(pub PublicKey, data []byte, sig []byte) bool

Types

type CryptoAlgType

type CryptoAlgType int

CryptoAlgType is algorithm type

const (
	RSA2048 CryptoAlgType = iota
	ECDSAP256
)

type CryptoConfig

type CryptoConfig struct {
	Alg CryptoAlgType
	Pwd string
}

CryptoConfig is configuration for the crypto

type PrivateKey

type PrivateKey interface{}

PrivateKey represents a private key using an unspecified algorithm.

type PublicKey

type PublicKey interface{}

PublicKey represents a public key using an unspecified algorithm.

Jump to

Keyboard shortcuts

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