CryptGuard programming library
Introduction
Embark on a journey through the cryptic realms of cyberspace with CryptGuard, a fortress of cryptographic wisdom. In an era where the fabric of digital security is relentlessly tested by the looming specter of quantum supremacy, CryptGuard stands as a bulwark, melding the arcane secrets of traditional cryptography with the enigmatic art of post-quantum ciphers. It is a beacon for developers, a herald of a new epoch, who seek to imbue their creations with the power to withstand the tempests of tomorrow's uncertainties. Let CryptGuard be the sentinel in the silent war of ones and zeroes, a vigilant guardian weaving the unbreakable shield of privacy.
Prerequisites
Before integrating CryptGuard into your project, ensure your system includes:
- Rust and Cargo (latest stable version)
- Tokio runtime environment
Installation
To include CryptGuard in your Rust project, follow these steps:
- Clone the GitHub repository:
- Navigate to the CryptGuardLib directory:
- Compile the project using Cargo:
Usage
Encrypting Data
Encrypt data using encrypt, encrypt_msg, or encrypt_file functions from the Encrypt struct.
Encrypt a Message
use Encrypt;
use Keychain;
async
Encrypt a File
use Encrypt;
use Keychain;
use PathBuf;
async
Decrypting Data
Decrypt data using decrypt, decrypt_msg, or decrypt_file functions from the Decrypt struct.
use Decrypt;
use Keychain;
use PathBuf;
async
Keychain Usage
The Keychain struct in CryptGuard facilitates key management. It supports loading and saving public keys, secret keys, shared secrets, and ciphertexts. For example:
use Keychain;
Signing a Message
To sign a message, you can use the Sign struct from the sign module. Here's how you can sign a message:
use Sign;
async
In this example, Sign::new() initializes the Sign struct, and sign.sign_msg(message) is used to sign the provided message.
Signing a File
For signing a file, you can use the sign_file method from the Sign struct. This method signs the content of the file and saves the signature. Here's an example:
use Sign;
use PathBuf;
async
In this example, sign.sign_file(file_path) is used to sign the content of the specified file.
Additional Features
The Sign struct also provides functionalities like verify_msg and verify_detached for verifying signed messages and detached signatures, respectively. The test cases you provided include examples of these functionalities.
Remember to handle the results and errors appropriately in a production environment, and ensure that the paths and keys used in these examples match your specific use case.
Dependencies
CryptGuard depends on several external crates, specified in Cargo.toml:
aes: Version 0.8.3 for AES encryption.tokio: Version 1.35.1 with thefullfeature for asynchronous programming.- Additional dependencies as per the previous README.
Resources
- CryptGuard on Crates.io: https://crates.io/crates/crypt_guard
- CryptGuard Documentation: https://docs.rs/crypt_guard/
- CryptGuard CLI Application: https://github.com/mm9942/CryptGuard
- CryptGuard Library Source
: https://github.com/mm9942/CryptGuardLib
License
CryptGuard is licensed under the MIT LICENSE. The full license text can be found in the LICENSE file in the repository.