Skip to main content

webauthn/
algorithm.rs

1//! COSE algorithm and key-type constants.
2//!
3//! These integer identifiers come from two registries:
4//! - COSE Algorithms: <https://www.iana.org/assignments/cose/cose.xhtml>
5//! - WebAuthn algorithms: <https://www.w3.org/TR/webauthn-2/#sctn-alg-identifier>
6//!
7//! COSE uses negative integers for algorithm identifiers (a CBOR convention
8//! for frequently-used values) and small positive integers for key type parameters.
9
10/// COSE algorithm: ECDSA P-256 with SHA-256. The most common WebAuthn algorithm.
11pub const COSE_ES256: i64 = -7;
12
13/// COSE algorithm: EdDSA (Ed25519). Used by newer FIDO2 authenticators.
14pub const COSE_EDDSA: i64 = -8;
15
16/// COSE algorithm: RSA PKCS#1 v1.5 with SHA-256. Used by older YubiKeys and Windows Hello.
17pub const COSE_RS256: i64 = -257;
18
19/// COSE key type: OKP (Octet Key Pair, e.g. Ed25519).
20pub const COSE_KTY_OKP: i64 = 1;
21
22/// COSE key type: EC2 (elliptic-curve, two-coordinate representation).
23pub const COSE_KTY_EC2: i64 = 2;
24
25/// COSE key type: RSA.
26pub const COSE_KTY_RSA: i64 = 3;
27
28/// COSE algorithm: ECDSA P-384 with SHA-384. Used by newer FIDO2 authenticators.
29pub const COSE_ES384: i64 = -35;
30
31/// COSE EC2 curve: P-256 (NIST curve secp256r1).
32pub const COSE_CRV_P256: i64 = 1;
33
34/// COSE EC2 curve: P-384 (NIST curve secp384r1).
35pub const COSE_CRV_P384: i64 = 2;
36
37/// COSE OKP curve: Ed25519.
38pub const COSE_CRV_ED25519: i64 = 6;