Port to sequoia-net 0.28.0.
This commit is contained in:
parent
62dbde6b03
commit
adc2ed4773
222
Cargo.lock
generated
222
Cargo.lock
generated
@ -956,6 +956,15 @@ dependencies = [
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding_rs"
|
||||
version = "0.8.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "endian-type"
|
||||
version = "0.1.2"
|
||||
@ -974,6 +983,18 @@ dependencies = [
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "enum-as-inner"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "enumber"
|
||||
version = "0.3.0"
|
||||
@ -1416,6 +1437,71 @@ version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
|
||||
|
||||
[[package]]
|
||||
name = "hickory-client"
|
||||
version = "0.24.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f3e08124cf0ddda93b1186d4af73599de401f3b52f14cd9aaa719049379462e"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"data-encoding",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"hickory-proto",
|
||||
"once_cell",
|
||||
"radix_trie",
|
||||
"rand",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hickory-proto"
|
||||
version = "0.24.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "091a6fbccf4860009355e3efc52ff4acf37a63489aad7435372d44ceeb6fbbcf"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"cfg-if",
|
||||
"data-encoding",
|
||||
"enum-as-inner 0.6.0",
|
||||
"futures-channel",
|
||||
"futures-io",
|
||||
"futures-util",
|
||||
"idna 0.4.0",
|
||||
"ipnet",
|
||||
"once_cell",
|
||||
"openssl",
|
||||
"rand",
|
||||
"thiserror",
|
||||
"tinyvec",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hickory-resolver"
|
||||
version = "0.24.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "35b8f021164e6a984c9030023544c57789c51760065cd510572fedcfb04164e8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"futures-util",
|
||||
"hickory-proto",
|
||||
"ipconfig",
|
||||
"lru-cache",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
"rand",
|
||||
"resolv-conf",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hkdf"
|
||||
version = "0.12.3"
|
||||
@ -1888,6 +1974,12 @@ version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fa0916b001582d253822171bd23f4a0229d32b9507fae236f5da8cad515ba7c"
|
||||
|
||||
[[package]]
|
||||
name = "mime"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
||||
|
||||
[[package]]
|
||||
name = "minimal-lexical"
|
||||
version = "0.2.1"
|
||||
@ -2624,6 +2716,44 @@ dependencies = [
|
||||
"windows-sys 0.45.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.11.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b"
|
||||
dependencies = [
|
||||
"base64 0.21.2",
|
||||
"bytes",
|
||||
"encoding_rs",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"h2",
|
||||
"http",
|
||||
"http-body",
|
||||
"hyper",
|
||||
"hyper-tls",
|
||||
"ipnet",
|
||||
"js-sys",
|
||||
"log",
|
||||
"mime",
|
||||
"native-tls",
|
||||
"once_cell",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"system-configuration",
|
||||
"tokio",
|
||||
"tokio-native-tls",
|
||||
"tower-service",
|
||||
"url",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
"winreg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "resolv-conf"
|
||||
version = "0.7.0"
|
||||
@ -2873,7 +3003,7 @@ dependencies = [
|
||||
"openpgp-cert-d",
|
||||
"rayon",
|
||||
"rusqlite",
|
||||
"sequoia-net",
|
||||
"sequoia-net 0.27.0",
|
||||
"sequoia-openpgp",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
@ -2905,6 +3035,31 @@ dependencies = [
|
||||
"zbase32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sequoia-net"
|
||||
version = "0.28.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6abf810ba698339f332b946b485cc815c13a0f750189009bc10514c71fba814b"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.21.2",
|
||||
"futures-util",
|
||||
"hickory-client",
|
||||
"hickory-resolver",
|
||||
"http",
|
||||
"hyper",
|
||||
"hyper-tls",
|
||||
"libc",
|
||||
"percent-encoding",
|
||||
"reqwest",
|
||||
"sequoia-openpgp",
|
||||
"tempfile",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"url",
|
||||
"z-base-32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sequoia-openpgp"
|
||||
version = "1.17.0"
|
||||
@ -3004,7 +3159,7 @@ dependencies = [
|
||||
"rpassword",
|
||||
"sequoia-autocrypt",
|
||||
"sequoia-cert-store",
|
||||
"sequoia-net",
|
||||
"sequoia-net 0.28.0",
|
||||
"sequoia-openpgp",
|
||||
"sequoia-policy-config",
|
||||
"sequoia-wot",
|
||||
@ -3083,6 +3238,18 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_urlencoded"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
|
||||
dependencies = [
|
||||
"form_urlencoded",
|
||||
"itoa",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_yaml"
|
||||
version = "0.8.26"
|
||||
@ -3388,6 +3555,27 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system-configuration"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"core-foundation",
|
||||
"system-configuration-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system-configuration-sys"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.6.0"
|
||||
@ -3731,7 +3919,7 @@ dependencies = [
|
||||
"async-trait",
|
||||
"cfg-if",
|
||||
"data-encoding",
|
||||
"enum-as-inner",
|
||||
"enum-as-inner 0.5.1",
|
||||
"futures-channel",
|
||||
"futures-io",
|
||||
"futures-util",
|
||||
@ -4019,6 +4207,18 @@ dependencies = [
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.87"
|
||||
@ -4048,6 +4248,16 @@ version = "0.2.87"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "widestring"
|
||||
version = "1.0.2"
|
||||
@ -4275,6 +4485,12 @@ dependencies = [
|
||||
"linked-hash-map",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "z-base-32"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80a0d98613370af88e15bd2047702d7c78c8c6aba44403eb227c8ad706871f92"
|
||||
|
||||
[[package]]
|
||||
name = "zbase32"
|
||||
version = "0.1.2"
|
||||
|
@ -34,7 +34,7 @@ dirs = "5"
|
||||
dot-writer = { version = "0.1.3", optional = true }
|
||||
sequoia-openpgp = { version = "1.17", default-features = false, features = ["compression-deflate"] }
|
||||
sequoia-autocrypt = { version = "0.25", default-features = false, optional = true }
|
||||
sequoia-net = { version = "0.27", default-features = false }
|
||||
sequoia-net = { version = "0.28", default-features = false }
|
||||
sequoia-policy-config = "0.6"
|
||||
anyhow = "1.0.18"
|
||||
chrono = "0.4.10"
|
||||
@ -65,7 +65,7 @@ clap_complete = "4"
|
||||
clap_mangen = "0.2"
|
||||
chrono = "0.4.10"
|
||||
sequoia-openpgp = { version = "1.17", default-features = false }
|
||||
sequoia-net = { version = "0.27", default-features = false }
|
||||
sequoia-net = { version = "0.28", default-features = false }
|
||||
subplot-build = { version = "0.7.0", optional = true }
|
||||
cfg-if = "1"
|
||||
terminal_size = "0.2.6"
|
||||
|
@ -1,7 +1,5 @@
|
||||
use clap::{Args, Parser, Subcommand};
|
||||
|
||||
use crate::cli::types::NetworkPolicy;
|
||||
|
||||
use super::types::ClapData;
|
||||
use super::types::FileOrCertStore;
|
||||
use super::types::FileOrStdout;
|
||||
@ -15,15 +13,6 @@ use super::types::FileOrStdout;
|
||||
arg_required_else_help = true,
|
||||
)]
|
||||
pub struct Command {
|
||||
#[clap(
|
||||
short,
|
||||
long,
|
||||
value_name = "NETWORK-POLICY",
|
||||
default_value_t = NetworkPolicy::Encrypted,
|
||||
value_enum,
|
||||
help = "Sets the network policy to use",
|
||||
)]
|
||||
pub network_policy: NetworkPolicy,
|
||||
#[clap(subcommand)]
|
||||
pub subcommand: Subcommands,
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
use clap::{Args, Parser, Subcommand};
|
||||
|
||||
use crate::cli::types::NetworkPolicy;
|
||||
|
||||
use super::types::ClapData;
|
||||
use super::types::FileOrCertStore;
|
||||
use super::types::FileOrStdin;
|
||||
@ -15,15 +13,6 @@ use super::types::FileOrStdout;
|
||||
arg_required_else_help = true,
|
||||
)]
|
||||
pub struct Command {
|
||||
#[clap(
|
||||
short = 'p',
|
||||
long = "policy",
|
||||
value_name = "NETWORK-POLICY",
|
||||
default_value_t = NetworkPolicy::Encrypted,
|
||||
help = "Sets the network policy to use",
|
||||
value_enum,
|
||||
)]
|
||||
pub network_policy: NetworkPolicy,
|
||||
#[clap(
|
||||
short,
|
||||
long,
|
||||
|
@ -615,25 +615,6 @@ impl Display for Expiry {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(ValueEnum, Clone, Debug)]
|
||||
pub enum NetworkPolicy {
|
||||
Offline,
|
||||
Anonymized,
|
||||
Encrypted,
|
||||
Insecure,
|
||||
}
|
||||
|
||||
impl From<NetworkPolicy> for sequoia_net::Policy {
|
||||
fn from(kp: NetworkPolicy) -> Self {
|
||||
match kp {
|
||||
NetworkPolicy::Offline => sequoia_net::Policy::Offline,
|
||||
NetworkPolicy::Anonymized => sequoia_net::Policy::Anonymized,
|
||||
NetworkPolicy::Encrypted => sequoia_net::Policy::Encrypted,
|
||||
NetworkPolicy::Insecure => sequoia_net::Policy::Insecure,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Holds a session key as parsed from the command line, with an optional
|
||||
/// algorithm specifier.
|
||||
///
|
||||
|
@ -2,8 +2,6 @@ use std::path::PathBuf;
|
||||
|
||||
use clap::{Args, Parser, Subcommand};
|
||||
|
||||
use crate::cli::types::NetworkPolicy;
|
||||
|
||||
use super::types::ClapData;
|
||||
use super::types::FileOrCertStore;
|
||||
use super::types::FileOrStdin;
|
||||
@ -17,15 +15,6 @@ use super::types::FileOrStdout;
|
||||
arg_required_else_help = true,
|
||||
)]
|
||||
pub struct Command {
|
||||
#[clap(
|
||||
short,
|
||||
long,
|
||||
value_name = "NETWORK-POLICY",
|
||||
default_value_t = NetworkPolicy::Encrypted,
|
||||
value_enum,
|
||||
help = "Sets the network policy to use",
|
||||
)]
|
||||
pub network_policy: NetworkPolicy,
|
||||
#[clap(subcommand)]
|
||||
pub subcommand: Subcommands,
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ use openpgp::{
|
||||
},
|
||||
parse::Parse,
|
||||
policy::NullPolicy,
|
||||
serialize::Serialize,
|
||||
types::SignatureType,
|
||||
};
|
||||
use sequoia_net as net;
|
||||
@ -351,7 +350,6 @@ fn certify_downloads(config: &mut Config,
|
||||
pub fn dispatch_keyserver(mut config: Config, c: cli::keyserver::Command)
|
||||
-> Result<()>
|
||||
{
|
||||
let network_policy = c.network_policy.into();
|
||||
let uri = &c.server[..];
|
||||
|
||||
// Get the filename for the CA's key and the default User ID.
|
||||
@ -395,7 +393,7 @@ pub fn dispatch_keyserver(mut config: Config, c: cli::keyserver::Command)
|
||||
};
|
||||
let ca_trust_amount = 1;
|
||||
|
||||
let mut ks = KeyServer::new(network_policy, uri)
|
||||
let ks = KeyServer::new(uri)
|
||||
.context("Malformed keyserver URI")?;
|
||||
|
||||
let rt = tokio::runtime::Builder::new_current_thread()
|
||||
@ -411,30 +409,28 @@ pub fn dispatch_keyserver(mut config: Config, c: cli::keyserver::Command)
|
||||
let handle = query.parse::<KeyHandle>();
|
||||
|
||||
if let Ok(handle) = handle {
|
||||
let cert = rt.block_on(ks.get(handle))
|
||||
let certs = rt.block_on(ks.get(handle))
|
||||
.context("Failed to retrieve cert")?;
|
||||
let certs = certs.into_iter().filter_map(Result::ok).collect::<Vec<Cert>>();
|
||||
|
||||
if let Some(file) = c.output {
|
||||
let mut output = file.create_safe(config.force)?;
|
||||
if !c.binary {
|
||||
cert.armored().serialize(&mut output)
|
||||
} else {
|
||||
cert.serialize(&mut output)
|
||||
}.context("Failed to serialize cert")?;
|
||||
serialize_keyring(&mut output, &certs, c.binary)?;
|
||||
} else {
|
||||
let certs = if let Some((ca_filename, ca_userid)) = ca() {
|
||||
certify_downloads(
|
||||
&mut config, &ca_filename, &ca_userid,
|
||||
ca_trust_amount,
|
||||
vec![ cert ], None)
|
||||
certs, None)
|
||||
} else {
|
||||
vec![ cert ]
|
||||
certs
|
||||
};
|
||||
import_certs(&mut config, certs)?;
|
||||
}
|
||||
} else if let Ok(Some(addr)) = UserID::from(query.as_str()).email2() {
|
||||
let certs = rt.block_on(ks.search(addr))
|
||||
.context("Failed to retrieve certs")?;
|
||||
let certs = certs.into_iter().filter_map(Result::ok).collect::<Vec<Cert>>();
|
||||
|
||||
if let Some(file) = c.output {
|
||||
let mut output = file.create_safe(config.force)?;
|
||||
@ -470,8 +466,6 @@ pub fn dispatch_keyserver(mut config: Config, c: cli::keyserver::Command)
|
||||
}
|
||||
|
||||
pub fn dispatch_wkd(mut config: Config, c: cli::wkd::Command) -> Result<()> {
|
||||
let network_policy: net::Policy = c.network_policy.into();
|
||||
|
||||
let ca_filename = "_wkd.pgp";
|
||||
let ca_userid = "Downloaded from a WKD";
|
||||
let ca_trust_amount = 1;
|
||||
@ -500,16 +494,14 @@ pub fn dispatch_wkd(mut config: Config, c: cli::wkd::Command) -> Result<()> {
|
||||
output.write(config.output_format, &mut std::io::stdout())?;
|
||||
},
|
||||
Get(c) => {
|
||||
// Check that the policy allows https.
|
||||
network_policy.assert(net::Policy::Encrypted)?;
|
||||
|
||||
let email_address = c.email_address;
|
||||
// XXX: EmailAddress could be created here to
|
||||
// check it's a valid email address, print the error to
|
||||
// stderr and exit.
|
||||
// Because it might be created a WkdServer struct, not
|
||||
// doing it for now.
|
||||
let certs = rt.block_on(wkd::get(&email_address))?;
|
||||
let certs = rt.block_on(wkd::get(&net::reqwest::Client::new(), &email_address))?;
|
||||
let certs = certs.into_iter().filter_map(Result::ok).collect::<Vec<Cert>>();
|
||||
// ```text
|
||||
// The HTTP GET method MUST return the binary representation of the
|
||||
// OpenPGP key for the given mail address.
|
||||
@ -569,8 +561,6 @@ pub fn dispatch_dane(mut config: Config, c: cli::dane::Command) -> Result<()> {
|
||||
let ca_userid = "Downloaded from DANE";
|
||||
let ca_trust_amount = 1;
|
||||
|
||||
let network_policy: net::Policy = c.network_policy.into();
|
||||
|
||||
let rt = tokio::runtime::Builder::new_current_thread()
|
||||
.enable_io()
|
||||
.enable_time()
|
||||
@ -579,9 +569,6 @@ pub fn dispatch_dane(mut config: Config, c: cli::dane::Command) -> Result<()> {
|
||||
use crate::cli::dane::Subcommands::*;
|
||||
match c.subcommand {
|
||||
Get(c) => {
|
||||
// Check that the policy allows https.
|
||||
network_policy.assert(net::Policy::Encrypted)?;
|
||||
|
||||
let email_address = c.email_address;
|
||||
// XXX: EmailAddress could be created here to
|
||||
// check it's a valid email address, print the error to
|
||||
@ -589,6 +576,7 @@ pub fn dispatch_dane(mut config: Config, c: cli::dane::Command) -> Result<()> {
|
||||
// Because it might be created a WkdServer struct, not
|
||||
// doing it for now.
|
||||
let certs = rt.block_on(dane::get(&email_address))?;
|
||||
let certs = certs.into_iter().filter_map(Result::ok).collect::<Vec<Cert>>();
|
||||
if let Some(file) = c.output {
|
||||
let mut output = file.create_safe(config.force)?;
|
||||
serialize_keyring(&mut output, &certs, c.binary)?;
|
||||
|
Loading…
Reference in New Issue
Block a user