diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-03-03 23:20:33 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-03-03 23:52:03 +0100 |
commit | a61bfdab687e9c0b6c5e263ed304f48183059a45 (patch) | |
tree | 545d516b6b2fe513f63caf3bcc81024338459583 /openpgp/src/parse/parse.rs | |
parent | 93dbeb3160262726d4c60b4811cf352c08dfc5b3 (diff) |
openpgp: Only impl Serialize for objects that are normally exported.
- Add two new traits: `Marshal` and `MarshalInto`.
- Implement them instead of `Serialize` and `SerializeInto`.
- Only implement `Serialize` and `SerializeInto` for data structures
that are normally exported.
- This should prevent users from accidentally serializing a bare
signature (`Signature`) when they meant to serialize a signature
packet (`Packet`), for instance.
- Fixes #368.
Diffstat (limited to 'openpgp/src/parse/parse.rs')
-rw-r--r-- | openpgp/src/parse/parse.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/openpgp/src/parse/parse.rs b/openpgp/src/parse/parse.rs index c7e8338b..7d899fcc 100644 --- a/openpgp/src/parse/parse.rs +++ b/openpgp/src/parse/parse.rs @@ -1172,7 +1172,7 @@ impl_parse_generic_packet!(Signature); #[test] fn signature_parser_test () { - use crate::serialize::SerializeInto; + use crate::serialize::MarshalInto; let data = crate::tests::message("sig.gpg"); { @@ -1790,7 +1790,7 @@ impl Key4<key::UnspecifiedParts, key::UnspecifiedRole> /// secret subkey packet. fn parse<'a, T: 'a + BufferedReader<Cookie>>(mut php: PacketHeaderParser<T>) -> Result<PacketParser<'a>> { use std::io::Cursor; - use crate::serialize::Serialize; + use crate::serialize::Marshal; make_php_try!(php); let tag = php.header.ctb().tag(); |