security

package
v2.9.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildJWT

func BuildJWT(subject string, ttl time.Duration, privateKey []byte) (token string, err error)

BuildJWT builds a JSON Web Token for the given subject and ttl, and signs it with the given private key

func GenerateCert

func GenerateCert(location string, commonName string, hostnames ...string) error

GenerateCert generates a certificate for the given hostnames in the given location

func GenerateKeypair

func GenerateKeypair(location string) error

GenerateKeypair generates a new keypair in the given location

func LoadCert

func LoadCert(location string) (cert []byte, err error)

LoadCert loads the certificate in the given location

func LoadKeypair

func LoadKeypair(location string) (*ecdsa.PrivateKey, error)

LoadKeypair loads the keypair in the given location

func PrivatePEM

func PrivatePEM(key *ecdsa.PrivateKey) ([]byte, error)

PrivatePEM returns the PEM-encoded private key

func PublicPEM

func PublicPEM(key *ecdsa.PrivateKey) ([]byte, error)

PublicPEM returns the PEM-encoded public key

func ValidateJWT

func ValidateJWT(token string, publicKey []byte) (*jwt.StandardClaims, error)

ValidateJWT validates a JSON Web Token with the given public key

Types

This section is empty.

Jump to

Keyboard shortcuts

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