Crates.io | msoffice_crypt |
lib.rs | msoffice_crypt |
version | 0.1.5 |
source | src |
created_at | 2023-04-10 16:11:01.58655 |
updated_at | 2023-04-11 06:40:40.170045 |
description | msoffice-crypt bindings for the Rust programming language. |
homepage | |
repository | https://gitee.com/eshangrao/msoffice-crypt-rust |
max_upload_size | |
id | 835252 |
size | 2,830,314 |
msoffice-crypt bindings for the Rust programming language.
A lib to encrypt/decrypt Microsoft Office Document
you must add the lib libmsoc.so to the system lib before run the bin app.
1.linux:
you must compile the lib youself , read more
export LD_LIBRARY_PATH=some/path/to/libmsoc.so/dir:$LD_LIBRARY_PATH
2.windows:
set PATH=some\path\to\libmsoc.dll\dir;%PATH%
use msoffice_crypt::{encrypt,decrypt};
fn main() {
# encrypt the input to output file
let input = "/home/feiy/Desktop/1.xlsx";
let output = "/home/feiy/Desktop/output.xlsx";
let password = "test";
let ret = encrypt(input,password,Some(output));
println!("{ret:#?}");
# decrypt the input file to output file
let plain = "/home/feiy/Desktop/plain.xlsx";
let ret = decrypt(output,password,Some(plain));
println!("{ret:#?}");
// overwrite the input file
let plain = "/home/feiy/Desktop/plain.xlsx";
let ret = encrypt(plain,password,None);
println!("{ret:#?}");
}