crypto

package module
v0.0.0-...-68228b3 Latest Latest
Warning

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

Go to latest
Published: May 13, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const SecretKeyLength = 32

Variables

This section is empty.

Functions

func ComparePasswordHash

func ComparePasswordHash(hashedPassword, givenPassword []byte) bool

func Decrypt

func Decrypt(encryptedValue, secretKey []byte) ([]byte, error)

secretKey should be 16, 24, or 32 bytes

func Encrypt

func Encrypt(value, secretKey []byte) ([]byte, error)

secretKey should be 16, 24, or 32 bytes

func ExportRsaPrivateKeyAsPem

func ExportRsaPrivateKeyAsPem(key *rsa.PrivateKey, w io.Writer) error

func ExportRsaPublicKeyAsPem

func ExportRsaPublicKeyAsPem(key *rsa.PrivateKey, w io.Writer) error

func GeneratePasswordHash

func GeneratePasswordHash(password []byte) ([]byte, error)

func GenerateRsaKey

func GenerateRsaKey() (*rsa.PrivateKey, error)

func GenerateSecretKey

func GenerateSecretKey() string

From https://stackoverflow.com/a/31832326 This is NOT goroutine safe, if it ever needs to be, change src to the default rand source.

func ParseRsaPrivateKeyFromPemStr

func ParseRsaPrivateKeyFromPemStr(key string) (*rsa.PrivateKey, error)

func ParseRsaPublicKeyFromPemStr

func ParseRsaPublicKeyFromPemStr(key string) (*rsa.PublicKey, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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