You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[PM-22621] Fix missing key ID and add testvectors for cose decryption (#305)
## 🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-22621
## 📔 Objective
This PR adds the key identifier value on encryption to the encrypt0
message.
To quote the cose spec:
> This parameter identifies one piece of data that can be used as
input to find the needed cryptographic key. The value of this
parameter can be matched against the 'kid' member in a COSE_Key
structure. Other methods of key distribution can define an
equivalent field to be matched. Applications MUST NOT assume that
'kid' values are unique. There may be more than one key with the
same 'kid' value, so all of the keys associated with this 'kid'
may need to be checked. The internal structure of 'kid' values is
not defined and cannot be relied on by applications. Key
identifier values are hints about which key to use. This is not a
security-critical field. For this reason, it can be placed in the
unprotected headers bucket.
While our code does not make use yet of the KID value for hinting at the
correct key, we do want to include it, and it had not been included so
far. Since we do not use cose yet, no migration is needed.
We also fail decryption on a mismatched key-id, but this is not a
security feature, instead this is a traceability feature, and makes the
failure reason clearer.
## ⏰ Reminders before review
- Contributor guidelines followed
- All formatters and local linters executed and passed
- Written new unit and / or integration tests where applicable
- Protected functional changes with optionality (feature flags)
- Used internationalization (i18n) for all UI strings
- CI builds passed
- Communicated to DevOps any deployment requirements
- Updated any necessary documentation (Confluence, contributing docs) or
informed the documentation
team
## 🦮 Reviewer guidelines
<!-- Suggested interactions but feel free to use (or not) as you desire!
-->
- 👍 (`:+1:`) or similar for great changes
- 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info
- ❓ (`:question:`) for questions
- 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry
that's not quite a confirmed
issue and could potentially benefit from discussion
- 🎨 (`:art:`) for suggestions / improvements
- ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or
concerns needing attention
- 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or
indications of technical debt
- ⛏ (`:pick:`) for minor or nitpick changes
0 commit comments