summaryrefslogtreecommitdiffstats
path: root/openpgp/tests
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-02-05 15:57:19 +0100
committerJustus Winter <justus@sequoia-pgp.org>2020-02-05 17:07:07 +0100
commit0d1be63b65ff6547fe50975a8b62e364dc7fb4c8 (patch)
treeacf40a55d81bd577b95eb10ea129264d52011639 /openpgp/tests
parentdf8474a1ecbc880c468799d22de10616ef96e318 (diff)
openpgp: Make Cert::into_packets() and to_vec() agree on sig order.
- The signatures are ordered from authenticated and most important to not authenticated and most likely to be abused. The order is: - Self revocations first. They are authenticated and the most important information. - Self signatures. They are authenticated. - Other signatures. They are not authenticated at this point. - Other revocations. They are not authenticated, and likely not well supported in other implementations, hence the least reliable way of revoking keys and therefore least useful and most likely to be abused.
Diffstat (limited to 'openpgp/tests')
-rw-r--r--openpgp/tests/for-each-artifact.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/openpgp/tests/for-each-artifact.rs b/openpgp/tests/for-each-artifact.rs
index 2d1b1822..5678bd79 100644
--- a/openpgp/tests/for-each-artifact.rs
+++ b/openpgp/tests/for-each-artifact.rs
@@ -69,6 +69,15 @@ mod for_each_artifact {
let w = p.as_tsk().to_vec().unwrap();
assert_eq!(v, w,
"Serialize and SerializeInto disagree on {:?}", p);
+
+ // Check that Cert::into_packets() and Cert::to_vec()
+ // agree.
+ let v = p.to_vec()?;
+ let mut buf = Vec::new();
+ for p in p.clone().into_packets() {
+ p.serialize(&mut buf)?;
+ }
+ assert_eq!(buf, v);
Ok(())
}).unwrap();
}