dhutil

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2019 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptAES

func DecryptAES(key, ciphertext, nonce, aad []byte) ([]byte, error)

Use AES256-GCM to decrypt some ciphertext with a provided key and nonce. The returned values are the plaintext and error respectively.

func EncryptAES

func EncryptAES(key, plaintext, aad []byte) ([]byte, []byte, error)

Use AES256-GCM to encrypt some plaintext with a provided key. The returned values are the ciphertext, the nonce, and error respectively.

func GeneratePublicPrivateKey

func GeneratePublicPrivateKey() ([]byte, []byte, error)

generatePublicPrivateKey uses curve25519 to generate a public and private key pair.

func GenerateSharedKey

func GenerateSharedKey(ourPrivate, theirPublic []byte) ([]byte, error)

generateSharedKey uses the private key and the other party's public key to generate the shared secret.

Types

type Envelope

type Envelope struct {
	Curve25519PublicKey []byte `json:"curve25519_public_key"`
	Nonce               []byte `json:"nonce"`
	EncryptedPayload    []byte `json:"encrypted_payload"`
}

type PublicKeyInfo

type PublicKeyInfo struct {
	Curve25519PublicKey []byte `json:"curve25519_public_key"`
}

Jump to

Keyboard shortcuts

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