Browse Source

Update the base64 dependency

pull/76/head
Rodolphe Bréard 2 years ago
parent
commit
1ee0b39aa9
  1. 2
      acme_common/Cargo.toml
  2. 10
      acme_common/src/lib.rs

2
acme_common/Cargo.toml

@ -20,7 +20,7 @@ openssl_vendored = ["crypto_openssl", "openssl/vendored", "openssl-sys/vendored"
[dependencies]
attohttpc = { version = "0.24", default-features = false }
base64 = "0.13"
base64 = "0.20"
daemonize = "0.4"
env_logger = "0.9"
glob = "0.3"

10
acme_common/src/lib.rs

@ -9,6 +9,12 @@ pub mod logs;
#[cfg(test)]
mod tests;
const URL_SAFE_NO_PAD: base64::engine::fast_portable::FastPortable =
base64::engine::fast_portable::FastPortable::from(
&base64::alphabet::URL_SAFE,
base64::engine::fast_portable::NO_PAD,
);
macro_rules! exit_match {
($e: expr) => {
match $e {
@ -39,11 +45,11 @@ pub fn to_idna(domain_name: &str) -> Result<String, error::Error> {
}
pub fn b64_encode<T: ?Sized + AsRef<[u8]>>(input: &T) -> String {
base64::encode_config(input, base64::URL_SAFE_NO_PAD)
base64::encode_engine(input, &URL_SAFE_NO_PAD)
}
pub fn b64_decode<T: ?Sized + AsRef<[u8]>>(input: &T) -> Result<Vec<u8>, error::Error> {
let res = base64::decode_config(input, base64::URL_SAFE_NO_PAD)?;
let res = base64::decode_engine(input, &URL_SAFE_NO_PAD)?;
Ok(res)
}

Loading…
Cancel
Save