CryptGuard Programming Library
Introduction
CryptGuard is a comprehensive cryptographic library, offering robust encryption and decryption capabilities. It integrates traditional cryptography with post-quantum algorithms, ensuring resilience against quantum computing threats. Designed for developers, CryptGuard empowers applications to withstand future digital security challenges. Embrace CryptGuard as your trusted ally in safeguarding privacy in the digital realm.
Syntax Overhaul and Version Information
Upcoming Changes
Our library is undergoing a syntax overhaul to enhance detail and clarity, addressing feedback for a more intuitive user experience. The current syntax focuses on providing a comprehensive understanding of the cryptographic processes, albeit with a higher complexity level.
Current Release
The present version, 1.1.2, emphasizes detailed cryptographic operations. This version is ideal for want a who fast but not to complicatet, elaborate approach to cryptography and don't want to use async code, async capabilites will on a later updated reimplemented (but this time as a feature). For those who prefer an rather easy syntax should just use version 1.0.3 until a later update are released. This versions syntax is more user friendly and does not need the definition of too many structs like in 1.1.1 or 1.1.0 but allows for precise control over the encryption and decryption algorithm as well as the kyber key size. It allows usage of Kyber1024, Kyber768 and Kyber512.
Future Release
A forthcoming update will introduce a more streamlined and user-friendly interface. This version aims to simplify cryptographic operations, making the library more accessible to a broader audience. Stay tuned for its release!
Important Considerations
Transition to the New Version
For those considering the transition to the updated version upon its release, familiarizing yourself with the current documentation and examples is recommended. This preparation will facilitate a smoother adaptation to the new syntax and features. The next upcoming versions, will gradually change the syntax and often implement things you don't need to use in the next version anymore, but these structs and methods don't cease existence, but rather are now automatically implemented for easier usage, if you wont to use them, don't hestiate to do that!
Usage Examples
Generating and Saving a Key Pair
This example illustrates generating a key pair and saving it to files, leveraging the KeyControKyber1024::keypair() method for key pair generation and the KeyControl::<KeyControKyber1024> instance for setting and saving the keys.
// Generate a keypair
let = keypair.unwrap;
let keycontrol = new;
// Save Public and Secret key while defining the folder (./key).
keycontrol.set_public_key.unwrap;
keycontrol.save.unwrap;
keycontrol.set_secret_key.unwrap;
keycontrol.save.unwrap;
Encryption of a File using AES
let message = "Hey, how are you doing?";
let passphrase = "Test Passphrase";
// Instantiate Kyber for encryption of a message with Kyber1024 and AES
// Fails when not using either of these properties since it would be the wrong type of algorithm, data, keysize or process!
let mut encryptor = new?;
// Encrypt message
let = encryptor.encrypt_msg?;
// Save the ciphertext for decryption in folder ./key
key_control.set_ciphertext.unwrap;
key_control.save.unwrap;
Decryption of a File using AES
let cipher = key_control.load;
let secret_key = key_control.load;
// Instantiate Kyber for decryption of a message with Kyber1024 and AES
// Fails when not using either of these properties since it would be the wrong type of algorithm, data, keysize or process!
let mut decryptor = new?;
// Decrypt message
let decrypt_message = decryptor.decrypt_msg?;
// Print the decrypted text
println!;
Encryption and decryption of a message written into a file with XChaCha20
let message = "Hey, how are you doing?";
let tmp_dir = new.map_err?;
let tmp_dir = new.prefix.tempdir.map_err?;
let enc_path = tmp_dir.path.clone.join;
let dec_path = tmp_dir.path.clone.join;
write?;
let passphrase = "Test Passphrase";
// Generate key pair
let = keypair.expect;
// Instantiate Kyber for encryption of a file with Kyber768 and XChaCha20
// Fails when not using either of these properties since it would be the wrong type of algorithm, data, keysize or process!
let mut encryptor = new?;
// Encrypt message
let = encryptor.encrypt_file?;
let nonce = encryptor.get_nonce;
remove_file;
// Instantiate Kyber for decryption of a file with Kyber768 and XChaCha20
// Fails when not using either of these properties since it would be the wrong type of algorithm, data, keysize or process!
let mut decryptor = new?;
// Decrypt message
let decrypt_message = decryptor.decrypt_file?;
Signing and Verifying with Falcon
use crate;
// Generate a keypair using Falcon
let falcon_keypair = keypair;
// Sign a message
let message = "This is a secret message";
let signature = sign_msg.expect;
// Verify the signature
let verified = verify_msg.expect;´
Signing and Verifying with Dilithium
use crate;
// Generate a keypair using Dilithium
let dilithium_keypair = keypair;
// Sign a message
let message = "Another secret message";
let signature = sign_msg.expect;
// Verify the signature
let verified = verify_msg.expect;´
Conclusion and Looking Forward
We appreciate your engagement with our cryptographic library. As we strive to improve and evolve, your feedback and contributions are invaluable. The anticipated update promises to make cryptography more accessible and straightforward for everyone.
Thank you for your support and for making security a priority in your projects.
License
CryptGuard is licensed under the MIT LICENSE. The full license text is available in the LICENSE file in the repository.