symmetric

package
v1.1.0-alpha.5-proton Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeBindingHash

func ComputeBindingHash(seed [32]byte) []byte

Types

type AEADPrivateKey

type AEADPrivateKey struct {
	PublicKey AEADPublicKey
	HashSeed  [32]byte
	Key       []byte
}

func AEADGenerateKey

func AEADGenerateKey(rand io.Reader, cipher algorithm.CipherFunction) (priv *AEADPrivateKey, err error)

func (*AEADPrivateKey) Decrypt

func (priv *AEADPrivateKey) Decrypt(nonce []byte, ciphertext []byte, mode algorithm.AEADMode) (message []byte, err error)

type AEADPublicKey

type AEADPublicKey struct {
	Cipher      algorithm.CipherFunction
	BindingHash [32]byte
	Key         []byte
}

func (*AEADPublicKey) Encrypt

func (pub *AEADPublicKey) Encrypt(rand io.Reader, data []byte, mode algorithm.AEADMode) (nonce []byte, ciphertext []byte, err error)

type HMACPrivateKey

type HMACPrivateKey struct {
	PublicKey HMACPublicKey
	HashSeed  [32]byte
	Key       []byte
}

func HMACGenerateKey

func HMACGenerateKey(rand io.Reader, hash algorithm.Hash) (priv *HMACPrivateKey, err error)

func (*HMACPrivateKey) Public

func (priv *HMACPrivateKey) Public() crypto.PublicKey

func (*HMACPrivateKey) Sign

func (priv *HMACPrivateKey) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) (signature []byte, err error)

type HMACPublicKey

type HMACPublicKey struct {
	Hash        algorithm.Hash
	BindingHash [32]byte
	// While this is a "public" key, the symmetric key needs to be present here.
	// Symmetric cryptographic operations use the same key material for
	// signing and verifying, and go-crypto assumes that a public key type will
	// be used for verification. Thus, this `Key` field must never be exported
	// publicly.
	Key []byte
}

func (*HMACPublicKey) Verify

func (pub *HMACPublicKey) Verify(digest []byte, signature []byte) (bool, error)

Jump to

Keyboard shortcuts

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