Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

mm9942/CryptGuardSign

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages