crypio

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

README

crypio

Encrypt and decrypt with io.Writer and io.Reader

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(w io.Writer, message io.Reader, privKey *rsa.PrivateKey) error

Decrypt decrypts the message into the io.Writer. The public key is used to decrypt the AES key of the io.Writer, which is stored at the first 256 bytes.

func DecryptKey

func DecryptKey(w io.Writer, cipher io.Reader, privKey *rsa.PrivateKey) error

DecryptKey takes a private key to decrypt a 256 byte long message.

func Encrypt

func Encrypt(w io.Writer, message io.Reader, pubKey *rsa.PublicKey) error

Encrypt takes a message of a io.Reader and enrypts the data and writes all into an io.Writer. The encryption of the data uses the symetric AES algorithm. The key therefore is generated inside that function. The key is also encrypted with the public key and stored at the beginning of the io.Writer.

func EncryptKey

func EncryptKey(w io.Writer, message io.Reader, pubKey *rsa.PublicKey) error

EncryptKey uses a public key and encrypts a text, out of a io.Reader The data here should be not bigger then 256 bytes. The output is written into an io.Writer. The output is always 256 bytes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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