crypto: Expose the EncryptionInfo struct publicly

master
Damir Jelić 2021-02-15 15:19:48 +01:00
parent fe11ad7e3e
commit c39fa6543f
2 changed files with 7 additions and 1 deletions

View File

@ -257,12 +257,18 @@ impl<'a, R: Read + 'a> AttachmentEncryptor<'a, R> {
} }
} }
/// Struct holding all the information that is needed to decrypt an encrypted
/// file.
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
pub struct EncryptionInfo { pub struct EncryptionInfo {
#[serde(rename = "v")] #[serde(rename = "v")]
/// The version of the encryption scheme.
pub version: String, pub version: String,
/// The web key that was used to encrypt the file.
pub web_key: JsonWebKey, pub web_key: JsonWebKey,
/// The initialization vector that was used to encrypt the file.
pub iv: String, pub iv: String,
/// The hashes that can be used to check the validity of the file.
pub hashes: BTreeMap<String, String>, pub hashes: BTreeMap<String, String>,
} }

View File

@ -1,5 +1,5 @@
mod attachments; mod attachments;
mod key_export; mod key_export;
pub use attachments::{AttachmentDecryptor, AttachmentEncryptor, DecryptorError}; pub use attachments::{AttachmentDecryptor, AttachmentEncryptor, DecryptorError, EncryptionInfo};
pub use key_export::{decrypt_key_export, encrypt_key_export}; pub use key_export::{decrypt_key_export, encrypt_key_export};