Port to sequoia-cert-store 0.4.0.
This commit is contained in:
parent
f6b936d889
commit
1bad4fff20
196
Cargo.lock
generated
196
Cargo.lock
generated
@ -229,12 +229,6 @@ version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf"
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.21.5"
|
||||
@ -820,22 +814,13 @@ dependencies = [
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "4.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
|
||||
dependencies = [
|
||||
"dirs-sys 0.3.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "5.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"
|
||||
dependencies = [
|
||||
"dirs-sys 0.4.1",
|
||||
"dirs-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -848,17 +833,6 @@ dependencies = [
|
||||
"dirs-sys-next",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"redox_users",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys"
|
||||
version = "0.4.1"
|
||||
@ -1028,18 +1002,6 @@ version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d"
|
||||
|
||||
[[package]]
|
||||
name = "enum-as-inner"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c9720bba047d567ffc8a3cba48bf19126600e249ab7f128e9233e6376976a116"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "enum-as-inner"
|
||||
version = "0.6.0"
|
||||
@ -1520,7 +1482,7 @@ dependencies = [
|
||||
"async-trait",
|
||||
"cfg-if",
|
||||
"data-encoding",
|
||||
"enum-as-inner 0.6.0",
|
||||
"enum-as-inner",
|
||||
"futures-channel",
|
||||
"futures-io",
|
||||
"futures-util",
|
||||
@ -1713,17 +1675,6 @@ dependencies = [
|
||||
"cipher",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
|
||||
dependencies = [
|
||||
"matches",
|
||||
"unicode-bidi",
|
||||
"unicode-normalization",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.4.0"
|
||||
@ -2020,12 +1971,6 @@ dependencies = [
|
||||
"regex-automata 0.1.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "matches"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5"
|
||||
|
||||
[[package]]
|
||||
name = "md-5"
|
||||
version = "0.10.6"
|
||||
@ -2276,16 +2221,18 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
|
||||
|
||||
[[package]]
|
||||
name = "openpgp-cert-d"
|
||||
version = "0.1.2"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "972e59895bb68a14b00795d0bf04b3fb0dba3c10bac0a878dcd146dd107177e5"
|
||||
checksum = "d9697d17dfc2c9c0adc61a13ecb5029f8bbc56ffcc37e345729a1a7f38de6ef1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"dirs 4.0.0",
|
||||
"dirs",
|
||||
"fd-lock",
|
||||
"libc",
|
||||
"sha1collisiondetection",
|
||||
"tempfile",
|
||||
"thiserror",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2786,7 +2733,7 @@ version = "0.11.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b"
|
||||
dependencies = [
|
||||
"base64 0.21.5",
|
||||
"base64",
|
||||
"bytes",
|
||||
"encoding_rs",
|
||||
"futures-core",
|
||||
@ -3046,56 +2993,30 @@ version = "0.25.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e24fc0ec87c156a35f24fc153ab694e0f37cd6fa87c1cf5005c9f4fa5e10415b"
|
||||
dependencies = [
|
||||
"base64 0.21.5",
|
||||
"base64",
|
||||
"sequoia-openpgp",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sequoia-cert-store"
|
||||
version = "0.3.2"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "02cc866249ad73d5350e7c52ef1b3939129a7a1b52d9ca25ef220ee184c5b33e"
|
||||
checksum = "f44e2775a51e844809b1f393c5098dd414f79555b61b29a98f0dede289b86515"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"crossbeam",
|
||||
"dirs 5.0.1",
|
||||
"dirs",
|
||||
"num_cpus",
|
||||
"once_cell",
|
||||
"openpgp-cert-d",
|
||||
"rayon",
|
||||
"rusqlite",
|
||||
"sequoia-net 0.27.0",
|
||||
"sequoia-net",
|
||||
"sequoia-openpgp",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sequoia-net"
|
||||
version = "0.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "960f1ea77bf8b6f455285424257574d66fa29223e4286268017a4458cc29d33f"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.13.1",
|
||||
"futures-util",
|
||||
"http",
|
||||
"hyper",
|
||||
"hyper-tls",
|
||||
"libc",
|
||||
"native-tls",
|
||||
"percent-encoding",
|
||||
"sequoia-openpgp",
|
||||
"tempfile",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"trust-dns-client",
|
||||
"trust-dns-resolver",
|
||||
"url",
|
||||
"zbase32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sequoia-net"
|
||||
version = "0.28.0"
|
||||
@ -3103,7 +3024,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6abf810ba698339f332b946b485cc815c13a0f750189009bc10514c71fba814b"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.21.5",
|
||||
"base64",
|
||||
"futures-util",
|
||||
"hickory-client",
|
||||
"hickory-resolver",
|
||||
@ -3130,7 +3051,7 @@ dependencies = [
|
||||
"aes",
|
||||
"aes-gcm",
|
||||
"anyhow",
|
||||
"base64 0.21.5",
|
||||
"base64",
|
||||
"block-padding",
|
||||
"blowfish",
|
||||
"botan",
|
||||
@ -3209,7 +3130,7 @@ dependencies = [
|
||||
"clap",
|
||||
"clap_complete",
|
||||
"clap_mangen",
|
||||
"dirs 5.0.1",
|
||||
"dirs",
|
||||
"dot-writer",
|
||||
"fehler",
|
||||
"is-terminal",
|
||||
@ -3220,7 +3141,7 @@ dependencies = [
|
||||
"rpassword",
|
||||
"sequoia-autocrypt",
|
||||
"sequoia-cert-store",
|
||||
"sequoia-net 0.28.0",
|
||||
"sequoia-net",
|
||||
"sequoia-openpgp",
|
||||
"sequoia-policy-config",
|
||||
"sequoia-wot",
|
||||
@ -3237,9 +3158,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sequoia-wot"
|
||||
version = "0.8.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf5135009a31efa667ef38e517d848727585d854704ee8f36ca4b52b9b3d9765"
|
||||
checksum = "383672b024f126625127ec2b709b1e2f8d4814ab1bf4f800abb1a9fdc8dedcd3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
@ -3249,14 +3170,11 @@ dependencies = [
|
||||
"crossbeam",
|
||||
"dot-writer",
|
||||
"enumber",
|
||||
"lazy_static",
|
||||
"num_cpus",
|
||||
"openpgp-cert-d",
|
||||
"sequoia-cert-store",
|
||||
"sequoia-openpgp",
|
||||
"sequoia-policy-config",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3504,7 +3422,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2c5723f41235a3deefab3cfd6164a5b780802f596fa97eb40dfcf3c39c36b21"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.21.5",
|
||||
"base64",
|
||||
"clap",
|
||||
"env_logger",
|
||||
"file_diff",
|
||||
@ -3546,7 +3464,7 @@ version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fc3c17998cc92ec00493a7d1c0d0256f8977c7baed553777ba347dd6d1c3ccf"
|
||||
dependencies = [
|
||||
"base64 0.21.5",
|
||||
"base64",
|
||||
"fehler",
|
||||
"filetime",
|
||||
"fs2",
|
||||
@ -3926,72 +3844,6 @@ dependencies = [
|
||||
"tracing-log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "trust-dns-client"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c408c32e6a9dbb38037cece35740f2cf23c875d8ca134d33631cec83f74d3fe"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"data-encoding",
|
||||
"futures-channel",
|
||||
"futures-util",
|
||||
"lazy_static",
|
||||
"radix_trie",
|
||||
"rand",
|
||||
"thiserror",
|
||||
"time",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"trust-dns-proto",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "trust-dns-proto"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4f7f83d1e4a0e4358ac54c5c3681e5d7da5efc5a7a632c90bb6d6669ddd9bc26"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"cfg-if",
|
||||
"data-encoding",
|
||||
"enum-as-inner 0.5.1",
|
||||
"futures-channel",
|
||||
"futures-io",
|
||||
"futures-util",
|
||||
"idna 0.2.3",
|
||||
"ipnet",
|
||||
"lazy_static",
|
||||
"openssl",
|
||||
"rand",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"tinyvec",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "trust-dns-resolver"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aff21aa4dcefb0a1afbfac26deb0adc93888c7d295fb63ab273ef276ba2b7cfe"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"futures-util",
|
||||
"ipconfig",
|
||||
"lazy_static",
|
||||
"lru-cache",
|
||||
"parking_lot",
|
||||
"resolv-conf",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"trust-dns-proto",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "try-lock"
|
||||
version = "0.2.4"
|
||||
@ -4598,12 +4450,6 @@ version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80a0d98613370af88e15bd2047702d7c78c8c6aba44403eb227c8ad706871f92"
|
||||
|
||||
[[package]]
|
||||
name = "zbase32"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f9079049688da5871a7558ddacb7f04958862c703e68258594cb7a862b5e33f"
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.7.26"
|
||||
|
@ -42,8 +42,8 @@ chrono = "0.4.10"
|
||||
clap = { version = "4", features = ["derive", "env", "string", "wrap_help"] }
|
||||
itertools = ">=0.10, <0.13"
|
||||
once_cell = "1.17"
|
||||
sequoia-cert-store = "0.3"
|
||||
sequoia-wot = "0.8"
|
||||
sequoia-cert-store = "0.4"
|
||||
sequoia-wot = "0.9"
|
||||
tempfile = "3.1"
|
||||
tokio = { version = "1.13.1" }
|
||||
rpassword = "7.0"
|
||||
|
@ -711,9 +711,9 @@ impl<'a, 'store> VerificationHelper for VHelper<'a, 'store> {
|
||||
if ! ids.is_empty() {
|
||||
if let Ok(Some(cert_store)) = self.config.cert_store() {
|
||||
for id in ids.iter() {
|
||||
if let Ok(c) = cert_store.lookup_by_key(id) {
|
||||
if let Ok(c) = cert_store.lookup_by_cert_or_subkey(id) {
|
||||
certs.extend(
|
||||
c.into_iter().filter_map(|c| c.as_cert().ok()));
|
||||
c.into_iter().filter_map(|c| c.to_cert().ok().cloned()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ pub fn dispatch(config: Config, cmd: export::Command) -> Result<()> {
|
||||
}
|
||||
|
||||
for kh in cmd.key.iter() {
|
||||
if let Ok(certs) = cert_store.lookup_by_key(kh) {
|
||||
if let Ok(certs) = cert_store.lookup_by_cert_or_subkey(kh) {
|
||||
for cert in certs {
|
||||
if exported.get(&cert.fingerprint()).is_some() {
|
||||
// Already exported this one.
|
||||
|
@ -1,4 +1,4 @@
|
||||
use std::borrow::Cow;
|
||||
use std::sync::Arc;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use sequoia_openpgp as openpgp;
|
||||
@ -54,7 +54,7 @@ pub fn dispatch<'store>(mut config: Config<'store>, cmd: import::Command)
|
||||
let fingerprint = cert.fingerprint();
|
||||
let userid = best_effort_primary_uid(
|
||||
cert.to_cert()?, &policy, time).clone();
|
||||
if let Err(err) = cert_store.update_by(Cow::Owned(cert), &mut stats) {
|
||||
if let Err(err) = cert_store.update_by(Arc::new(cert), &mut stats) {
|
||||
wprintln!("Error importing {}, {:?}: {}",
|
||||
fingerprint, userid, err);
|
||||
stats.errors += 1;
|
||||
|
@ -66,7 +66,7 @@ pub fn dispatch(config: Config, c: inspect::Command)
|
||||
} else {
|
||||
let cert_store = config.cert_store_or_else()?;
|
||||
for cert in c.cert.into_iter() {
|
||||
let certs = cert_store.lookup_by_key(&cert)
|
||||
let certs = cert_store.lookup_by_cert_or_subkey(&cert)
|
||||
.with_context(|| format!("Looking up {}", cert))?;
|
||||
|
||||
// Include non-exportable signatures, etc.
|
||||
|
@ -1,4 +1,4 @@
|
||||
use std::borrow::Cow;
|
||||
use std::sync::Arc;
|
||||
use std::time::{Duration, SystemTime};
|
||||
|
||||
use anyhow::Context;
|
||||
@ -601,7 +601,7 @@ pub fn add(mut config: Config, c: link::AddCommand)
|
||||
let cert = cert.insert_packets(certifications.clone())?;
|
||||
|
||||
let cert_store = config.cert_store_mut_or_else()?;
|
||||
cert_store.update(Cow::Owned(cert.into()))
|
||||
cert_store.update(Arc::new(cert.into()))
|
||||
.with_context(|| format!("Updating {}", c.certificate))?;
|
||||
|
||||
Ok(())
|
||||
@ -756,7 +756,7 @@ pub fn retract(mut config: Config, c: link::RetractCommand)
|
||||
let cert = cert.insert_packets(certifications.clone())?;
|
||||
|
||||
let cert_store = config.cert_store_mut_or_else()?;
|
||||
cert_store.update(Cow::Owned(cert.into()))
|
||||
cert_store.update(Arc::new(cert.into()))
|
||||
.with_context(|| format!("Updating {}", c.certificate))?;
|
||||
|
||||
Ok(())
|
||||
|
@ -1,6 +1,5 @@
|
||||
//! Network services.
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
use std::time::SystemTime;
|
||||
@ -88,7 +87,7 @@ pub fn import_certs(config: &mut Config, certs: Vec<Cert>) -> Result<()> {
|
||||
wprintln!("\nImporting {} into the certificate store:\n",
|
||||
certs.len().of("certificate"));
|
||||
for (i, (fpr, userid, cert)) in certs.into_iter().enumerate() {
|
||||
cert_store.update_by(Cow::Owned(cert.into()), &mut stats)
|
||||
cert_store.update_by(Arc::new(cert.into()), &mut stats)
|
||||
.with_context(|| format!("Inserting {}, {}", fpr, Safe(&userid)))?;
|
||||
wprintln!(" {}. {} {}", i + 1, fpr, Safe(&userid));
|
||||
}
|
||||
@ -231,7 +230,7 @@ fn get_ca(config: &mut Config,
|
||||
Ok(cert) => {
|
||||
// Save it.
|
||||
let cert_store = config.cert_store_mut_or_else()?;
|
||||
cert_store.update(Cow::Owned(cert.clone().into()))
|
||||
cert_store.update(Arc::new(cert.clone().into()))
|
||||
.with_context(|| {
|
||||
format!("Saving {:?}", ca_userid)
|
||||
})?;
|
||||
|
16
src/sq.rs
16
src/sq.rs
@ -10,7 +10,6 @@ use anyhow::Context as _;
|
||||
use is_terminal::IsTerminal;
|
||||
|
||||
use std::borrow::Borrow;
|
||||
use std::borrow::Cow;
|
||||
use std::collections::btree_map::{BTreeMap, Entry};
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
@ -18,6 +17,7 @@ use std::io::Write;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str::FromStr;
|
||||
use std::time::{Duration, SystemTime};
|
||||
use std::sync::Arc;
|
||||
use once_cell::unsync::OnceCell;
|
||||
|
||||
use sequoia_openpgp as openpgp;
|
||||
@ -439,7 +439,7 @@ impl<'store> Config<'store> {
|
||||
for cert in parser {
|
||||
match cert {
|
||||
Ok(cert) => {
|
||||
keyring.update(Cow::Owned(cert.into()))
|
||||
keyring.update(Arc::new(cert.into()))
|
||||
.expect("implementation doesn't fail");
|
||||
}
|
||||
Err(err) => {
|
||||
@ -557,7 +557,7 @@ impl<'store> Config<'store> {
|
||||
|
||||
for kh in khs {
|
||||
let kh = kh.borrow();
|
||||
match self.cert_store_or_else()?.lookup_by_key(&kh) {
|
||||
match self.cert_store_or_else()?.lookup_by_cert_or_subkey(&kh) {
|
||||
Err(err) => {
|
||||
let err = anyhow::Error::from(err);
|
||||
return Err(err.context(
|
||||
@ -567,8 +567,8 @@ impl<'store> Config<'store> {
|
||||
Ok(certs) => {
|
||||
let mut certs = certs.into_iter()
|
||||
.filter_map(|cert| {
|
||||
match cert.as_cert() {
|
||||
Ok(cert) => Some(cert),
|
||||
match cert.to_cert() {
|
||||
Ok(cert) => Some(cert.clone()),
|
||||
Err(err) => {
|
||||
let err = err.context(
|
||||
format!("Failed to parse {} as loaded \
|
||||
@ -728,8 +728,8 @@ impl<'store> Config<'store> {
|
||||
};
|
||||
|
||||
// Parse the LazyCerts.
|
||||
let cert = match cert.into_owned().into_cert() {
|
||||
Ok(cert) => cert,
|
||||
let cert = match cert.to_cert() {
|
||||
Ok(cert) => cert.clone(),
|
||||
Err(err) => {
|
||||
let err = err.context(format!(
|
||||
"Error parsing {} ({:?})",
|
||||
@ -978,7 +978,7 @@ impl<'store> Config<'store> {
|
||||
// We also need to insert the trust root into the certificate
|
||||
// store, just without the secret key material.
|
||||
let cert_store = self.cert_store_mut_or_else()?;
|
||||
cert_store.update(Cow::Owned(special.clone().into()))
|
||||
cert_store.update(Arc::new(special.clone().into()))
|
||||
.with_context(|| format!("Inserting {}", name))?;
|
||||
|
||||
special
|
||||
|
Loading…
Reference in New Issue
Block a user