#post-quantum-cryptography #sign #encryption-decryption #capabilities #security #verification #comprehensive

crypt_guard_sign

CryptGuardLib is a comprehensive Rust library designed for strong encryption and decryption, incorporating post-quantum cryptography to safeguard against quantum threats. It's geared towards developers who need to embed advanced cryptographic capabilities in their Rust applications.

2 releases

0.1.2 Feb 10, 2024
0.1.1 Jan 30, 2024

#893 in Cryptography

27 downloads per month
Used in crypt_guard_kyber

MIT license

35KB
602 lines

CryptGuard: Sign Programming Library

Crates.io MIT licensed Documentation GitHub Library GitHub CLI GitHub CLI

Introduction

CryptGuard: Sign is a comprehensive cryptographic library, offering robust signing and verification capabilities. Designed for developers, CryptGuard: Sign empowers applications to withstand future digital security challenges. Embrace CryptGuard: Sign as your trusted ally in safeguarding privacy in the digital realm.

Prerequisites

Ensure your system has the latest stable versions of Rust, Cargo, and the Tokio runtime environment.

Usage

New Feature: Dilithium

The dilithium feature in CryptGuard: Sign introduces the Dilithium algorithm, a post-quantum cryptographic signing method. This feature is optional and can be enabled in your Cargo.toml.

Signing a Message with Dilithium

To sign a message using Dilithium,

#[cfg(feature = "dilithium")]

#[tokio::main]
async fn main() {
    #[cfg(feature = "dilithium")]
    {
        let mut sign = SignDilithium::new().unwrap();
        let message = b"Hello, this is a test message";

        // Sign the message
        let signed_message = sign.sign_msg(message).await.expect("Failed to sign message with Dilithium");

        // Print the signed message
        println!("Signed message with Dilithium: {:?}", signed_message);
    }
}

Verifying a Signed Message with Dilithium

To verify a signed message,

#[cfg(feature = "dilithium")]

#[tokio::main]
async fn main() {
    #[cfg(feature = "dilithium")]
    {
        let mut sign = SignDilithium::new().unwrap();
        let message = b"Hello, this is a test message";

        // Sign the message
        let signed_message = sign.sign_msg(message).await.expect("Failed to sign message");

        // Verify the signed message
        let verification_result = sign.verify_msg(message).await.expect("Failed to verify message");

        // Check the verification result
        assert!(verification_result, "Verification failed for the signed message with Dilithium");
    }
}

Signing a File with Dilithium

For signing a file using Dilithium,

#[cfg(feature = "dilithium")]

#[tokio::main]
async fn main() {
    #[cfg(feature = "dilithium")]
    {
        let mut sign = SignDilithium::new().unwrap();
        let file_path = PathBuf::from("path/to/your/file.txt");

        // Sign the file
        let signed_file = sign.sign_file(file_path.clone()).await.expect("Failed to sign file with Dilithium");

        // Print the result
        println!("Signed file with Dilithium: {:?}", signed_file);
    }
}

These examples demonstrate the usage of the dilithium feature in CryptGuard: Sign for signing and verifying messages and files, showcasing the library's capabilities with post-quantum cryptography.

Signing a Message

To sign a message,


#[tokio::main]
async fn main() {
    let mut sign = Sign::new().unwrap();
    let message = b"Hello, this is a test message";

    // Sign the message
    let signed_message = sign.sign_msg(message).await.expect("Failed to sign message");

    // Print the signed message
    println!("Signed message: {:?}", signed_message);
}

Signing a File

For signing a file,


#[tokio::main]
async fn main() {
    let mut sign = Sign::new().unwrap();
    let file_path = PathBuf::from("path/to/your/file.txt");

    // Sign the file
    let signed_file = sign.sign_file(file_path.clone()).await.expect("Failed to sign file");

    // Print the result
    println!("Signed file content: {:?}", signed_file);
}

Dependencies

CryptGuard: Sign depends on several external crates, specified in Cargo.toml:

  • aes: 0.8.3
  • tokio: 1.35.1 (with full feature)
  • colored: 2.1.0
  • env: 0.0.0
  • hex: 0.4.3
  • hmac: 0.12.1
  • indicatif: 0.17.7
  • pqcrypto-falcon: 0.3.0
  • pqcrypto-dilithium: 0.5.0
  • pqcrypto-kyber: 0.8.0
  • pqcrypto-traits: 0.3.5
  • rand: 0.8.5
  • sha2: 0.10.8
  • tempfile: 3.9.0

License

CryptGuard: Sign is licensed under the MIT LICENSE. The full license text is available in the LICENSE file in the repository.


You now have the complete README.md content with the updated examples for CryptGuard.

Dependencies

~25–41MB
~756K SLoC