crypto

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDecodeAttestedCredentialData = Error{/* contains filtered or unexported fields */}
	ErrDecodeAuthenticatorData      = Error{/* contains filtered or unexported fields */}
	ErrDecodeCOSEKey                = Error{/* contains filtered or unexported fields */}
	ErrECDAANotSupported            = Error{/* contains filtered or unexported fields */}
	ErrEncodeAttestedCredentialData = Error{/* contains filtered or unexported fields */}
	ErrEncodeAuthenticatorData      = Error{/* contains filtered or unexported fields */}
	ErrGenerateChallenge            = Error{/* contains filtered or unexported fields */}
	ErrMarshalAttestationObject     = Error{/* contains filtered or unexported fields */}
	ErrOption                       = Error{/* contains filtered or unexported fields */}
	ErrNotImplemented               = Error{/* contains filtered or unexported fields */}
	ErrUnmarshalAttestationObject   = Error{/* contains filtered or unexported fields */}
	ErrVerifyAttestation            = Error{/* contains filtered or unexported fields */}
	ErrVerifyAuthentication         = Error{/* contains filtered or unexported fields */}
	ErrVerifyClientExtensionOutput  = Error{/* contains filtered or unexported fields */}
	ErrVerifyRegistration           = Error{/* contains filtered or unexported fields */}
	ErrVerifySignature              = Error{/* contains filtered or unexported fields */}
)

Categorical top-level errors

Functions

func DecodePublicKey added in v0.18.1

func DecodePublicKey(coseKey *COSEKey) (crypto.PublicKey, error)

DecodePublicKey parses a crypto.PublicKey from a COSEKey

func VerifySignature added in v0.18.1

func VerifySignature(rawKey cbor.RawMessage, message, sig []byte) error

VerifySignature verifies a signature using a provided COSEKey, message, and signature

Types

type COSEAlgorithmIdentifier added in v0.18.1

type COSEAlgorithmIdentifier int

COSEAlgorithmIdentifier is a number identifying a cryptographic algorithm

const (
	AlgorithmRS1   COSEAlgorithmIdentifier = -65535
	AlgorithmRS512 COSEAlgorithmIdentifier = -259
	AlgorithmRS384 COSEAlgorithmIdentifier = -258
	AlgorithmRS256 COSEAlgorithmIdentifier = -257
	AlgorithmPS512 COSEAlgorithmIdentifier = -39
	AlgorithmPS384 COSEAlgorithmIdentifier = -38
	AlgorithmPS256 COSEAlgorithmIdentifier = -37
	AlgorithmES512 COSEAlgorithmIdentifier = -36
	AlgorithmES384 COSEAlgorithmIdentifier = -35
	AlgorithmEdDSA COSEAlgorithmIdentifier = -8
	AlgorithmES256 COSEAlgorithmIdentifier = -7
)

enum values for COSEAlgorithmIdentifier type

type COSEEllipticCurve added in v0.18.1

type COSEEllipticCurve int

COSEEllipticCurve is a number identifying an elliptic curve

const (
	CurveP256 COSEEllipticCurve = 1
	CurveP384 COSEEllipticCurve = 2
	CurveP521 COSEEllipticCurve = 3
)

enum values for COSEEllipticCurve type

type COSEKey added in v0.18.1

type COSEKey struct {
	Kty       int             `cbor:"1,keyasint,omitempty"`
	Kid       []byte          `cbor:"2,keyasint,omitempty"`
	Alg       int             `cbor:"3,keyasint,omitempty"`
	KeyOpts   int             `cbor:"4,keyasint,omitempty"`
	IV        []byte          `cbor:"5,keyasint,omitempty"`
	CrvOrNOrK cbor.RawMessage `cbor:"-1,keyasint,omitempty"` // K for symmetric keys, Crv for elliptic curve keys, N for RSA modulus
	XOrE      cbor.RawMessage `cbor:"-2,keyasint,omitempty"` // X for curve x-coordinate, E for RSA public exponent
	Y         cbor.RawMessage `cbor:"-3,keyasint,omitempty"` // Y for curve y-cooridate
	D         []byte          `cbor:"-4,keyasint,omitempty"`
}

COSEKey represents a key decoded from COSE format.

type COSEKeyType added in v0.18.1

type COSEKeyType int

COSEKeyType is a number identifying a key type

const (
	KeyTypeOKP COSEKeyType = 1
	KeyTypeEC2 COSEKeyType = 2
	KeyTypeRSA COSEKeyType = 3
)

enum values for COSEKeyType type

type Error added in v0.18.1

type Error struct {
	// contains filtered or unexported fields
}

Error represents an error in a WebAuthn relying party operation

func NewError added in v0.18.1

func NewError(fmStr string, els ...interface{}) Error

NewError returns a new Error with a custom message

func (Error) Error added in v0.18.1

func (e Error) Error() string

Error implements the error interface

func (Error) Is added in v0.18.1

func (e Error) Is(target error) bool

Is establishes equality for error types

func (Error) Unwrap added in v0.18.1

func (e Error) Unwrap() error

Unwrap allows for error unwrapping

func (Error) Wrap added in v0.18.1

func (e Error) Wrap(err error) Error

Wrap returns a new error which contains the provided error wrapped with this error

type Group

type Group interface {
	GetRandomElement() *big.Int
	Mul(*big.Int, *big.Int) *big.Int
	Exp(*big.Int, *big.Int) *big.Int
	Inv(*big.Int) *big.Int
}

Group interface is used to enable the usage of different groups in some schemes. For example when we have a homomorphism f between two groups and we are proving that we know an f-preimage of an element - meaning that for a given v we know u such that f(u) = v. Note that this is an interface for modular arithmetic groups. For elliptic curve groups at the moment there is no need for an interface.

Jump to

Keyboard shortcuts

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