summaryrefslogtreecommitdiffstats
path: root/openpgp/examples/statistics.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-09-28 18:35:06 +0200
committerJustus Winter <justus@sequoia-pgp.org>2019-09-29 23:21:11 +0200
commit35f65b6d909d0c3766d66017bbcbaab8fcb4fb9a (patch)
tree8f2fc9710fbd9fbf65b73ee1a0cd297f7f6b8983 /openpgp/examples/statistics.rs
parent99ece8303958d463bfc85a2d04c5596b18829248 (diff)
openpgp: Collect statistics about exportable certs.
Diffstat (limited to 'openpgp/examples/statistics.rs')
-rw-r--r--openpgp/examples/statistics.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/openpgp/examples/statistics.rs b/openpgp/examples/statistics.rs
index 6311f63e..24fa6527 100644
--- a/openpgp/examples/statistics.rs
+++ b/openpgp/examples/statistics.rs
@@ -43,6 +43,8 @@ fn main() {
let mut sigs_subpacket_tags_size_count = vec![0; 256];
let mut sigs_subpacket_tags_size_min = vec![::std::u32::MAX; 256];
let mut sigs_subpacket_tags_size_max = vec![0; 256];
+ let mut sigs_subpacket_exportable_true = 0;
+ let mut sigs_subpacket_exportable_false = 0;
// Per-Signature statistics.
let mut signature_min = PerSignature::max();
@@ -168,6 +170,12 @@ fn main() {
} else {
p_aead.insert(a.clone(), 1);
},
+ SubpacketValue::ExportableCertification(v) =>
+ if v {
+ sigs_subpacket_exportable_true += 1;
+ } else {
+ sigs_subpacket_exportable_false += 1;
+ },
_ => (),
}
}
@@ -315,6 +323,22 @@ fn main() {
sigs_subpacket_tags_unknown[t],
"-", "-", "-", "-");
}
+
+ match SubpacketTag::from(t as u8) {
+ SubpacketTag::ExportableCertification => {
+ if sigs_subpacket_exportable_true > 0 {
+ println!("{:>30} {:>8}",
+ "ExportableCertification(true)",
+ sigs_subpacket_exportable_true);
+ }
+ if sigs_subpacket_exportable_false > 0 {
+ println!("{:>30} {:>8}",
+ "ExportableCertification(false)",
+ sigs_subpacket_exportable_false);
+ }
+ },
+ _ => (),
+ }
}
}