Back to

Package wcrypto

Latest Go to latest

The latest major version is .

Published: May 30, 2020 | License: Apache-2.0 | Module:



const TokenBitsLength = 6 * 4 * 3


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

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

type KeyType

type KeyType int
const (
	KeyAny KeyType = iota

func KeyTypeFromString

func KeyTypeFromString(s string) (KeyType, error)

func KeyTypeOfPub

func KeyTypeOfPub(pub crypto.PublicKey) (KeyType, error)

func (KeyType) CompatibleWith

func (expected KeyType) CompatibleWith(actual 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

type UnexpectedKeyTypeErr

type UnexpectedKeyTypeErr struct {
	Expected KeyType
	Actual   KeyType

func (UnexpectedKeyTypeErr) Error

func (e UnexpectedKeyTypeErr) Error() string

func (UnexpectedKeyTypeErr) Is

func (UnexpectedKeyTypeErr) Is(target error) bool

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier