webauthn-0.4.0.0: Relying party (server) implementation of the WebAuthn 2 specification
Stabilityinternal
Safe HaskellNone
LanguageHaskell2010

Crypto.WebAuthn.Cose.Internal.Registry

Description

This module contains definitions for COSE registry entries that are relevant for Webauthn COSE public keys. All the types in this module implement the Serialise class, mapping them to the respective CBOR values/labels.

This modules sometimes uses this CBOR Grammar to describe CBOR value types corresponding to CBOR parameters

Synopsis

COSE Key Types

data CoseKeyType Source #

(spec) All the entries from the COSE Key Types registry that are known to be needed for Webauthn public keys

Constructors

CoseKeyTypeOKP

(spec) Octet Key Pair. See CoseKeyTypeParameterOKP for the parameters specific to this key type.

CoseKeyTypeEC2

(spec) Elliptic Curve Keys w/ x- and y-coordinate pair. See CoseKeyTypeParameterEC2 for the parameters specific to this key type.

CoseKeyTypeRSA

(spec) RSA Key. See CoseKeyTypeParameterRSA for the parameters specific to this key type.

COSE Parameters

data CoseKeyCommonParameter Source #

(spec) All the entries from the COSE Key Common Parameters registry that are needed for Webauthn public keys

Constructors

CoseKeyCommonParameterKty

(spec)

  • COSE value type: tstr / int
  • Value registry: CoseKeyType
  • Description: Identification of the key type

This parameter is used to identify the family of keys for this structure and, thus, the set of key-type-specific parameters to be found. The key type MUST be included as part of the trust decision process.

CoseKeyCommonParameterAlg

(spec)

  • COSE value type: tstr / int
  • Value registry: CoseSignAlg
  • Description: Key usage restriction to this algorithm

This parameter is used to restrict the algorithm that is used with the key.

Instances

Instances details
Bounded CoseKeyCommonParameter Source # 
Instance details

Defined in Crypto.WebAuthn.Cose.Internal.Registry

Enum CoseKeyCommonParameter Source # 
Instance details

Defined in Crypto.WebAuthn.Cose.Internal.Registry

Eq CoseKeyCommonParameter Source # 
Instance details

Defined in Crypto.WebAuthn.Cose.Internal.Registry

Show CoseKeyCommonParameter Source # 
Instance details

Defined in Crypto.WebAuthn.Cose.Internal.Registry

Serialise CoseKeyCommonParameter Source #

Serialises the parameters using the Label column from the COSE Key Common Parameters registry

Instance details

Defined in Crypto.WebAuthn.Cose.Internal.Registry

data CoseKeyTypeParameterOKP Source #

(spec) All the entries from the COSE Key Type Parameters registry for key type CoseKeyTypeOKP (aka Key Type is 1) that are required for public keys

Constructors

CoseKeyTypeParameterOKPCrv

(spec)

This contains an identifier of the curve to be used with the key.

CoseKeyTypeParameterOKPX

(spec)

  • COSE value type: bstr
  • Description: Public Key

This contains the public key. The byte string contains the public key as defined by the algorithm.

Instances

Instances details
Bounded CoseKeyTypeParameterOKP Source # 
Instance details

Defined in Crypto.WebAuthn.Cose.Internal.Registry

Enum CoseKeyTypeParameterOKP Source # 
Instance details

Defined in Crypto.WebAuthn.Cose.Internal.Registry

Eq CoseKeyTypeParameterOKP Source # 
Instance details

Defined in Crypto.WebAuthn.Cose.Internal.Registry

Show CoseKeyTypeParameterOKP Source # 
Instance details

Defined in Crypto.WebAuthn.Cose.Internal.Registry

Serialise CoseKeyTypeParameterOKP Source #

Serialises the parameters using the Label column from the COSE Key Type Parameters registry

Instance details

Defined in Crypto.WebAuthn.Cose.Internal.Registry

data CoseKeyTypeParameterEC2 Source #

(spec) All the entries from the COSE Key Type Parameters registry for key type CoseKeyTypeEC2 (aka Key Type is 2) that are required for public keys

Constructors

CoseKeyTypeParameterEC2Crv

(spec)

This contains an identifier of the curve to be used with the key.

CoseKeyTypeParameterEC2X

(spec)

  • COSE value type: bstr
  • Description: x-coordinate

