SARE Lib
SARE LIB IS IN BETA. IT IS QUICKLY EVOLVING AND NOT YET AUDITED FOR SECURITY. USE WITH CAUTION.
SARE Lib is the high-level library for building applications using the SARE cryptographic standard. It provides safe, modular, and user-friendly interfaces for encryption, decryption, signing, key management, and certificate handling, while relying on sare-core under the hood for low-level cryptography.
Core Principles
-
Hybrid Security: SARE Lib is secure against both classical and quantum attacks.
-
Modular Design: Easily integrate new algorithms for encryption, signing, or key derivation.
-
Human Rights Focused: Privacy and security are foundational rights. SARE empowers users to protect these rights online. Even when quantum-computers emerge.
This is not a roll-your-own-crypto project. Only audited, standard, and proven algorithms are used for all encryption, signing, and key encapsulation operations.
Installation
Using SARE Lib in a Rust Project
Add it to your dependencies in Cargo.toml:
[]
= "0.1"
Using Cargo
Install via Cargo:
Example Usage
Encrypting and Decrypting Files
Symmetric Encryption
use ;
use SecretVec;
use File;
let input_file = open?;
let mut output_file = create?;
let passphrase = new;
// Generate key derivation function (KDF) using recommended parameters
let pkdf = get_pkdf;
// Encrypt the file symmetrically using XChaCha20-Poly1305 AEAD
encrypt_with_passphrase?;
Symmetric Decryption
use Decryptor;
use SecretVec;
use File;
let mut input_file = open?;
let mut output_file = create?;
let passphrase = new;
decrypt_with_passphrase?;
Asymmetric Encryption
use ;
use File;
let input_file = open?;
let mut output_file = create?;
// Load master key and recipient public key
let master_key = load?;
let recipient_key = from_pem?;
let encryptor = new;
encryptor.encrypt_with_recipient?;
Asymmetric Decryption
use Decryptor;
use File;
// Load your master key
let master_key = load?;
let decryptor = new;
let mut input_file = open?;
let mut output_file = create?;
// Decrypt the file
let signature = decryptor.decrypt_with_recipient?;
if let Some = signature
Signing and Verifying
Detached Signature
use Signing;
use fs;
let master_key = load?;
let signer = new;
let message = read?;
let signature = signer.sign_detached;
write?;
Verifying a Detached Signature
use Signing;
use SignatureHeaderFormat;
use fs;
let signed_file = read?;
let original_file = read?;
let signature_header = decode_with_magic_byte?;
let is_valid = verify_detached?;
println!;
Master Key Management
Generate a Master Key
use ;
let master_key = generate;
// Export the master key (optionally encrypted with a passphrase)
master_key.export?;
// Export public key
master_key.export_public?;
Inspect a Master Key
let master_key = load?;
println!;
println!;
Revoke a Master Key
use ;
let master_key = load?;
let issuer = new;
let revocation_cert = new_revocation;
revocation_cert.export?;
Recipient Management
use SharedPublicKey;
// Add a recipient
let recipient_key = from_pem?;
recipient_key.export?;
// Load and list recipients
let recipient_key = from_pem?;
println!;
For more detailed documentation on the underlying processes and formatting happening behind the scenes, please read our documentation book at https://sareproject.github.io/docs
Core Components
-
Keys: Generate master keys, export/import keys, derive subkeys for encryption/signing
-
Encryption & Decryption: Symmetric (password-based) and asymmetric (recipient-based) encryption engines
-
Signing: Hybrid post-quantum + classical signatures with attached or detached message support
-
Certificates: Validation and revocation certificates
-
Modular Cryptography: Easily extendable to new algorithms
SARE Lib is designed to make application development straightforward while letting sare-core handle the complexity of cryptography in the background.
Security Notice
SARE is built to use audited and standard cryptographic algorithms at the low-level encryption, signing, and encapsulation layers.
However, SARE itself still needs to be audited to be considered secure. Please use it at your own risk and do not use it for critical use cases.
If you've found security vulnerabilities, please follow our security policy for reporting. Do not report them in the GitHub issues or announce them publicly until we have released a fix for the issue: https://github.com/SareProject/sare/security/policy
Support
If you want to help SARE grow, the best way is financially. Please check out our donation page: https://sareproject.github.com/docs/support
But a share on social media, a star on our GitHub repo, or even a simple supporting message is enough motivation for us to keep going.
License
SARE Lib is released under a combination of the MIT License and the Apache License.