-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3fbc651
commit 5e75b39
Showing
4 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
this is test document for validating the CAS-LIB implemention and provide the examples usecases for the users |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
�Ί������97�Ú懚����1N5I[��`�?�BíϜ^�x&�W.m�|+ܮ���D�ͺz�H3.ق��br��lp��6�d�~��D��YJ^����� ��?��a;&��S�~w^��z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<u8> = std::fs::read(path).unwrap(); | ||
let aes_nonce = <CASAES256 as CASAESEncryption>::generate_nonce(); | ||
let aes_key = <CASAES256 as CASAESEncryption>::generate_key(); | ||
let encrypted_bytes = <CASAES256 as CASAESEncryption>::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<u8> = std::fs::read(path).unwrap(); | ||
let decrypted_bytes = <CASAES256 as CASAESEncryption>::decrypt_ciphertext(aes_key, aes_nonce, file_bytes); | ||
let mut file = File::create("decrypted.docx").unwrap(); | ||
file.write_all(&decrypted_bytes); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |