summaryrefslogtreecommitdiffstats
path: root/openpgp/src/serialize.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2021-03-18 16:58:33 +0100
committerJustus Winter <justus@sequoia-pgp.org>2021-03-19 11:48:38 +0100
commite0f82bfdccde09712ff704ee17d3f0f6e73af5fe (patch)
treea748a65f5bfdda98c5c0b13bdaa5fcc2349241e4 /openpgp/src/serialize.rs
parent507e2a40d41622cbdd83277258af66346829ed40 (diff)
openpgp: Align equality, serialization of Key packets.
- Previously, serializing Packet::PublicKey(k) would not serialize any secret key material on k, but when comparing Packet::PublicKey(k) with Packet::PublicKey(l), the secret key material would be significant. This is in conflict with our definition of equality, which states that two objects are considered equal if their canonical serialized form is equal. - Closely related, secret key material was considered significant when comparing Key<_, _> objects, and secret key material was emitted when they were serialized, even for objects of type Key<PublicParts, _>. - Align equality, serialization of Key<_, _> objects by ignoring any secret key material when comparing and serializing objects of type Key<PublicParts, _>. - Fixes #632 and #633.
Diffstat (limited to 'openpgp/src/serialize.rs')
-rw-r--r--openpgp/src/serialize.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/openpgp/src/serialize.rs b/openpgp/src/serialize.rs
index b604d9d0..0e862692 100644
--- a/openpgp/src/serialize.rs
+++ b/openpgp/src/serialize.rs
@@ -1812,7 +1812,7 @@ impl<P, R> Marshal for Key4<P, R>
R: key::KeyRole,
{
fn serialize(&self, o: &mut dyn io::Write) -> Result<()> {
- self.serialize_key(o, true)
+ self.serialize_key(o, P::significant_secrets())
}
}
@@ -1883,7 +1883,7 @@ impl<P, R> MarshalInto for Key4<P, R>
R: key::KeyRole,
{
fn serialized_len(&self) -> usize {
- self.net_len_key(true)
+ self.net_len_key(P::significant_secrets())
}
fn serialize_into(&self, buf: &mut [u8]) -> Result<usize> {