composite

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AESCBCHMACAEADTypeURL for AESCBC+HMAC AEAD content encryption URL.
	AESCBCHMACAEADTypeURL = "type.hyperledger.org/hyperledger.aries.crypto.tink.AesCbcHmacAeadKey"
	// AESGCMTypeURL for AESGCM content encryption URL identifier.
	AESGCMTypeURL = "type.googleapis.com/google.crypto.tink.AesGcmKey"
	// ChaCha20Poly1305TypeURL for Chacha20Poly1305 content encryption URL identifier.
	ChaCha20Poly1305TypeURL = "type.googleapis.com/google.crypto.tink.ChaCha20Poly1305Key"
	// XChaCha20Poly1305TypeURL for XChachaPoly1305 content encryption URL identifier.
	XChaCha20Poly1305TypeURL = "type.googleapis.com/google.crypto.tink.XChaCha20Poly1305Key"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EncryptedData

type EncryptedData struct {
	Ciphertext []byte `json:"ciphertext,omitempty"`
	IV         []byte `json:"iv,omitempty"`
	Tag        []byte `json:"tag,omitempty"`
}

EncryptedData represents the Encryption's output data as a result of ECDHEncrypt.Encrypt(pt, aad) call The user of the primitive must unmarshal the result and build their own ECDH-ES/1PU compliant message (ie JWE msg).

type EncrypterHelper

type EncrypterHelper interface {
	// GetAEAD returns the newly created AEAD primitive used for the content Encryption
	GetAEAD(symmetricKeyValue []byte) (tink.AEAD, error)

	// GetTagSize provides the aead primitive tag size
	GetTagSize() int

	// GetIVSize provides the aead primitive nonce size
	GetIVSize() int

	// BuildEncData will build the []byte representing the ciphertext sent to the end user as a result of the Composite
	// Encryption primitive execution
	BuildEncData(ct []byte) ([]byte, error)

	// BuildDecData will build the []byte representing the ciphertext coming from encData struct returned as a result of
	// Composite Encrypt() call to prepare the Composite Decryption primitive execution
	BuildDecData(encData *EncryptedData) []byte
}

EncrypterHelper is a helper for Content Encryption of composite ECDH (ES/1PU) key wrapping + AEAD content encryption This interface is used internally by the composite primitives.

type RegisterCompositeAEADEncHelper

type RegisterCompositeAEADEncHelper struct {
	// contains filtered or unexported fields
}

RegisterCompositeAEADEncHelper registers a content encryption helper.

func NewRegisterCompositeAEADEncHelper

func NewRegisterCompositeAEADEncHelper(k *tinkpb.KeyTemplate) (*RegisterCompositeAEADEncHelper, error)

NewRegisterCompositeAEADEncHelper initializes and returns a RegisterCompositeAEADEncHelper.

func (*RegisterCompositeAEADEncHelper) BuildDecData

func (r *RegisterCompositeAEADEncHelper) BuildDecData(encData *EncryptedData) []byte

BuildDecData will build the []byte representing the ciphertext coming from encData struct returned as a result of Composite Encrypt() call to prepare the Composite Decryption primitive execution.

func (*RegisterCompositeAEADEncHelper) BuildEncData

func (r *RegisterCompositeAEADEncHelper) BuildEncData(ct []byte) ([]byte, error)

BuildEncData will build the []byte representing the ciphertext sent to the end user as a result of the Composite Encryption primitive execution.

func (*RegisterCompositeAEADEncHelper) GetAEAD

func (r *RegisterCompositeAEADEncHelper) GetAEAD(symmetricKeyValue []byte) (tink.AEAD, error)

GetAEAD returns the AEAD primitive from the DEM.

func (*RegisterCompositeAEADEncHelper) GetIVSize

func (r *RegisterCompositeAEADEncHelper) GetIVSize() int

GetIVSize returns the primitive IV size.

func (*RegisterCompositeAEADEncHelper) GetTagSize

func (r *RegisterCompositeAEADEncHelper) GetTagSize() int

GetTagSize returns the primitive tag size.

Directories

Path Synopsis
Package ecdh provides implementations of payload encryption using ECDH-ES/1PU KW key wrapping with AEAD primitives.
Package ecdh provides implementations of payload encryption using ECDH-ES/1PU KW key wrapping with AEAD primitives.

Jump to

Keyboard shortcuts

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