1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! EZNaCl is an MPL2.0-licensed library that wraps around LibSodium and gets as close to push-button cryptography as a developer can feasibly be. At the same time, because it's cryptography, be very careful applying it--you can still shoot yourself in the foot.
//!
//! No guarantees of any kind are provided with the library even though it has been written with care.
//!
//! Also, please don't use this code to place important crypto keys in your code or embed backdoors. No one needs that kind of drama.
//!
//! # Encryption and Decryption
//!
//! Regardless of whether or not you are using public key or secret key cryptography, the usage is
//! the same:
//!
//! 1. Instantiate your key, either using `generate()` or from an existing CryptoString.
//! 2. Call [`encrypt()`](trait.Encryptor.html) or [`decrypt()`](trait.Decryptor.html) on your data
//! 3. Profit
//!
//! ## Encryption Example
//! ```
//! use eznacl::*;
//!
//! let keypair = match eznacl::EncryptionPair::generate() {
//! Some(kp) => kp,
//! None => panic!("Failed to create keypair")
//! };
//!
//! let testdata = "This is some encryption test data";
//! let encrypted_data = match keypair.encrypt(testdata.as_bytes()) {
//! Ok(cs) => cs,
//! Err(_) => panic!("encryption failure")
//! };
//!
//! print!("Unencrypted data: {}\nEncrypted data: {}", testdata, encrypted_data.as_str())
//!
//! ```
//!
//! The structs to use for encryption and decryption are
//! [`EncryptionPair`](struct.EncryptionPair.html) and [`SecretKey`](struct.SecretKey.html). If you
//! only have access to a public key, then you will use
//! [`EncryptionKey`](struct.EncryptionKey.html) instead.
//!
//! # Signing and Verification
//!
//! Signature-handling is little different.
pub use *;
pub use CryptoString;
pub use *;
pub use EzNaclError;
pub use *;
pub use *;
pub use *;
pub use *;
extern crate lazy_static;
use sodiumoxide;
/// Initializes the underlying SodiumOxide library, which is needed for thread safety.