crypto

package module
v0.0.0-...-695aaad Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

README

crypto

Cryptographic best practices

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(digest []byte, password []byte) (err error)

CheckPassword compares a given password against its hased equivalent and returns an error if they are not equal.

func Decrypt

func Decrypt(ct []byte, key [32]byte) (pt []byte, err error)

Decrypt uses AES in GCM mode to decrypt a given ciphertext.

func Encrypt

func Encrypt(pt []byte, key [32]byte) (ct []byte, err error)

Encrypt uses AES in GCM mode to encrypt a given plaintext.

func HashData

func HashData(tag string, data []byte) (digest []byte)

HashData performs an HMAC SHA-512/256 hash of a given input. Note that this should only be used to hash data, not passwords.

func HashPassword

func HashPassword(password []byte) (digest []byte, err error)

HashPassword performs a bcrypt hash of a given password using a constant cost value.

func NewSigningKey

func NewSigningKey() (pri *ecdsa.PrivateKey, err error)

NewSigningKey generates an ECDSA P256 private key.

func Sign

func Sign(data []byte, pri *ecdsa.PrivateKey) (sig []byte, err error)

Sign performs an ECDSA signing and returns the signature.

func Verify

func Verify(data []byte, sig []byte, pub *ecdsa.PublicKey) bool

Verify performs an ECDSA verification of a given signature.

Types

This section is empty.

Jump to

Keyboard shortcuts

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