feat(transport): Use md-5 and hmac instead of rust-crypto
RustCrypto is not supported anymore, and this avoids compiling useless code.
This commit is contained in:
@@ -3,7 +3,7 @@ rust:
|
||||
- stable
|
||||
- beta
|
||||
- nightly
|
||||
- 1.18.0
|
||||
- 1.20.0
|
||||
matrix:
|
||||
allow_failures:
|
||||
- rust: nightly
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
[](https://crates.io/crates/lettre)
|
||||
[](https://docs.rs/lettre/)
|
||||
[]()
|
||||
[]()
|
||||
[](./LICENSE)
|
||||
|
||||
[](https://gitter.im/lettre/lettre?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
@@ -34,7 +34,7 @@ Lettre provides the following features:
|
||||
|
||||
## Example
|
||||
|
||||
This library requires Rust 1.18 or newer.
|
||||
This library requires Rust 1.20 or newer.
|
||||
To use this library, add the following to your `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
|
||||
@@ -26,7 +26,8 @@ native-tls = { version = "^0.1", optional = true }
|
||||
base64 = { version = "^0.9", optional = true }
|
||||
hex = { version = "^0.3", optional = true }
|
||||
hostname = { version = "^0.1", optional = true }
|
||||
rust-crypto = { version = "^0.2", optional = true }
|
||||
md-5 = { version = "^0.7", optional = true }
|
||||
hmac = { version = "^0.6", optional = true }
|
||||
serde = { version = "^1.0", optional = true }
|
||||
serde_json = { version = "^1.0", optional = true }
|
||||
serde_derive = { version = "^1.0", optional = true }
|
||||
@@ -40,7 +41,7 @@ default = ["file-transport", "crammd5-auth", "smtp-transport", "sendmail-transpo
|
||||
unstable = []
|
||||
serde-impls = ["serde", "serde_derive"]
|
||||
file-transport = ["serde-impls", "serde_json"]
|
||||
crammd5-auth = ["rust-crypto", "hex"]
|
||||
crammd5-auth = ["md-5", "hmac", "hex"]
|
||||
smtp-transport = ["bufstream", "native-tls", "base64", "nom", "hostname"]
|
||||
sendmail-transport = []
|
||||
|
||||
|
||||
@@ -13,13 +13,15 @@ extern crate base64;
|
||||
#[cfg(feature = "smtp-transport")]
|
||||
extern crate bufstream;
|
||||
#[cfg(feature = "crammd5-auth")]
|
||||
extern crate crypto;
|
||||
#[cfg(feature = "crammd5-auth")]
|
||||
extern crate hex;
|
||||
#[cfg(feature = "crammd5-auth")]
|
||||
extern crate hmac;
|
||||
#[cfg(feature = "smtp-transport")]
|
||||
extern crate hostname;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[cfg(feature = "crammd5-auth")]
|
||||
extern crate md5;
|
||||
#[cfg(feature = "smtp-transport")]
|
||||
extern crate native_tls;
|
||||
#[cfg(feature = "smtp-transport")]
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
//! Provides authentication mechanisms
|
||||
|
||||
#[cfg(feature = "crammd5-auth")]
|
||||
use crypto::hmac::Hmac;
|
||||
use md5::Md5;
|
||||
#[cfg(feature = "crammd5-auth")]
|
||||
use crypto::mac::Mac;
|
||||
#[cfg(feature = "crammd5-auth")]
|
||||
use crypto::md5::Md5;
|
||||
use hmac::{Hmac, Mac};
|
||||
#[cfg(feature = "crammd5-auth")]
|
||||
use hex;
|
||||
use smtp::NUL;
|
||||
@@ -146,7 +144,8 @@ impl Mechanism {
|
||||
None => return Err(Error::Client("This mechanism does expect a challenge")),
|
||||
};
|
||||
|
||||
let mut hmac = Hmac::new(Md5::new(), credentials.password.as_bytes());
|
||||
let mut hmac: Hmac<Md5> = Hmac::new_varkey(credentials.password.as_bytes())
|
||||
.expect("md5 should support variable key size");
|
||||
hmac.input(decoded_challenge.as_bytes());
|
||||
|
||||
Ok(format!(
|
||||
|
||||
@@ -10,7 +10,7 @@ Lettre is an email library that allows creating and sending messages. It provide
|
||||
The `lettre_email` crate allows you to compose messages, and the `lettre`
|
||||
provide transports to send them.
|
||||
|
||||
Lettre requires Rust 1.18 or newer. Add the following to your `Cargo.toml`:
|
||||
Lettre requires Rust 1.20 or newer. Add the following to your `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
|
||||
Reference in New Issue
Block a user