Stability | internal |
---|---|
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
CoseKeyTypeOKP | (spec) Octet Key Pair.
See |
CoseKeyTypeEC2 | (spec) Elliptic Curve Keys w/ x- and y-coordinate pair.
See |
CoseKeyTypeRSA | (spec) RSA Key.
See |
Instances
Show CoseKeyType Source # | |
Defined in Crypto.WebAuthn.Cose.Internal.Registry showsPrec :: Int -> CoseKeyType -> ShowS # show :: CoseKeyType -> String # showList :: [CoseKeyType] -> ShowS # | |
Eq CoseKeyType Source # | |
Defined in Crypto.WebAuthn.Cose.Internal.Registry (==) :: CoseKeyType -> CoseKeyType -> Bool # (/=) :: CoseKeyType -> CoseKeyType -> Bool # | |
Serialise CoseKeyType Source # | Serialises the key type using the |
Defined in Crypto.WebAuthn.Cose.Internal.Registry encode :: CoseKeyType -> Encoding # decode :: Decoder s CoseKeyType # encodeList :: [CoseKeyType] -> Encoding # decodeList :: Decoder s [CoseKeyType] # |
COSE Parameters
data CoseKeyCommonParameter Source #
(spec) All the entries from the COSE Key Common Parameters registry that are needed for Webauthn public keys
CoseKeyCommonParameterKty |
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 |
This parameter is used to restrict the algorithm that is used with the key. |
Instances
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
CoseKeyTypeParameterOKPCrv |
This contains an identifier of the curve to be used with the key. |
CoseKeyTypeParameterOKPX |
This contains the public key. The byte string contains the public key as defined by the algorithm. |
Instances
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
CoseKeyTypeParameterEC2Crv |
This contains an identifier of the curve to be used with the key. |
CoseKeyTypeParameterEC2X |
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 |
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
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
CoseKeyTypeParameterRSAN |
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 |
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
parameterCount :: CoseKeyType -> Word Source #
The number of parameters for a CoseKeyType
relevant for Webauthn public
keys
COSE Elliptic Curves
data CoseEllipticCurveOKP Source #
Elliptic curves for key type CoseKeyTypeOKP
from the
COSE Elliptic Curves registry,
limited to the ones that are currently needed for Webauthn
CoseEllipticCurveEd25519 | (spec) Ed25519 for use w/ EdDSA only |
Instances
Show CoseEllipticCurveOKP Source # | |
Defined in Crypto.WebAuthn.Cose.Internal.Registry showsPrec :: Int -> CoseEllipticCurveOKP -> ShowS # show :: CoseEllipticCurveOKP -> String # showList :: [CoseEllipticCurveOKP] -> ShowS # | |
Eq CoseEllipticCurveOKP Source # | |
Defined in Crypto.WebAuthn.Cose.Internal.Registry (==) :: CoseEllipticCurveOKP -> CoseEllipticCurveOKP -> Bool # (/=) :: CoseEllipticCurveOKP -> CoseEllipticCurveOKP -> Bool # | |
Serialise CoseEllipticCurveOKP Source # | Serialises COSE Elliptic Curves using the |
Defined in Crypto.WebAuthn.Cose.Internal.Registry encode :: CoseEllipticCurveOKP -> Encoding # decode :: Decoder s CoseEllipticCurveOKP # encodeList :: [CoseEllipticCurveOKP] -> Encoding # decodeList :: Decoder s [CoseEllipticCurveOKP] # |
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
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 |
Instances
Show CoseEllipticCurveEC2 Source # | |
Defined in Crypto.WebAuthn.Cose.Internal.Registry showsPrec :: Int -> CoseEllipticCurveEC2 -> ShowS # show :: CoseEllipticCurveEC2 -> String # showList :: [CoseEllipticCurveEC2] -> ShowS # | |
Eq CoseEllipticCurveEC2 Source # | |
Defined in Crypto.WebAuthn.Cose.Internal.Registry (==) :: CoseEllipticCurveEC2 -> CoseEllipticCurveEC2 -> Bool # (/=) :: CoseEllipticCurveEC2 -> CoseEllipticCurveEC2 -> Bool # | |
Serialise CoseEllipticCurveEC2 Source # | Serialises COSE Elliptic Curves using the |
Defined in Crypto.WebAuthn.Cose.Internal.Registry encode :: CoseEllipticCurveEC2 -> Encoding # decode :: Decoder s CoseEllipticCurveEC2 # encodeList :: [CoseEllipticCurveEC2] -> Encoding # decodeList :: Decoder s [CoseEllipticCurveEC2] # |