Crate rust_rsa_tool
Source - KeyPair
- RSA key pair container
- RsaUtilsError
- Custom error types
- decrypt_file
- Decrypt file using hybrid decryption (RSA for AES key, AES for file content)
- decrypt_file_java_ecb
- Decrypt file encrypted by Java (using AES/ECB mode)
Java’s default Cipher.getInstance(“AES”) uses ECB mode without IV
- encode_private_key
- Encode private key to base64 string (PKCS#8 format)
- encode_public_key
- Encode public key to base64 string (X.509/SPKI format)
- encrypt
- Encrypt data with RSA public key (supports data larger than key size via chunking)
- encrypt_file
- Encrypt file using hybrid encryption (AES for file content, RSA for AES key)
This matches the Java implementation’s approach
- encrypt_file_java_ecb
- Encrypt file using Java-compatible format (AES/ECB mode)
This generates files that can be decrypted by Java’s default Cipher.getInstance(“AES”)
- get_private_key
- Get private key from base64 encoded string (PKCS#8 format)
- get_public_key
- Get public key from base64 encoded string (X.509/SPKI format)
- init_key
- Initialize and generate RSA key pair (2048-bit)