serialization

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMaxEncryptedDataKeys = errors.New("maximum number of encrypted data keys")
	ErrMinEncryptedDataKeys = errors.New("minimum number of encrypted data keys is 1")
)
View Source
var AAD = aad{
	// contains filtered or unexported fields
}
View Source
var EDK = edk{
	ProviderID: awsKmsProviderID,
	LenFields:  edkLenFields,
}
View Source
var EncryptedMessageHeader emh //nolint:gochecknoglobals
View Source
var MessageBody messageBody //nolint:gochecknoglobals
View Source
var MessageFooter = messageFooter{
	// contains filtered or unexported fields
}
View Source
var MessageHeaderAuth mha //nolint:gochecknoglobals

Functions

func DeserializeBody

func DeserializeBody(buf *bytes.Buffer, algorithm *suite.AlgorithmSuite, frameLen int) (*body, error)

Types

type MessageHeader

type MessageHeader struct {
	// 											// 1, comes from AlgorithmSuite, message version, supported only version 2, always present as 0x02.
	AlgorithmSuite *suite.AlgorithmSuite // 2, AlgorithmID in AlgorithmSuite, supported only 0x0578 (1400) and 0x0478 (1144), always present. Reference (https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/algorithms-reference.html)
	MessageID      []byte                // 32, MessageID (random 256-bit value). Always present. Algorithm suites with key commitment (algorithm ID 04xx and 05xx) for the extract step (HKDF with SHA-512) used as salt.

	AADData               *aadData           // AADData is AAD Key-Value Pair (AADData) data (Key-Value Pair Count + []keyValuePair data). Bytes varies, aadLen = N bytes of AADData. present if aadLen > 0.
	EncryptedDataKeyCount int                // 2, EncryptedDataKeyCount is count of EncryptedDataKeys below, always present.
	EncryptedDataKeys     []encryptedDataKey // EncryptedDataKeys varies

	FrameLength        int    // 4, FrameLength is the length of each frame of framed data. It is a 4-byte value interpreted as a 32-bit unsigned integer that specifies the number of bytes in each frame. When the data is non-framed, that is, when the value of the contentType field is 0x01, this value must be 0.
	AlgorithmSuiteData []byte // 32 bytes, AlgorithmSuiteData
	// contains filtered or unexported fields
}

func DeserializeHeader

func DeserializeHeader(buf *bytes.Buffer, maxEncryptedDataKeys int) (*MessageHeader, *headerAuth, error)

func (MessageHeader) Bytes

func (mh MessageHeader) Bytes() []byte

func (MessageHeader) Len

func (mh MessageHeader) Len() int

func (MessageHeader) String

func (mh MessageHeader) String() string

type MessageHeaderParams

type MessageHeaderParams struct {
	AlgorithmSuite     *suite.AlgorithmSuite
	MessageID          []byte
	AADData            *aadData
	EncryptedDataKeys  []encryptedDataKey
	ContentType        suite.ContentType
	FrameLength        int
	AlgorithmSuiteData []byte
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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