diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2024-04-17 18:01:55 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2024-05-07 09:10:32 +0200 |
commit | 2743369cbe6a09fcb37fb70be1e87b4c83a8a35e (patch) | |
tree | 94e6d3f116dfe6cbac38e184d7bf5368eb3d7329 /openpgp | |
parent | a647f7a8e6e43071b1c62e5fe9fa10e3d439120b (diff) |
openpgp: Use the new functions to strip secret key material.
Diffstat (limited to 'openpgp')
-rw-r--r-- | openpgp/src/cert.rs | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/openpgp/src/cert.rs b/openpgp/src/cert.rs index 6deccd10..d6dce9cb 100644 --- a/openpgp/src/cert.rs +++ b/openpgp/src/cert.rs @@ -3180,18 +3180,10 @@ impl Cert { /// # } /// ``` pub fn strip_secret_key_material(mut self) -> Cert { - let (pk, _sk) = self.primary.component.take_secret(); - self.primary.component = pk; - - let subkeys = self.subkeys.into_iter() - .map(|mut kb| { - let (pk, _sk) = kb.component.take_secret(); - kb.component = pk; - kb - }) - .collect::<Vec<_>>(); - self.subkeys = subkeys.into(); - + self.primary.key_mut().steal_secret(); + self.subkeys.iter_mut().for_each(|sk| { + sk.key_mut().steal_secret(); + }); self } |