Skip to content

Commit

Permalink
Version 1.1.5 - File upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mm9942 authored Apr 9, 2024
1 parent c0e9708 commit f3844a0
Show file tree
Hide file tree
Showing 10 changed files with 777 additions and 50 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "crypt_guard"
version = "1.1.4"
version = "1.1.5"
edition = "2021"
description = "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."
license = "MIT"
Expand All @@ -22,6 +22,7 @@ chacha20 = "0.9.1"
pqcrypto-dilithium = "0.5.0"
pqcrypto-kyber = "0.8.1"
tempfile = "3.10.1"
chrono = "0.4.37"
# notify-rust = "4.10.0"

[features]
Expand Down
93 changes: 53 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@
[![GitHub Library][lib-badge]][lib-link]
[![GitHub CLI][cli-badge]][cli-link]

[crates-badge]: https://img.shields.io/badge/crates.io-v1.1-blue.svg
[crates-badge]: https://img.shields.io/badge/crates.io-v1.1-blue.svg?style=for-the-badge
[crates-url]: https://crates.io/crates/crypt_guard
[mit-badge]: https://img.shields.io/badge/license-MIT-green.svg
[mit-badge]: https://img.shields.io/badge/license-MIT-green.svg?style=for-the-badge
[mit-url]: https://github.com/mm9942/CryptGuardLib/blob/main/LICENSE
[doc-badge]: https://img.shields.io/badge/docs-v1.1-yellow.svg
[doc-badge]: https://img.shields.io/badge/docs-v1.1-yellow.svg?style=for-the-badge
[doc-url]: https://docs.rs/crypt_guard/
[lib-badge]: https://img.shields.io/badge/github-lib-black.svg
[lib-badge]: https://img.shields.io/badge/github-lib-black.svg?style=for-the-badge
[lib-link]: https://github.com/mm9942/CryptGuardLib
[cli-badge]: https://img.shields.io/badge/github-cli-white.svg
[cli-link]: https://github.com/mm9942/CryptGuard

## Introduction

Expand All @@ -35,9 +33,19 @@ An additional layer of security is provided through the appending of a HMAC (Has

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 different complexity level.

### Newest Features

- **Simplified Syntax**: We've re-engineered the use of Dilithium and Falcon, adopting a straightforward, modular, and flexible approach akin to our encryption and decryption syntax. This enhancement aims to streamline operations for developers.

- **Designed for Versatility**: Our library now accommodates various key sizes beyond Falcon1024 and Dilithium5. Specifically, we've introduced Falcon512 for those needing a 512-bit key size. For Dilithium users, we've added support for Dilithium2 and Dilithium3, expanding the range of cryptographic strengths available.

- **Flexibility and Modularity**: The recent changes to our implementation for Dilithium and Falcon emphasize a generic and unified interface. This approach not only simplifies usage but also grants developers the flexibility to integrate different algorithms and signature modes seamlessly into their projects. By abstracting the complexity, we ensure that you can focus on what matters most - securing your applications efficiently.

The implementation of the logging logic is taking a bit longer as we're deliberating on the best approach to ensure it integrates seamlessly and securely into the library. Our goal is to offer a robust logging feature that enhances transparency without compromising security.

### Current Release

The present version, **1.1.4**, emphasizes detailed cryptographic operations. This version is ideal for those who want a fast but not too complicated, elaborate approach to cryptography and don't want to use asynchronous code. Asynchronous capabilities will be reimplemented in a later update (but this time as a feature). For those who prefer an easier syntax, they should just use version 1.0.3 until a later update is released. This version's syntax is more user-friendly and does not require 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 the usage of Kyber1024, Kyber768, and Kyber512.
The present version, **1.1.5**, emphasizes detailed cryptographic operations. This version is ideal for those who want a fast but not too complicated, elaborate approach to cryptography and don't want to use asynchronous code. Asynchronous capabilities will be reimplemented in a later update (but this time as a feature). For those who prefer using async implementation, use version 1.0.3 until a later update is released. This version's syntax is more user-friendly and does not require 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 the usage of Kyber1024, Kyber768, and Kyber512.

### Future Release

Expand All @@ -51,6 +59,44 @@ For those considering the transition to the updated version upon its release, fa

## Usage Examples

### New signature syntax for dilithium and falcon

#### Signing and opening with Falcon

```rust
use crypt_guard::KDF::*;

// Create a new keypair
let (public_key, secret_key) = Falcon1024::keypair();
let data = b"Hello, world!".to_vec();
let sign = Signature::<Falcon1024, Message>::new();
// Sign the message
let signed_message = sign.signature(data.clone(), secret_key);

// Open the message
let opened_message = sign.open(signed_message, public_key);
```

#### Signing and verifying detached with Dilithium

```rust
use crypt_guard::KDF::*;

// Create a new keypair
let (public_key, secret_key) = Dilithium5::keypair();
let data = b"Hello, world!".to_vec();

let sign = Signature::<Dilithium5, Detached>::new();

// Create a detached signature
let signature = sign.signature(data.clone(), secret_key);

// Verify the detached signature
let is_valid = sign.verify(data, signature, public_key);
```

### Cryptographic Operations

#### 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.
Expand Down Expand Up @@ -141,39 +187,6 @@ This example illustrates generating a key pair and saving it to files, leveragin
let decrypt_message = decryptor.decrypt_file(dec_path.clone(), passphrase.clone(), cipher)?;
```

#### Signing and Verifying with Falcon

```rust
use crate::signature::{falcon, SignatureKey, SignatureMechanism, Mechanism};

// Generate a keypair using Falcon
let falcon_keypair = falcon::keypair();

// Sign a message
let message = "This is a secret message";
let signature = falcon::sign_msg(&falcon_keypair.secret_key, message.as_bytes()).expect("Signing failed");

// Verify the signature
let verified = falcon::verify_msg(&falcon_keypair.public_key, &signature, message.as_bytes()).expect("Verification failed");´
```

#### Signing and Verifying with Dilithium

```rust
use crate::signature::{dilithium, SignatureKey, SignatureMechanism, Mechanism};

// Generate a keypair using Dilithium
let dilithium_keypair = dilithium::keypair();

// Sign a message
let message = "Another secret message";
let signature = dilithium::sign_msg(&dilithium_keypair.secret_key, message.as_bytes()).expect("Signing failed");

// Verify the signature
let verified = dilithium::verify_msg(&dilithium_keypair.public_key, &signature, message.as_bytes()).expect("Verification failed");´
```


### 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.
Expand Down
Loading

0 comments on commit f3844a0

Please sign in to comment.