encryption

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(cfg key.Config, cipherText []byte) (string, error)

Encrypt the given string according to the encryption config.

Types

type EncryptedData

type EncryptedData struct {
	// Encrypted data.
	Encrypted []byte
	// Generated encryption key.
	Key key.GeneratedKey
}

Data returned from an encryption operation.

func Encrypt

func Encrypt(cfg key.Config, message string) (EncryptedData, error)

Encrypt the given string according to the encryption config.

type HmacData

type HmacData struct {
	// Base64 encoded HMAC.
	Digest string
	// The key's salt.
	Salt string
}

Data returned from a HMAC operation.

func HmacWithPassword

func HmacWithPassword(cfg key.Config, message string) (HmacData, error)

Generate a HMAC digest for the given message.

type SealBuilder

type SealBuilder struct {
	Id         string
	Salt       string
	IV         string
	B64        string
	Expiration int64
	// contains filtered or unexported fields
}

Builder for creating and parsing seals.

func (SealBuilder) Build

func (sb SealBuilder) Build(keyCfg key.Config) (string, error)

Build a new seal.

func (*SealBuilder) GetHmacSalt

func (sb *SealBuilder) GetHmacSalt() string

Retrieve the stored HMAC salt.

func (*SealBuilder) Parse

func (sb *SealBuilder) Parse(sealed string, now int64, timestampSkewSec int) error

func (SealBuilder) Verify

func (sb SealBuilder) Verify(keyCfg key.Config) error

Verify a seal.

Jump to

Keyboard shortcuts

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