secure

package
v0.0.0-...-fe3d7fc Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeMessage

func DecodeMessage(msg string, key []byte) (string, error)

DecodeMessage decodes the given message by separating out the token and comparing it with the derived token, returning an error if the message was invalid

func SignMessage

func SignMessage(msg string, key []byte) string

SignMessage signs the given message using hmac and appends it to the given message

Types

type AesCrypto

type AesCrypto struct {
	// contains filtered or unexported fields
}

AesCrypto is an AES implementation of a Crypto with key size of 256 bits

func InitAesCrypto

func InitAesCrypto(pwd string) (*AesCrypto, error)

InitAesCrypto initializes an AesCrypto

func (*AesCrypto) Decrypt

func (c *AesCrypto) Decrypt(enc []byte) (*creds.Crypt, error)

Decrypt decrypts the given Crypt using AES

func (*AesCrypto) Encrypt

func (c *AesCrypto) Encrypt(crypt *creds.Crypt) ([]byte, error)

Encrypt encrypts the given Crypt using AES

type Crypto

type Crypto interface {
	Encrypt(crypt *creds.Crypt) ([]byte, error)
	Decrypt(cipher []byte) (*creds.Crypt, error)
}

Crypto defines a simple interface for any struct that can encrypt and decrypt crypt data.

Jump to

Keyboard shortcuts

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