3 releases
0.1.2 | Feb 16, 2024 |
---|---|
0.1.1 | Jan 9, 2024 |
0.1.0 | Nov 25, 2021 |
#1424 in Cryptography
67 downloads per month
Used in c5store
11KB
177 lines
ECIES X25519
Elliptic Curve Integrated Encryption Scheme is a way to encrypt arbitrary sized data using a receiver's public keys.
This project specifically implements ECIES with X25519 curve, AES-256-GCM and HKDF SHA-256 on multiple languages. These are some of the best in the industry cryptographic algorithms to stand the test of time.
Currently supports Java, Javascript and Rust for the forseeable future. If more languages are needed due to internal requirements then they will be implemented and published.
Note: My thought is that the most ideal interface for a ECIES inteface would be encrypt/decrypt.
lib.rs
:
Elliptic Curve Integrated Encryption Scheme using x25519
Example Usage
use rand_core::{OsRng};
use ecies_25519::{EciesX25519, generate_keypair, parse_openssl_25519_pubkey_der, parse_openssl_25519_privkey_der};
let mut os_rng = OsRng::default();
let recv_kp = generate_keypair(&mut os_rng).unwrap();
let recv_pub_key = parse_openssl_25519_pubkey_der(&recv_kp.public_der).unwrap();
let recv_priv_key = parse_openssl_25519_privkey_der(&recv_kp.private_der).unwrap();
let message = "I 💖🔒";
let ecies_inst = EciesX25519::new();
// Encrypt the message with the public key
let encrypted_data = ecies_inst.encrypt(
&recv_pub_key,
message.as_bytes(),
&mut os_rng
).unwrap();
// Decrypt the message with the private key
let decrypted_data_bytes = ecies_inst.decrypt(
&recv_priv_key,
&encrypted_data
).unwrap();
println!("Decrypted data is {}", String::from_utf8(decrypted_data_bytes.clone()).unwrap());
Dependencies
~6.5MB
~125K SLoC