base64 0.20

This commit is contained in:
Jack Grigg
2022-12-30 05:01:24 +00:00
parent 0490dd3529
commit d8ab6e373e
3 changed files with 22 additions and 8 deletions
Generated
+10 -4
View File
@@ -24,7 +24,7 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3d2e815ac879dc23c1139e720d21c6cd4d1276345c772587285d965a69b8f32" checksum = "e3d2e815ac879dc23c1139e720d21c6cd4d1276345c772587285d965a69b8f32"
dependencies = [ dependencies = [
"base64", "base64 0.13.1",
"chacha20poly1305", "chacha20poly1305",
"cookie-factory", "cookie-factory",
"hkdf", "hkdf",
@@ -43,7 +43,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4564b93d746fc5947e08ee2b9b3f990df89133803857b6ee0dad8b0efeb8bc79" checksum = "4564b93d746fc5947e08ee2b9b3f990df89133803857b6ee0dad8b0efeb8bc79"
dependencies = [ dependencies = [
"age-core", "age-core",
"base64", "base64 0.13.1",
"bech32", "bech32",
"chrono", "chrono",
] ]
@@ -54,7 +54,7 @@ version = "0.3.2"
dependencies = [ dependencies = [
"age-core", "age-core",
"age-plugin", "age-plugin",
"base64", "base64 0.20.0",
"bech32", "bech32",
"console", "console",
"dialoguer", "dialoguer",
@@ -154,6 +154,12 @@ version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]]
name = "base64"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ea22880d78093b0cbe17c89f64a7d457941e65759157ec6cb31a31d652b05e5"
[[package]] [[package]]
name = "base64ct" name = "base64ct"
version = "1.5.3" version = "1.5.3"
@@ -2103,7 +2109,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8"
dependencies = [ dependencies = [
"asn1-rs", "asn1-rs",
"base64", "base64 0.13.1",
"data-encoding", "data-encoding",
"der-parser", "der-parser",
"lazy_static", "lazy_static",
+1 -1
View File
@@ -24,7 +24,7 @@ assets = [
[dependencies] [dependencies]
age-core = "0.9" age-core = "0.9"
age-plugin = "0.4" age-plugin = "0.4"
base64 = "0.13" base64 = "0.20"
bech32 = "0.9" bech32 = "0.9"
console = { version = "0.15", default-features = false } console = { version = "0.15", default-features = false }
dialoguer = { version = "0.9", default-features = false, features = ["password"] } dialoguer = { version = "0.9", default-features = false, features = ["password"] }
+11 -3
View File
@@ -18,6 +18,14 @@ const TAG_BYTES: usize = 4;
const EPK_BYTES: usize = 33; const EPK_BYTES: usize = 33;
const ENCRYPTED_FILE_KEY_BYTES: usize = 32; const ENCRYPTED_FILE_KEY_BYTES: usize = 32;
const STANDARD_NO_PAD: &base64::engine::fast_portable::FastPortable = {
use base64::{
alphabet::STANDARD,
engine::fast_portable::{FastPortable, NO_PAD},
};
&FastPortable::from(&STANDARD, NO_PAD)
};
/// The ephemeral key bytes in a piv-p256 stanza. /// The ephemeral key bytes in a piv-p256 stanza.
/// ///
/// The bytes contain a compressed SEC-1 encoding of a valid point. /// The bytes contain a compressed SEC-1 encoding of a valid point.
@@ -65,8 +73,8 @@ impl From<RecipientLine> for Stanza {
Stanza { Stanza {
tag: STANZA_TAG.to_owned(), tag: STANZA_TAG.to_owned(),
args: vec![ args: vec![
base64::encode_config(&r.tag, base64::STANDARD_NO_PAD), base64::encode_engine(&r.tag, STANDARD_NO_PAD),
base64::encode_config(r.epk_bytes.as_bytes(), base64::STANDARD_NO_PAD), base64::encode_engine(r.epk_bytes.as_bytes(), STANDARD_NO_PAD),
], ],
body: r.encrypted_file_key.to_vec(), body: r.encrypted_file_key.to_vec(),
} }
@@ -84,7 +92,7 @@ impl RecipientLine {
return None; return None;
} }
base64::decode_config_slice(arg, base64::STANDARD_NO_PAD, buf.as_mut()) base64::decode_engine_slice(arg, buf.as_mut(), STANDARD_NO_PAD)
.ok() .ok()
.map(|_| buf) .map(|_| buf)
} }