Documentation ¶
Overview ¶
Package crypto implements security and crypto related functions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Sha512Hash ¶
Sha512Hash returns a SHA512 hash for the given value.
func Sha512SaltedHash ¶
Sha512SaltedHash returns a SHA512 hash for the given value and salt.
Types ¶
type HashAlgorithm ¶ added in v0.7.7
type HashAlgorithm string
HashAlgorithm used for the names of the supported hash algorithms.
const ( SHA256 HashAlgorithm = "SHA256" SHA384 HashAlgorithm = "SHA384" SHA512 HashAlgorithm = "SHA512" )
type KeyLoader ¶ added in v0.7.6
type KeyLoader interface { // LoadKeys returns a ManagedKey for a specific client and a bool indicating whether a key exists or not. LoadKeys(client *config.Client) (*ManagedKey, bool) ServerSecretLoader }
KeyLoader defines how to get ManagedKey for a specific client.
type ManagedKey ¶ added in v0.7.6
type ManagedKey struct { Id string Clients []*config.Client Server bool Key *jwk.Key HashAlgorithm HashAlgorithm }
ManagedKey defines a combination of keys defined for config.Client.
type ServerSecretLoader ¶ added in v0.7.6
type ServerSecretLoader interface { // GetServerKey returns the private key of the server. GetServerKey() jwt.SignEncryptParseOption }
ServerSecretLoader defines how to receive a private server key.
func NewServerSecretLoader ¶ added in v0.7.6
func NewServerSecretLoader() ServerSecretLoader
NewServerSecretLoader creates a ServerSecretLoader based on the current config.Config.
type SigningPrivateKey ¶
type SigningPrivateKey struct { PrivateKey interface{} SignatureAlgorithm jwa.SignatureAlgorithm HashAlgorithm HashAlgorithm }
SigningPrivateKey defines a combination of private key, signing and hash algorithm.
func LoadPrivateKey ¶
func LoadPrivateKey(filename string) (*SigningPrivateKey, error)
LoadPrivateKey loads a private key from a given filename.