4 Commits
Author SHA1 Message Date
Sosthène Guédon 6aa902899b Update heapless-bytes to 0.5.0 2025-08-26 17:44:53 +02:00
Alfie FrestaandRobin Krahl 2388e31288 Add Deserialize trait to PublicKey 2025-02-25 22:14:40 +01:00
Robin Krahl 48d73a5ee0 Allow missing algorithms
The algorithm field is optional, see RFC 8152 § 7:

   COSE_Key = {
       1 => tstr / int,          ; kty
       ? 2 => bstr,              ; kid
       ? 3 => tstr / int,        ; alg
       ? 4 => [+ (tstr / int) ], ; key_ops
       ? 5 => bstr,              ; Base IV
       * label => values
   }

   alg:  This parameter is used to restrict the algorithm that is used
      with the key.  If this parameter is present in the key structure,
      the application MUST verify that this algorithm matches the
      algorithm for which the key is being used.

Fixes: https://github.com/trussed-dev/cosey/issues/3
2024-06-02 11:43:11 +02:00
Robin Krahl 68678ed4e1 Refactor COSE serialization and deserialization
This patch introduces the RawPublicKey helper type that takes care of
serialization and deserialization of the key type.  The *PublicKey
structs now only need to check if all required fields are present and
have the correct value.  It also adds extensive tests to make sure that
serialization and deserialization work correctly.

This patch is ported from: https://github.com/trussed-dev/ctap-types/pull/8
2024-05-02 11:18:01 +02:00