From edcb64e9841498c6b6ae33f9646d0cebfcdac853 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 18 Jan 2024 09:23:09 -0800 Subject: [PATCH 1/6] Expose encryption methods --- openmls/src/ciphersuite/hpke.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openmls/src/ciphersuite/hpke.rs b/openmls/src/ciphersuite/hpke.rs index 061c4d1249..570f90f637 100644 --- a/openmls/src/ciphersuite/hpke.rs +++ b/openmls/src/ciphersuite/hpke.rs @@ -90,7 +90,7 @@ impl From<(&str, &[u8])> for EncryptContext { } /// Encrypt to an HPKE key with a label. -pub(crate) fn encrypt_with_label( +pub fn encrypt_with_label( public_key: &[u8], label: &str, context: &[u8], @@ -123,7 +123,7 @@ pub(crate) fn encrypt_with_label( } /// Decrypt with HPKE and label. -pub(crate) fn decrypt_with_label( +pub fn decrypt_with_label( private_key: &[u8], label: &str, context: &[u8], From 1cee89a202d98b7e508dd04a46ce154475639f53 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 18 Jan 2024 09:51:12 -0800 Subject: [PATCH 2/6] Expose module --- openmls/src/ciphersuite/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmls/src/ciphersuite/mod.rs b/openmls/src/ciphersuite/mod.rs index f7e7e279c7..3edf14fe55 100644 --- a/openmls/src/ciphersuite/mod.rs +++ b/openmls/src/ciphersuite/mod.rs @@ -16,7 +16,7 @@ use std::hash::Hash; mod aead; mod codec; -pub(crate) mod hpke; +pub mod hpke; mod kdf_label; mod mac; mod reuse_guard; From 040fc3503b094c1adc9e3260096c3889611f8543 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 18 Jan 2024 10:47:18 -0800 Subject: [PATCH 3/6] Make error type public --- openmls/src/ciphersuite/hpke.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmls/src/ciphersuite/hpke.rs b/openmls/src/ciphersuite/hpke.rs index 570f90f637..7f68a31280 100644 --- a/openmls/src/ciphersuite/hpke.rs +++ b/openmls/src/ciphersuite/hpke.rs @@ -45,7 +45,7 @@ use super::LABEL_PREFIX; /// HPKE labeled encryption errors. #[derive(Error, Debug, PartialEq, Clone)] -pub(crate) enum Error { +pub enum Error { /// Error while serializing content. This should only happen if a bounds check was missing. #[error( "Error while serializing content. This should only happen if a bounds check was missing." From e0a7e9d16755d39e37fcde538bf45bdfbc98ccfa Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 18 Jan 2024 11:50:15 -0800 Subject: [PATCH 4/6] Add missing doc --- openmls/src/ciphersuite/hpke.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/openmls/src/ciphersuite/hpke.rs b/openmls/src/ciphersuite/hpke.rs index 7f68a31280..ba8f5dccae 100644 --- a/openmls/src/ciphersuite/hpke.rs +++ b/openmls/src/ciphersuite/hpke.rs @@ -74,6 +74,7 @@ pub struct EncryptContext { context: VLBytes, } +// Context for HPKE encryption impl EncryptContext { /// Create a new [`EncryptContext`] from a string label and the content bytes. pub fn new(label: &str, context: VLBytes) -> Self { From 0b84ce797834662a534d475a8f60cd988cf2ed42 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 18 Jan 2024 11:56:43 -0800 Subject: [PATCH 5/6] Add one more doc --- openmls/src/ciphersuite/hpke.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/openmls/src/ciphersuite/hpke.rs b/openmls/src/ciphersuite/hpke.rs index ba8f5dccae..3818568789 100644 --- a/openmls/src/ciphersuite/hpke.rs +++ b/openmls/src/ciphersuite/hpke.rs @@ -68,6 +68,7 @@ impl From for Error { } } +// Context for HPKE encryption #[derive(Debug, Clone, TlsSerialize, TlsDeserialize, TlsDeserializeBytes, TlsSize)] pub struct EncryptContext { label: VLBytes, From 86a8849e98756770e5e513b7e226e875bc3a4826 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 18 Jan 2024 11:59:27 -0800 Subject: [PATCH 6/6] Add third slash --- openmls/src/ciphersuite/hpke.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openmls/src/ciphersuite/hpke.rs b/openmls/src/ciphersuite/hpke.rs index 3818568789..7ab8ef93d3 100644 --- a/openmls/src/ciphersuite/hpke.rs +++ b/openmls/src/ciphersuite/hpke.rs @@ -68,14 +68,14 @@ impl From for Error { } } -// Context for HPKE encryption +/// Context for HPKE encryption #[derive(Debug, Clone, TlsSerialize, TlsDeserialize, TlsDeserializeBytes, TlsSize)] pub struct EncryptContext { label: VLBytes, context: VLBytes, } -// Context for HPKE encryption +/// Context for HPKE encryption impl EncryptContext { /// Create a new [`EncryptContext`] from a string label and the content bytes. pub fn new(label: &str, context: VLBytes) -> Self {