wcrypto

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const TokenBitsLength = 6 * 4 * 3

Variables

View Source
var DefaultKeyType = KeyRSA4096
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 KeyTypeOfPub added in v0.1.0

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

func (KeyType) CompatibleWith added in v0.1.0

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 added in v0.2.1

type UnexpectedKeyTypeErr struct {
	Expected KeyType
	Actual   KeyType
}

func (UnexpectedKeyTypeErr) Error added in v0.2.1

func (e UnexpectedKeyTypeErr) Error() string

func (UnexpectedKeyTypeErr) Is added in v0.2.1

func (UnexpectedKeyTypeErr) Is(target error) bool

Jump to

Keyboard shortcuts

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