crypt

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AES256GCM specifies the cipher suite AES-GCM with 256 bit keys.
	AES256GCM byte = iota
	// CHACHA20POLY1305 specifies the cipher suite ChaCha20Poly1305 with 256 bit keys.
	CHACHA20POLY1305
)

Variables

This section is empty.

Functions

func PrintKeyPair

func PrintKeyPair(bits int)

PrintKeyPair in gob encoding

Types

type Config

type Config struct {
	HashFunc     func() hash.Hash
	Random       io.Reader
	CipherSuites []byte
}

Config contains configurations of crypt

type Decrypter

type Decrypter struct {
	PrivateKey *rsa.PrivateKey
	Config     *Config
}

Decrypter can decrypt data with RSA private key

func NewDecrypter

func NewDecrypter(privateKey []byte, config *Config) (*Decrypter, error)

NewDecrypter create a new decrypter

func (*Decrypter) DecryptData

func (dec *Decrypter) DecryptData(dataReader io.Reader) (*bytes.Buffer, error)

DecryptData will decrypt data from certain data format

type Encrypter

type Encrypter struct {
	PublicKey *rsa.PublicKey
	Config    *Config
}

Encrypter can encrypt data with RSA public key

func NewEncrypter

func NewEncrypter(publicKey []byte, config *Config) (*Encrypter, error)

NewEncrypter create a new encrypter

func (*Encrypter) EncryptData

func (enc *Encrypter) EncryptData(dataReader io.Reader) (*bytes.Buffer, error)

EncryptData will Encrypt data from certain data format

Jump to

Keyboard shortcuts

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