crypto

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeValue

func DecodeValue(s string) ([]byte, error)

DecodeValue decodes a base64 encoded string into a byte slice.

func DecryptValue

func DecryptValue(encryptionKey string, text string) (string, error)

DecryptValue decrypts a string using AES-256 and returns the decrypted value as a base64 encoded string. The master key used for decryption must be a base64 encoded string.

func DeriveKey

func DeriveKey(password, salt []byte) (string, string, error)

DeriveKey derives a 32 byte key from the provided password and salt and returns the key and salt as base64 encoded strings. If salt is nil, a random salt will be generated.

func EncodeValue

func EncodeValue(b []byte) string

EncodeValue encodes a byte slice as a base64 encoded string.

func EncryptValue

func EncryptValue(encryptionKey string, text string) (string, error)

EncryptValue encrypts a string using AES-256 and returns the encrypted value as a base64 encoded string. The encryption key used for encryption must be a base64 encoded string.

func GenerateKey

func GenerateKey() (string, error)

GenerateKey generates a random 32 byte key and returns it as a base64 encoded string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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