wcrypto

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const TokenBitsLength = 6 * 4 * 3

Variables

View Source
var ErrPublicKeyMismatch = errors.New("Public keys do not match.")
View Source
var ServerKeyType = KeySECP256R1

Functions

func ExtractPublicKey

func ExtractPublicKey(priv crypto.PrivateKey) (crypto.PublicKey, error)

func GenBase64Token

func GenBase64Token(randr io.Reader, logger *zap.Logger) (string, error)

func GenerateKey

func GenerateKey(randr io.Reader, ktype KeyType, usage string, logger *zap.Logger) (crypto.PrivateKey, error)

func PubKeyPinString

func PubKeyPinString(pub crypto.PublicKey) (string, error)

PubKeyPinString extracts the SHA256 hash for use of curl`s --pinnedpubkey commandline option.

func SubjectKeyIdFromPubkey

func SubjectKeyIdFromPubkey(pub crypto.PublicKey) ([]byte, error)

func VerifyCACert

func VerifyCACert(cert *x509.Certificate, t time.Time) error

func VerifyCACertAndKey

func VerifyCACertAndKey(priv crypto.PrivateKey, cert *x509.Certificate, t time.Time) error

func VerifyPublicKeyMatch

func VerifyPublicKeyMatch(a, b crypto.PublicKey) error

func VerifyServerCert

func VerifyServerCert(cert *x509.Certificate, cacert *x509.Certificate, t time.Time) error

Types

type KeyType

type KeyType int
const (
	KeyAny KeyType = iota
	KeyRSA4096
	KeySECP256R1
)

func KeyTypeFromString

func KeyTypeFromString(s string) (KeyType, error)

func (KeyType) String

func (kt KeyType) String() string

func (*KeyType) UnmarshalFlag

func (p *KeyType) UnmarshalFlag(s string) error

func (*KeyType) UnmarshalYAML

func (p *KeyType) UnmarshalYAML(unmarshal func(interface{}) error) error

Jump to

Keyboard shortcuts

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