Move the EncryptedData struct to a dedicated module

This commit is contained in:
Rodolphe Bréard 2024-03-17 14:45:18 +01:00
parent 5803e2971d
commit e6f7167525
6 changed files with 10 additions and 9 deletions

View file

@ -5,12 +5,6 @@ use crate::kdf::derive_key;
use crate::{storage, IkmId, InputKeyMaterialList};
use std::time::{SystemTime, UNIX_EPOCH};
#[derive(Debug)]
pub(crate) struct EncryptedData {
pub(crate) nonce: Vec<u8>,
pub(crate) ciphertext: Vec<u8>,
}
pub struct CipherBox<'a> {
ikm_list: &'a InputKeyMaterialList,
}

5
src/encrypted_data.rs Normal file
View file

@ -0,0 +1,5 @@
#[derive(Debug)]
pub(crate) struct EncryptedData {
pub(crate) nonce: Vec<u8>,
pub(crate) ciphertext: Vec<u8>,
}

View file

@ -4,6 +4,8 @@ mod canonicalization;
mod cipher_box;
#[cfg(feature = "encryption")]
mod context;
#[cfg(feature = "encryption")]
mod encrypted_data;
#[cfg(any(feature = "encryption", feature = "ikm-management"))]
mod error;
#[cfg(any(feature = "encryption", feature = "ikm-management"))]

View file

@ -1,5 +1,5 @@
#[cfg(feature = "encryption")]
use crate::cipher_box::EncryptedData;
use crate::encrypted_data::EncryptedData;
#[cfg(feature = "encryption")]
use crate::error::Result;
#[cfg(feature = "encryption")]

View file

@ -1,4 +1,4 @@
use crate::cipher_box::EncryptedData;
use crate::encrypted_data::EncryptedData;
use crate::error::Result;
use chacha20poly1305::aead::{Aead, KeyInit, Payload};
use chacha20poly1305::{Key, XChaCha20Poly1305, XNonce};

View file

@ -1,5 +1,5 @@
#[cfg(feature = "encryption")]
use crate::cipher_box::EncryptedData;
use crate::encrypted_data::EncryptedData;
use crate::error::{Error, Result};
#[cfg(feature = "encryption")]
use crate::ikm::IkmId;