wrappingkey

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Wrapper

type Wrapper interface {
	SerializeEncryptedDataKey(encryptedKey, tag, iv []byte) []byte
	DeserializeEncryptedDataKey(b []byte, iVLen int) (encryptedData, iv []byte)
}

type WrappingKey

type WrappingKey struct{}

func (WrappingKey) DeserializeEncryptedDataKey

func (wk WrappingKey) DeserializeEncryptedDataKey(b []byte, iVLen int) (encryptedData, iv []byte)

DeserializeEncryptedDataKey reverses the process of SerializeEncryptedDataKey. It takes a single byte slice containing the serialized encrypted data key, tag, and IV and extracts the original components. This is typically used to retrieve the encrypted key and IV for decryption purposes.

Parameters:

b      []byte: A byte slice that contains the serialized encrypted data key,
                authentication tag, and IV.
iVLen  int:    The length of the IV, which dictates how many bytes to extract
                from the end of the byte slice for the IV.

Returns:

encryptedData []byte: The portion of the byte slice 'b' that represents the
                      encrypted data key (and potentially the authentication
                      tag if it is included with the encrypted data).
iv            []byte: The extracted initialization vector that was originally
                      used for encryption.

func (WrappingKey) SerializeEncryptedDataKey

func (wk WrappingKey) SerializeEncryptedDataKey(encryptedKey, tag, iv []byte) []byte

SerializeEncryptedDataKey takes three separate byte slices that represent the encrypted key, the authentication tag, and the initialization vector (IV), and concatenates them into a single byte slice.

Parameters:

encryptedKey []byte: A byte slice representing the encrypted data key.
tag          []byte: A byte slice representing the authentication tag
                     used to verify the integrity of the encrypted data.
iv           []byte: A byte slice representing the initialization vector
                     used during the encryption process.

Returns:

[]byte: A concatenated byte slice that includes the encrypted key, followed
        by the authentication tag, and ending with the IV.

Jump to

Keyboard shortcuts

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