Stability | experimental |
---|---|
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
- data CoseSignAlg where
- CoseSignAlgEdDSA
- CoseSignAlgECDSA CoseHashAlgECDSA
- CoseSignAlgRSA CoseHashAlgRSA
- pattern CoseAlgorithmEdDSA :: CoseSignAlg
- pattern CoseAlgorithmES256 :: CoseSignAlg
- pattern CoseAlgorithmES384 :: CoseSignAlg
- pattern CoseAlgorithmES512 :: CoseSignAlg
- pattern CoseAlgorithmRS256 :: CoseSignAlg
- pattern CoseAlgorithmRS384 :: CoseSignAlg
- pattern CoseAlgorithmRS512 :: CoseSignAlg
- pattern CoseAlgorithmRS1 :: CoseSignAlg
- fromCoseSignAlg :: Num p => CoseSignAlg -> p
- toCoseSignAlg :: (Eq a, Num a, Show a) => a -> Either Text CoseSignAlg
- data CoseHashAlgECDSA
- data CoseHashAlgRSA
COSE Algorithms
data CoseSignAlg Source #
(spec) All the entries from the COSE Algorithms registry limited to the ones that are currently needed for Webauthn. Notably we only care about asymmetric signature algorithms
CoseSignAlgEdDSA | (spec) EdDSA RFC8032 describes the elliptic curve signature scheme Edwards-curve Digital Signature Algorithm (EdDSA). In that document, the signature algorithm is instantiated using parameters for edwards25519 and edwards448 curves. The document additionally describes two variants of the EdDSA algorithm: Pure EdDSA, where no hash function is applied to the content before signing, and HashEdDSA, where a hash function is applied to the content before signing and the result of that hash function is signed. For EdDSA, the content to be signed (either the message or the pre-hash value) is processed twice inside of the signature algorithm. For use with COSE, only the pure EdDSA version is used. Security considerations are here |
CoseSignAlgECDSA CoseHashAlgECDSA | (spec) ECDSA ECDSA [DSS] defines a signature algorithm using ECC. Implementations SHOULD use a deterministic version of ECDSA such as the one defined in [RFC6979]. The ECDSA signature algorithm is parameterized with a hash function (h). In the event that the length of the hash function output is greater than the group of the key, the leftmost bytes of the hash output are used. ECDSA w/ SHA-256 This document defines ECDSA to work only with the curves P-256, P-384, and P-521. Future documents may define it to work with other curves and points in the future. In order to promote interoperability, it is suggested that SHA-256 be used only with curve P-256, SHA-384 be used only with curve P-384, and SHA-512 be used with curve P-521. This is aligned with the recommendation in Section 4 of RFC5480 Security considerations are here |
CoseSignAlgRSA CoseHashAlgRSA | (spec) The RSASSA-PKCS1-v1_5 signature algorithm is defined in RFC8017. The RSASSA-PKCS1-v1_5 signature algorithm is parameterized with a hash function (h). A key of size 2048 bits or larger MUST be used with these algorithms. Security considerations are here |
pattern CoseAlgorithmEdDSA :: CoseSignAlg | (spec) Cose Algorithm registry
entry
|
pattern CoseAlgorithmES256 :: CoseSignAlg | (spec) Cose Algorithm registry
entry
|
pattern CoseAlgorithmES384 :: CoseSignAlg | (spec) Cose Algorithm registry
entry
|
pattern CoseAlgorithmES512 :: CoseSignAlg | (spec) Cose Algorithm registry
entry
|
pattern CoseAlgorithmRS256 :: CoseSignAlg | (spec) Cose Algorithm registry
entry
|
pattern CoseAlgorithmRS384 :: CoseSignAlg | (spec) Cose Algorithm registry
entry
|
pattern CoseAlgorithmRS512 :: CoseSignAlg | (spec) Cose Algorithm registry
entry
|
pattern CoseAlgorithmRS1 :: CoseSignAlg | (spec) Cose Algorithm registry
entry
|
Instances
fromCoseSignAlg :: Num p => CoseSignAlg -> p Source #
Converts a CoseSignAlg
to the corresponding integer value from the
COSE Algorithms registry.
The inverse operation is toCoseSignAlg
toCoseSignAlg :: (Eq a, Num a, Show a) => a -> Either Text CoseSignAlg Source #
Converts an integer value to the corresponding CoseSignAlg
from the
COSE Algorithms registry.
Returns an error if the integer doesn't represent a known algorithm.
The inverse operation is fromCoseSignAlg
Hash Algorithms
data CoseHashAlgECDSA Source #
Hash algorithms that can be used with the ECDSA signature algorithm
CoseHashAlgECDSASHA256 | SHA-256 |
CoseHashAlgECDSASHA384 | SHA-384 |
CoseHashAlgECDSASHA512 | SHA-512 |
Instances
data CoseHashAlgRSA Source #
Hash algorithms that can be used with the RSA signature algorithm
CoseHashAlgRSASHA1 | SHA-1 (deprecated) |
CoseHashAlgRSASHA256 | SHA-256 |
CoseHashAlgRSASHA384 | SHA-384 |
CoseHashAlgRSASHA512 | SHA-512 |