Expand description
Message Verifier library compatible with Rails’ MessageVerifier and MessageEncryptor.
§A Small Example
Please refer to the README and repo for more examples.
extern crate message_verifier;
use message_verifier::{Verifier, Encryptor, AesHmacEncryptor, DerivedKeyParams};
fn main() {
let key_base = "helloworld";
let salt = "test salt";
let sign_salt = "test signed salt";
let verifier = Verifier::new(key_base);
//let dkp = DerivedKeyParams::default();
//let encryptor = AesHmacEncryptor::new(key_base, salt, sign_salt, dkp).unwrap();
let message = "{\"key\":\"value\"}";
println!("{}", verifier.generate(message).expect("Verifier failed"));
//println!("{}", encryptor.encrypt_and_sign(message).expect("Encryptor failed"));
}
Structs§
- AesGcm
Encryptor - AesGcmEncryptor struct; similiar to ActiveSupport::MessageEncryptor
- AesHmac
Encryptor - AesHmacEncryptor struct; similiar to ActiveSupport::MessageEncryptor
- Derived
KeyParams - Key derivation parameters for PBKDF2 function.
- Error
- The Error type.
- Verifier
- Verifier struct; similiar to ActiveSupport::MessageVerifier.
Enums§
- Error
Kind - The kind of an error.
- KeySize
- Encryption cipher key options. Only AES with 256, 192 or 128 bits is supported.
Traits§
- Encryptor
- Encryptor trait; similiar to ActiveSupport::MessageEncryptor. Implemented by AesHmacEncryptor and AesGcmEncryptor.
- Result
Ext - Additional methods for
Result
, for easy interaction with this crate.
Functions§
- create_
derived_ keys - Create one or more PBKDF2 derived keys using a secret, some key parameters and one or more salts.
Type Aliases§
- Result
- Convenient wrapper around
std::Result
.