| Crates.io | rust-rsa-tool |
| lib.rs | rust-rsa-tool |
| version | 0.1.1 |
| created_at | 2025-10-30 03:55:18.360123+00 |
| updated_at | 2025-10-30 04:00:23.021921+00 |
| description | A sophisticated encryption utility employing a hybrid cryptographic system. It integrates RSA and AES algorithms, supports both CBC and ECB operational modes, and utilizes Base64-encoded keys for streamlined key management. |
| homepage | |
| repository | https://github.com/colinger/rust-rsa-tool |
| max_upload_size | |
| id | 1907687 |
| size | 58,462 |
A Rust implementation of RSA file encryption utilities, converted from Java. This library provides RSA key generation, encryption/decryption, and hybrid file encryption using RSA + AES.
use rust_rsa_tool::{init_key, encode_public_key, encode_private_key};
let key_pair = init_key()?;
let public_key_str = encode_public_key(&key_pair.public_key)?;
let private_key_str = encode_private_key(&key_pair.private_key)?;
println!("Public Key: {}", public_key_str);
println!("Private Key: {}", private_key_str);
use rust_rsa_tool::encrypt;
let plain_text = b"Hello, World!";
let encrypted = encrypt(plain_text, &public_key_str)?;
use rust_rsa_tool::{encrypt_file, decrypt_file};
// Encrypt a file
encrypt_file("input.txt", "encrypted.bin", &public_key_str)?;
// Decrypt a file
decrypt_file("encrypted.bin", "decrypted.txt", &private_key_str)?;
cargo test
Result type with custom error enum instead of exceptionsrsa: RSA encryption/decryptionaes: AES encryptioncipher: Cipher traits and block modesbase64: Base64 encoding/decodingrand: Random number generationpkcs8 & pkcs1: Key encoding/decodingthiserror: Error handlingThis is a conversion of Java RSA utilities to Rust.