crypto

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const PrivateKeySize = curve25519.ScalarSize
View Source
const PublicKeySize = curve25519.PointSize

Variables

This section is empty.

Functions

func DecryptStream

func DecryptStream(input io.Reader, output io.Writer, privateKey PrivateKey) error

func DeriveEncryptionKey

func DeriveEncryptionKey(privateKy PrivateKey, publicKey PublicKey) (encryptionKey []byte, err error)

DeriveEncryptionKey derives a "shared key" from two key pair (Private and Public key from different party). Each of those combination will be able to derive the same "shared key" suitable for encryption (e.g. AES) The return value should be a 32-byte (256-bit) key.

func EncryptStream

func EncryptStream(input io.Reader, output io.Writer, publicKey PublicKey) error

EncryptStream encrypts a given stream with ECC key (curve25519 public key) and AES.

func GenKeyPair

func GenKeyPair() (privateKey PrivateKey, publicKey PublicKey, err error)

GenKeyPair generates a pair of keys that is suitable for

Types

type PrivateKey

type PrivateKey = []byte

func GenPrivateKey

func GenPrivateKey() (privateKey PrivateKey, err error)

GenPrivateKey generates a private key.

type PublicKey

type PublicKey = []byte

func GetPublicKey

func GetPublicKey(privateKey PrivateKey) (publicKey PublicKey, err error)

Jump to

Keyboard shortcuts

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