part

package
v0.28.20260101005913 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PriKeySuf string = ` PRIVATE KEY`
	PubKeySuf string = ` PUBLIC KEY`
	ErrType   error  = errors.New(`ErrType`)
)
View Source
var MlkemF pc.Asymmetric = Mlkem{}
View Source
var X25519F pc.Asymmetric = X25519{}

Functions

func ChoseAsymmetricByPem

func ChoseAsymmetricByPem(b *pem.Block) pc.Asymmetric

func Pack

func Pack(b, exchangeTxt []byte) (a []byte)

func Unpack

func Unpack(a []byte) (b, exchangeTxt []byte)

Types

type Mlkem

type Mlkem struct{}

func (Mlkem) CheckType

func (t Mlkem) CheckType(b *pem.Block) (ok bool, isPriKey bool)

func (Mlkem) Decrypt

func (t Mlkem) Decrypt(priKey *pem.Block) (dec pc.AsymmetricDec, e error)

func (Mlkem) Encrypt

func (t Mlkem) Encrypt(pubKey *pem.Block) (enc pc.AsymmetricEnc, e error)

func (Mlkem) GetType

func (t Mlkem) GetType() string

func (Mlkem) NewKey

func (t Mlkem) NewKey() (pri, pub *pem.Block, e error)

type X25519

type X25519 struct{}

func (X25519) CheckType

func (t X25519) CheckType(b *pem.Block) (ok bool, isPriKey bool)

CheckType implements part.Asymmetric.

func (X25519) Decrypt

func (t X25519) Decrypt(priKey *pem.Block) (dec pc.AsymmetricDec, e error)

func (X25519) Encrypt

func (t X25519) Encrypt(pubKey *pem.Block) (enc pc.AsymmetricEnc, e error)

func (X25519) GetType

func (t X25519) GetType() string

func (X25519) NewKey

func (t X25519) NewKey() (pri, pub *pem.Block, e error)