summaryrefslogtreecommitdiffstats
path: root/openpgp/src/serialize/cert.rs
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp/src/serialize/cert.rs')
-rw-r--r--openpgp/src/serialize/cert.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/openpgp/src/serialize/cert.rs b/openpgp/src/serialize/cert.rs
index 3278ea2b..4d98569a 100644
--- a/openpgp/src/serialize/cert.rs
+++ b/openpgp/src/serialize/cert.rs
@@ -91,6 +91,10 @@ impl Cert {
fn serialize_common(&self, o: &mut dyn std::io::Write, export: bool)
-> Result<()>
{
+ if export && ! self.exportable() {
+ return Ok(())
+ }
+
let primary = self.primary_key();
PacketRef::PublicKey(primary.key())
.serialize(o)?;
@@ -552,6 +556,10 @@ impl<'a> TSK<'a> {
}
};
+ if export && ! self.cert.exportable() {
+ return Ok(())
+ }
+
let primary = self.cert.primary_key();
serialize_key(o, primary.key().into(),
Tag::PublicKey, Tag::SecretKey)?;