diff --git a/tests/symmetric_test/src/decrypted.docx b/tests/symmetric_test/src/decrypted.docx new file mode 100644 index 0000000..554210c --- /dev/null +++ b/tests/symmetric_test/src/decrypted.docx @@ -0,0 +1 @@ +this is test document for validating the CAS-LIB implemention and provide the examples usecases for the users \ No newline at end of file diff --git a/tests/symmetric_test/src/encrypted.docx b/tests/symmetric_test/src/encrypted.docx new file mode 100644 index 0000000..4e49e2b --- /dev/null +++ b/tests/symmetric_test/src/encrypted.docx @@ -0,0 +1 @@ +Ί97Ú懚1N5I[`?BíϜ^x&W.m|+ܮDͺzH3.قbrlp6d~DYJ^ ?a;&S~w^z \ No newline at end of file diff --git a/tests/symmetric_test/src/main.rs b/tests/symmetric_test/src/main.rs new file mode 100644 index 0000000..1e36ea2 --- /dev/null +++ b/tests/symmetric_test/src/main.rs @@ -0,0 +1,19 @@ +use std::{fs::{File}, io::Write, path::Path}; + +use cas_lib::symmetric::{aes::CASAES256, cas_symmetric_encryption::CASAESEncryption}; + +fn main() { + let path = Path::new("./../../test.docx"); + let file_bytes: Vec = std::fs::read(path).unwrap(); + let aes_nonce = ::generate_nonce(); + let aes_key = ::generate_key(); + let encrypted_bytes = ::encrypt_plaintext(aes_key.clone(), aes_nonce.clone(), file_bytes); + let mut file = File::create("encrypted.docx").unwrap(); + file.write_all(&encrypted_bytes); + + let path = Path::new("encrypted.docx"); + let file_bytes: Vec = std::fs::read(path).unwrap(); + let decrypted_bytes = ::decrypt_ciphertext(aes_key, aes_nonce, file_bytes); + let mut file = File::create("decrypted.docx").unwrap(); + file.write_all(&decrypted_bytes); +} \ No newline at end of file diff --git a/tests/test.docx b/tests/test.docx new file mode 100644 index 0000000..9fac6e3 --- /dev/null +++ b/tests/test.docx @@ -0,0 +1,3 @@ +This is a sample document. +It contains several lines of text. +We will use this document to demonstrate signing and verifying using RSA encryption.