Merge pull request #981 from sfackler/dependabot/cargo/base64-0.21
Update base64 requirement from 0.20 to 0.21
This commit is contained in:
commit
56fb0d0426
@ -9,7 +9,7 @@ repository = "https://github.com/sfackler/rust-postgres"
|
|||||||
readme = "../README.md"
|
readme = "../README.md"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
base64 = "0.20"
|
base64 = "0.21"
|
||||||
byteorder = "1.0"
|
byteorder = "1.0"
|
||||||
bytes = "1.0"
|
bytes = "1.0"
|
||||||
fallible-iterator = "0.2"
|
fallible-iterator = "0.2"
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
//! SASL-based authentication support.
|
//! SASL-based authentication support.
|
||||||
|
|
||||||
|
use base64::display::Base64Display;
|
||||||
|
use base64::engine::general_purpose::STANDARD;
|
||||||
|
use base64::Engine;
|
||||||
use hmac::{Hmac, Mac};
|
use hmac::{Hmac, Mac};
|
||||||
use rand::{self, Rng};
|
use rand::{self, Rng};
|
||||||
use sha2::digest::FixedOutput;
|
use sha2::digest::FixedOutput;
|
||||||
@ -189,7 +192,7 @@ impl ScramSha256 {
|
|||||||
return Err(io::Error::new(io::ErrorKind::InvalidInput, "invalid nonce"));
|
return Err(io::Error::new(io::ErrorKind::InvalidInput, "invalid nonce"));
|
||||||
}
|
}
|
||||||
|
|
||||||
let salt = match base64::decode(parsed.salt) {
|
let salt = match STANDARD.decode(parsed.salt) {
|
||||||
Ok(salt) => salt,
|
Ok(salt) => salt,
|
||||||
Err(e) => return Err(io::Error::new(io::ErrorKind::InvalidInput, e)),
|
Err(e) => return Err(io::Error::new(io::ErrorKind::InvalidInput, e)),
|
||||||
};
|
};
|
||||||
@ -208,7 +211,7 @@ impl ScramSha256 {
|
|||||||
let mut cbind_input = vec![];
|
let mut cbind_input = vec![];
|
||||||
cbind_input.extend(channel_binding.gs2_header().as_bytes());
|
cbind_input.extend(channel_binding.gs2_header().as_bytes());
|
||||||
cbind_input.extend(channel_binding.cbind_data());
|
cbind_input.extend(channel_binding.cbind_data());
|
||||||
let cbind_input = base64::encode(&cbind_input);
|
let cbind_input = STANDARD.encode(&cbind_input);
|
||||||
|
|
||||||
self.message.clear();
|
self.message.clear();
|
||||||
write!(&mut self.message, "c={},r={}", cbind_input, parsed.nonce).unwrap();
|
write!(&mut self.message, "c={},r={}", cbind_input, parsed.nonce).unwrap();
|
||||||
@ -225,7 +228,12 @@ impl ScramSha256 {
|
|||||||
*proof ^= signature;
|
*proof ^= signature;
|
||||||
}
|
}
|
||||||
|
|
||||||
write!(&mut self.message, ",p={}", base64::encode(&*client_proof)).unwrap();
|
write!(
|
||||||
|
&mut self.message,
|
||||||
|
",p={}",
|
||||||
|
Base64Display::new(&client_proof, &STANDARD)
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
self.state = State::Finish {
|
self.state = State::Finish {
|
||||||
salted_password,
|
salted_password,
|
||||||
@ -262,7 +270,7 @@ impl ScramSha256 {
|
|||||||
ServerFinalMessage::Verifier(verifier) => verifier,
|
ServerFinalMessage::Verifier(verifier) => verifier,
|
||||||
};
|
};
|
||||||
|
|
||||||
let verifier = match base64::decode(verifier) {
|
let verifier = match STANDARD.decode(verifier) {
|
||||||
Ok(verifier) => verifier,
|
Ok(verifier) => verifier,
|
||||||
Err(e) => return Err(io::Error::new(io::ErrorKind::InvalidInput, e)),
|
Err(e) => return Err(io::Error::new(io::ErrorKind::InvalidInput, e)),
|
||||||
};
|
};
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
//! end up in logs pg_stat displays, etc.
|
//! end up in logs pg_stat displays, etc.
|
||||||
|
|
||||||
use crate::authentication::sasl;
|
use crate::authentication::sasl;
|
||||||
|
use base64::display::Base64Display;
|
||||||
|
use base64::engine::general_purpose::STANDARD;
|
||||||
use hmac::{Hmac, Mac};
|
use hmac::{Hmac, Mac};
|
||||||
use md5::Md5;
|
use md5::Md5;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
@ -80,9 +82,9 @@ pub(crate) fn scram_sha_256_salt(password: &[u8], salt: [u8; SCRAM_DEFAULT_SALT_
|
|||||||
format!(
|
format!(
|
||||||
"SCRAM-SHA-256${}:{}${}:{}",
|
"SCRAM-SHA-256${}:{}${}:{}",
|
||||||
SCRAM_DEFAULT_ITERATIONS,
|
SCRAM_DEFAULT_ITERATIONS,
|
||||||
base64::encode(salt),
|
Base64Display::new(&salt, &STANDARD),
|
||||||
base64::encode(stored_key),
|
Base64Display::new(&stored_key, &STANDARD),
|
||||||
base64::encode(server_key)
|
Base64Display::new(&server_key, &STANDARD)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user