-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The versions 1.2.4 and 1.2.5 had errors which is why they weren't uploaded
- Loading branch information
Showing
15 changed files
with
806 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use crypt_guard::{ | ||
encrypt, | ||
decrypt, | ||
KyberFunctions, | ||
KeyControKyber1024, | ||
KyberKeyFunctions, | ||
error::*, | ||
Encryption, | ||
Decryption, | ||
Kyber1024, | ||
Message, | ||
AES, | ||
Kyber, | ||
}; | ||
fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
let message = "Hey, how are you doing?".as_bytes().to_owned(); | ||
let passphrase = "Test Passphrase"; | ||
|
||
// Generate key pair | ||
let (public_key, secret_key) = KeyControKyber1024::keypair().expect("Failed to generate keypair"); | ||
|
||
// Instantiate Kyber for encryption with Kyber1024 | ||
let mut encryptor = Kyber::<Encryption, Kyber1024, Message, AES>::new(public_key.clone(), None)?; | ||
|
||
// Encrypt message | ||
let (encrypt_message, cipher) = encrypt!(encryptor, message, passphrase)?; | ||
|
||
// Instantiate Kyber for decryption with Kyber1024 | ||
let mut decryptor = Kyber::<Decryption, Kyber1024, Message, AES>::new(secret_key, None)?; | ||
|
||
// Decrypt message | ||
let decrypt_message = decrypt!(decryptor, encrypt_message, passphrase, cipher); | ||
println!("{}", String::from_utf8(decrypt_message?).expect("Failed to convert decrypted message to string")); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.