package symmetric

import "github.com/ProtonMail/go-crypto/openpgp/symmetric"

Index

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)

Source Files

aead.go hmac.go

Version
v1.1.3-proton.2
Published
Dec 5, 2024
Platform
windows/amd64
Imports
6 packages
Last checked
3 hours ago

Tools for package owners.