Documentation ¶
Overview ¶
Copyright (c) 2019 Leonardo Faoro. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Index ¶
- func DefaultServer(hostPort string, router *mux.Router) *http.Server
- func DefaultTLSConfig() *tls.Config
- func Hash(data []byte) string
- func Hmac512(key string, data io.Reader) (b64 string, err error)
- func NewEncryptionKey() *[32]byte
- func NewToken(len int, isTest bool) string
- func RandomBytes(n int) []byte
- func RandomString(s int) string
- type Cryptor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultServer ¶
DefaultServer returns a http.Server with TLS security defaults and sane timeouts.
func DefaultTLSConfig ¶
DefaultTLSConfig returns a tls.Config with enhanced security.
The TLS security configuration respects PCI DSS requirements.
func Hmac512 ¶
Hmac512 ciphers the data extracted from the Reader and returns a b64 encoded string of a SHA512 hash.
func NewEncryptionKey ¶
func NewEncryptionKey() *[32]byte
NewEncryptionKey generates a random 256-bit key for Encrypt() and Decrypt(). It panics if the source of randomness fails.
func RandomBytes ¶
RandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
In the rare case you get an error there's something seriously wrong with your operating system.
func RandomString ¶
RandomString returns a URL-safe, base64 encoded securely generated random string.
It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
Types ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package AESGCM implement AES encryption with GCM authentication according to the paper at ref: https://eprint.iacr.org/2015/102.pdf
|
Package AESGCM implement AES encryption with GCM authentication according to the paper at ref: https://eprint.iacr.org/2015/102.pdf |
Package ascon wraps the Ascon encryption algorithm.
|
Package ascon wraps the Ascon encryption algorithm. |
Package cloudKMS makes it easy to interact with GCP's CloudKMS service.
|
Package cloudKMS makes it easy to interact with GCP's CloudKMS service. |