Skip to content

Commit 5447cbb

Browse files
committed
Add cose keywrap
1 parent a42b1e7 commit 5447cbb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

crates/bitwarden-crypto/src/store/context.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,18 @@ impl<Ids: KeyIds> KeyStoreContext<'_, Ids> {
185185
key_to_wrap_instance.to_encoded().as_slice(),
186186
ContentFormat::OctetStream,
187187
),
188+
(XChaCha20Poly1305Key(_), Aes256CbcHmacKey(_) | Aes256CbcKey(_)) => self
189+
.encrypt_data_with_symmetric_key(
190+
wrapping_key,
191+
key_to_wrap_instance.to_encoded().as_slice(),
192+
ContentFormat::OctetStream,
193+
),
194+
(XChaCha20Poly1305Key(_), XChaCha20Poly1305Key(_)) => self
195+
.encrypt_data_with_symmetric_key(
196+
wrapping_key,
197+
key_to_wrap_instance.to_encoded_raw().as_slice(),
198+
ContentFormat::CoseKey,
199+
),
188200
_ => Err(CryptoError::OperationNotSupported(
189201
UnsupportedOperation::EncryptionNotImplementedForKey,
190202
)),

0 commit comments

Comments
 (0)