crypto

package
v0.0.0-...-7750264 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password string, hash []byte) error

CheckPasswordHash accepts a bcrypt salted hash and plaintext password. It verifies the password against the salted hash

func Decrypt

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

Decrypt - Decrypt a token based on an encryption key The approach used here is based on the following direction on how to AES encrypt/decrypt our secret information, in this case tokens (normal, refresh and OAuth tokens). Source: https://github.com/giorgisio/examples/blob/master/aes-encrypt/main.go

func DecryptToken

func DecryptToken(key, t []byte) (string, error)

DecryptToken - Decrypt a token

func Encrypt

func Encrypt(key, text []byte) (ciphertext []byte, err error)

Encrypt - Encrypt a token based on an encryption key The approach used here is based on the following direction on how to AES encrypt/decrypt our secret information, in this case tokens (normal, refresh and OAuth tokens). Source: https://github.com/giorgisio/examples/blob/master/aes-encrypt/main.go

func EncryptToken

func EncryptToken(key []byte, t string) ([]byte, error)

EncryptToken - Encrypt a token being

func GenerateRandomBytes

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

See: https://github.com/gorilla/csrf/blob/a8abe8abf66db8f4a9750d76ba95b4021a354757/helpers.go generateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly.

func HashPassword

func HashPassword(password string) ([]byte, error)

HashPassword accepts a plaintext password string and generates a salted hash

func ReadEncryptionKey

func ReadEncryptionKey(v, f string) ([]byte, error)

ReadEncryptionKey - Read the encryption key from the shared volume

Types

This section is empty.

Jump to

Keyboard shortcuts

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