This contains the x-coordinate for the EC point. The integer is converted to a byte string as defined in [SEC1]. Leading zero octets MUST be preserved.

CoseKeyTypeParameterEC2Y

(spec)

  • COSE value type: bstr / bool
  • Description: y-coordinate

This contains either the sign bit or the value of the y-coordinate for the EC point. When encoding the value y, the integer is converted to an byte string (as defined in SEC1) and encoded as a CBOR bstr. Leading zero octets MUST be preserved. The compressed point encoding is also supported. Compute the sign bit as laid out in the Elliptic-Curve-Point-to- Octet-String Conversion function of SEC1. If the sign bit is zero, then encode y as a CBOR false value; otherwise, encode y as a CBOR true value. The encoding of the infinity point is not supported.

Instances

Instances details
Bounded CoseKeyTypeParameterEC2 Source # 
Instance details

Defined in Crypto.WebAuthn.Cose.Internal.Registry

Enum CoseKeyTypeParameterEC2 Source # 
Instance details

Defined in Crypto.WebAuthn.Cose.Internal.Registry

Eq CoseKeyTypeParameterEC2 Source # 
Instance details

Defined in Crypto.WebAuthn.Cose.Internal.Registry

Show CoseKeyTypeParameterEC2 Source # 
Instance details

Defined in Crypto.WebAuthn.Cose.Internal.Registry

Serialise CoseKeyTypeParameterEC2 Source #

Serialises the parameters using the Label column from the COSE Key Type Parameters registry

Instance details

Defined in Crypto.WebAuthn.Cose.Internal.Registry

data CoseKeyTypeParameterRSA Source #

(spec) All the entries from the COSE Key Type Parameters registry for key type CoseKeyTypeRSA (aka Key Type is 3) that are required for public keys

Constructors

CoseKeyTypeParameterRSAN

(spec)

  • COSE value type: bstr
  • Description: the RSA modulus n

The RSA modulus n is a product of u distinct odd primes r_i, i = 1, 2, ..., u, where u >= 2

All numeric key parameters are encoded in an unsigned big-endian representation as an octet sequence using the CBOR byte string type (major type 2). The octet sequence MUST utilize the minimum number of octets needed to represent the value. For instance, the value 32,768 is represented as the CBOR byte sequence 0b010_00010, 0x80 0x00 (major type 2, additional information 2 for the length).

CoseKeyTypeParameterRSAE

(spec)

  • COSE value type: bstr
  • Description: the RSA public exponent e

The RSA public exponent e is an integer between 3 and n - 1 satisfying GCD(e,lambda(n)) = 1, where lambda(n) = LCM(r_1 - 1, ..., r_u - 1)

All numeric key parameters are encoded in an unsigned big-endian representation as an octet sequence using the CBOR byte string type (major type 2). The octet sequence MUST utilize the minimum number of octets needed to represent the value. For instance, the value 32,768 is represented as the CBOR byte sequence 0b010_00010, 0x80 0x00 (major type 2, additional information 2 for the length).

Instances

Instances details
Bounded CoseKeyTypeParameterRSA Source # 
Instance details

Defined in Crypto.WebAuthn.Cose.Internal.Registry

Enum CoseKeyTypeParameterRSA Source # 
Instance details

Defined in Crypto.WebAuthn.Cose.Internal.Registry

Eq CoseKeyTypeParameterRSA Source # 
Instance details

Defined in Crypto.WebAuthn.Cose.Internal.Registry

Show CoseKeyTypeParameterRSA Source # 
Instance details

Defined in Crypto.WebAuthn.Cose.Internal.Registry

Serialise CoseKeyTypeParameterRSA Source #

Serialises the parameters using the Label column from the COSE Key Type Parameters registry

Instance details

Defined in Crypto.WebAuthn.Cose.Internal.Registry

parameterCount :: CoseKeyType -> Word Source #

The number of parameters for a CoseKeyType relevant for Webauthn public keys

COSE Elliptic Curves

data CoseEllipticCurveEC2 Source #

Elliptic curves for key type CoseKeyTypeEC2 from the COSE Elliptic Curves registry, limited to the ones that are currently needed for Webauthn

Constructors

CoseEllipticCurveEC2P256

(spec) NIST P-256 also known as secp256r1

CoseEllipticCurveEC2P384

(spec) NIST P-384 also known as secp384r1

CoseEllipticCurveEC2P521

(spec) NIST P-521 also known as secp521r1