CTAP 2.3#219
Conversation
f672cdc to
b33c2cf
Compare
robin-nitrokey
left a comment
There was a problem hiding this comment.
LGTM, I just have some small comments regarding the COSE serialization. Also I want to give @sosthene-nitrokey a chance to review before merging.
Previously we were more reluctant to add experimental features to trussed directly (and would maybe have used a custom backend instead), but with the increased separation due to trussed-core and as this is implemented using a rust-crypto crate, I think it is totally fine.
| // 01 07 — 1: 7 (kty = AKP) | ||
| // 03 38 31 — 3: -50 (alg = ML-DSA-44; -50 = ~49 = 0x31) | ||
| // 20 — -1 (key = pub) | ||
| // 59 05 20 — bstr(1312) |
There was a problem hiding this comment.
I find the comment “key = pub” somewhat misleading. I would put it like this:
| // 01 07 — 1: 7 (kty = AKP) | |
| // 03 38 31 — 3: -50 (alg = ML-DSA-44; -50 = ~49 = 0x31) | |
| // 20 — -1 (key = pub) | |
| // 59 05 20 — bstr(1312) | |
| // 01 07 — key 1 = kty, value 7 = APK | |
| // 03 38 31 — key 3 = alg, value -50 = ML-DSA-44 (-50 = ~49 = 0x31) | |
| // 20 — key -1 = pub | |
| // 59 05 20 — bstr with length 1312 = 0x0520 |
| serialized_key | ||
| .extend_from_slice(&[0x20]) | ||
| .map_err(|_| Error::InternalError)?; // low byte of 1312 (0x0520) |
There was a problem hiding this comment.
Why is this not part of header?
| let header: [u8; 9] = [0xa3, 0x01, 0x07, 0x03, 0x38, 0x31, 0x20, 0x59, 0x05]; | ||
| serialized_key | ||
| .extend_from_slice(&header) | ||
| .map_err(|_| Error::InternalError)?; | ||
| serialized_key | ||
| .extend_from_slice(&[0x20]) | ||
| .map_err(|_| Error::InternalError)?; // low byte of 1312 (0x0520) |
There was a problem hiding this comment.
Maybe it would be clearer to use PUBLIC_KEY_LEN here instead of duplicating the magic constant?
| // Hand-encoded CBOR — `cbor-smol` is awkward for negative-int | ||
| // map keys and we need exact bytes regardless of crate quirks. |
There was a problem hiding this comment.
Just out of curiosity, what problem did you have with cbor-smol?
Two changes: