diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2021-01-14 09:35:19 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2021-01-14 09:59:44 +0100 |
commit | de5c18230ddcad3928ae5c4bd2c1badbe9ec2e92 (patch) | |
tree | d55f38ec070a685d76ee2d18c0a334cbed6f24bf | |
parent | fa63210fc1bb58a3a874fd0110ca7585eb2c0483 (diff) |
openpgp: Simplify Cert::merge_public.
-rw-r--r-- | openpgp/src/cert.rs | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/openpgp/src/cert.rs b/openpgp/src/cert.rs index 54720fcd..0faa2996 100644 --- a/openpgp/src/cert.rs +++ b/openpgp/src/cert.rs @@ -2062,14 +2062,7 @@ impl Cert { /// ``` pub fn merge_public(self, other: Cert) -> Result<Self> { // Strip all secrets from `other`. - let other_public = Cert::from_packets( - other.into_packets().map(|p| match p { - Packet::PublicKey(k) => k.take_secret().0.into(), - Packet::SecretKey(k) => k.take_secret().0.into(), - Packet::PublicSubkey(k) => k.take_secret().0.into(), - Packet::SecretSubkey(k) => k.take_secret().0.into(), - p => p, - }))?; + let other_public = other.strip_secret_key_material(); // Then merge it. self.merge_public_and_secret(other_public) } |