bmailcrypt

package
v0.0.0-...-64eff32 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: GPL-2.0 Imports: 15 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EConvertCurvePubKey = fmt.Errorf("convert ed25519 public key to curve25519 public key failed")
)
View Source
var KP = struct {
	S int
	N int
	R int
	P int
	L int
}{
	S: 8,
	N: 1 << 15,
	R: 8,
	P: 1,
	L: 32,
}

Functions

func Decrypt

func Decrypt(key []byte, cipherTxt []byte) ([]byte, error)

func DecryptAndIV

func DecryptAndIV(key []byte, cipherTxt []byte) (iv, plainTxt []byte, err error)

func DeriveKey

func DeriveKey(seed []byte) (pub ed25519.PublicKey, priv ed25519.PrivateKey)

func Encrypt

func Encrypt(key []byte, plainTxt []byte) ([]byte, error)

func EncryptWithIV

func EncryptWithIV(key, iv, plainTxt []byte) ([]byte, error)

func GenEd25519KeyAndSave

func GenEd25519KeyAndSave(password string) error

func GenerateAesKey

func GenerateAesKey(peerPub []byte, key ed25519.PrivateKey) ([]byte, error)

func KeyIsGenerated

func KeyIsGenerated() bool

func LoadKey

func LoadKey(password string)

func PrivateKeyToCurve25519

func PrivateKeyToCurve25519(curve25519Private *[32]byte, privateKey *[64]byte)

func PublicKeyToCurve25519

func PublicKeyToCurve25519(curve25519Public *[32]byte, publicKey *[32]byte) bool

func Sign

func Sign(priv ed25519.PrivateKey, message []byte) []byte

func Verify

func Verify(pub ed25519.PublicKey, message, sig []byte) bool

Types

type KeyJson

type KeyJson struct {
	PubKey    string `json:"pub_key"`
	CipherKey string `json:"cipher_key"`
}

Jump to

Keyboard shortcuts

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