[−]Module themis::keygen
Generating key material.
Themis supports two kinds of asymmetric cryptography keys: Elliptic Curve (ECDSA) and RSA.
These keys are used by SecureMessage
and SecureSession
objects.
This module contains functions for securely generating random key pairs. Note that managing resulting keys is your responsibility. You have to make sure that private keys are kept private when distributed to your users, and that public keys that you use come from trusted sources. You can consult our guidelines for some advice on key management.
Examples
use themis::keygen::gen_ec_key_pair; use themis::secure_message::SecureMessage; // Here we generate a new random Elliptic Curve key pair. let key_pair = gen_ec_key_pair(); let secure = SecureMessage::new(key_pair); let encrypted = secure.encrypt(b"message")?; let decrypted = secure.decrypt(&encrypted)?; assert_eq!(decrypted, b"message");
Functions
gen_ec_key_pair | Generates a pair of Elliptic Curve (ECDSA) keys. |
gen_rsa_key_pair | Generates a pair of RSA keys. |