diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-04-07 16:18:33 +0200 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-04-07 21:47:58 +0200 |
commit | 5367e510e9c77d6c0a47c24b231b424e2b0aaf56 (patch) | |
tree | 86a562fc5f389c71ca1c44f387a6b65381f1c99b | |
parent | 5a85ee090d6626456771c7505e407a894b9e3267 (diff) |
openpgp: Allow setting multiple designated revokers
-rw-r--r-- | openpgp/src/packet/signature/subpacket.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/openpgp/src/packet/signature/subpacket.rs b/openpgp/src/packet/signature/subpacket.rs index 2e7294cd..605d48d2 100644 --- a/openpgp/src/packet/signature/subpacket.rs +++ b/openpgp/src/packet/signature/subpacket.rs @@ -2154,10 +2154,13 @@ impl signature::Builder { /// Sets the value of the Revocation Key subpacket, which contains /// a designated revoker. - pub fn set_revocation_key(mut self, rk: RevocationKey) -> Result<Self> { - self.hashed_area.replace(Subpacket::new( - SubpacketValue::RevocationKey(rk), - true)?)?; + pub fn set_revocation_key(mut self, rk: Vec<RevocationKey>) -> Result<Self> { + self.hashed_area.remove_all(SubpacketTag::RevocationKey); + for rk in rk.into_iter() { + self.hashed_area.add(Subpacket::new( + SubpacketValue::RevocationKey(rk), + true)?)?; + } Ok(self) } @@ -2539,7 +2542,7 @@ fn accessors() { let fp = Fingerprint::from_bytes(b"bbbbbbbbbbbbbbbbbbbb"); let rk = RevocationKey::new(pk_algo, fp.clone(), true); - sig = sig.set_revocation_key(rk.clone()).unwrap(); + sig = sig.set_revocation_key(vec![ rk.clone() ]).unwrap(); let sig_ = sig.clone().sign_hash(&mut keypair, hash.clone()).unwrap(); assert_eq!(sig_.revocation_keys().nth(0).unwrap(), &rk); |