crypto

package
v1.2.16 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckHMAC

func CheckHMAC(message, messageMAC, key []byte) (bool, error)

CheckHMAC reports whether messageMAC is a valid HMAC tag for message.

func CreateHMAC

func CreateHMAC(message, key []byte) ([]byte, error)

CreateHMAC takes a message and a key and returns HMAC of the message.

func CreateIK

func CreateIK(userKey, iv []byte) ([]byte, error)

CreateIK generates 32 bytes Intermediate Key, given userKey and initialization vector. This would be used as key in AES-256 CBC encryption.

func Decrypt

func Decrypt(ciphertext, key []byte) ([]byte, error)

Decrypt returns a plaintext by decrypting a AES-256 CBC encrypted ciphertext using the given key .

func Encrypt

func Encrypt(plaintext, key []byte) ([]byte, error)

Encrypt returns a cipher text by encrypting plaintext with the given key using AES-256 CBC encryption.

func GenerateIV

func GenerateIV() ([]byte, error)

GenerateIV generates 32 bytes Initialization Vector.

func GenerateRandomBytes

func GenerateRandomBytes(n int) ([]byte, error)

GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GenerateUserKey

func GenerateUserKey() ([]byte, error)

GenerateUserKey generates 32 bytes User Key.

func GenerateVMK

func GenerateVMK() ([]byte, error)

GenerateVMK generates 64 bytes Volume Master Key.

Types

This section is empty.

Jump to

Keyboard shortcuts

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