summaryrefslogtreecommitdiffstats
path: root/tool/src
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-04-15 14:08:09 +0200
committerJustus Winter <justus@sequoia-pgp.org>2020-04-15 15:48:23 +0200
commitf227657e17d1fdc5ff18e5cff224ebed3476416e (patch)
treee6e57d9d923d6371f7751e398b274323f48dc1fe /tool/src
parent896c71864a67231c6587fed066fbb2fbbac3165f (diff)
openpgp: Drop Cert::primary_userid.
- Fixes #484.
Diffstat (limited to 'tool/src')
-rw-r--r--tool/src/commands/decrypt.rs4
-rw-r--r--tool/src/sq.rs3
2 files changed, 5 insertions, 2 deletions
diff --git a/tool/src/commands/decrypt.rs b/tool/src/commands/decrypt.rs
index b6d27aa2..52778cdb 100644
--- a/tool/src/commands/decrypt.rs
+++ b/tool/src/commands/decrypt.rs
@@ -46,7 +46,9 @@ impl<'a> Helper<'a> {
let mut identities: HashMap<KeyID, Fingerprint> = HashMap::new();
let mut hints: HashMap<KeyID, String> = HashMap::new();
for tsk in secrets {
- let hint = match tsk.primary_userid(policy, None).ok() {
+ let hint = match tsk.with_policy(policy, None)
+ .and_then(|valid_cert| valid_cert.primary_userid()).ok()
+ {
Some(uid) => format!("{} ({})", uid.userid(),
KeyID::from(tsk.fingerprint())),
None => format!("{}", KeyID::from(tsk.fingerprint())),
diff --git a/tool/src/sq.rs b/tool/src/sq.rs
index 3e3df364..1d6c0a92 100644
--- a/tool/src/sq.rs
+++ b/tool/src/sq.rs
@@ -389,7 +389,8 @@ fn main() -> Result<()> {
let cert = Cert::from_reader(input)?;
let addr = m.value_of("address").map(|a| a.to_string())
.or_else(|| {
- cert.primary_userid(policy, None).ok()
+ cert.with_policy(policy, None)
+ .and_then(|vcert| vcert.primary_userid()).ok()
.map(|ca| ca.userid().to_string())
});
let ac = autocrypt::AutocryptHeader::new_sender(