From 7b23a0fedd5c1342e8298a6f95260069c6f476e7 Mon Sep 17 00:00:00 2001 From: Bernd Krietenstein Date: Mon, 4 Dec 2023 08:57:48 +0100 Subject: [PATCH] Fix construction of `wrapped_cek` --- cms/src/builder.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cms/src/builder.rs b/cms/src/builder.rs index b4abec592..81b33ec8b 100644 --- a/cms/src/builder.rs +++ b/cms/src/builder.rs @@ -784,10 +784,10 @@ where Error::Builder("Content encryption key length must not exceed 255".to_string()) })?; let mut wrapped_cek: Vec = Vec::with_capacity(4 + padding_length); - wrapped_cek.insert(0, cek_byte_count); - wrapped_cek.insert(0xff ^ content_encryption_key[0]); - wrapped_cek.insert(0xff ^ content_encryption_key[1]); - wrapped_cek.insert(0xff ^ content_encryption_key[2]); + wrapped_cek.push(cek_byte_count); + wrapped_cek.push(0xff ^ content_encryption_key[0]); + wrapped_cek.push(0xff ^ content_encryption_key[1]); + wrapped_cek.push(0xff ^ content_encryption_key[2]); if padding_length > 0 { let mut padding = vec![0_u8; padding_length]; self.rng.fill_bytes(padding.as_mut_slice());