summaryrefslogtreecommitdiffstats
path: root/openpgp/tests
AgeCommit message (Collapse)Author
2023-03-02openpgp: Add missing test vector.Justus Winter
- This wasn't caught by the CI because none of the current backends implement ElGamal. - Fixes 2b4cfe58604202e0a2515cf7e3de72245d2c6633.
2023-03-01openpgp: Add high-level encryption and signing roundtrip tests.Justus Winter
2022-12-12openpgp: Fix how text signatures are hashed.Neal H. Walfield
- When hashing text signatures in which `cr`, `lf`, and `crlf` are normalized to `crlf`, if a `crlf` was split across two hash updates, two `crlf`s would be hashed (one for the final `cr` in the first update, and one for the leading `lf` in the second update) instead of just one. - Fix it. - Fixes #960.
2022-11-11openpgp: Add support for verifying v3 signatures.Neal H. Walfield
- RFC 4880 explicitly allows the use of v3 signatures, but adds: > Implementations SHOULD accept V3 signatures. Implementations > SHOULD generate V4 signatures. - In practice, rpm-based distributions are generating v3 signatures, and it will be awhile before we can actually stop supporting them. https://bugzilla.redhat.com/show_bug.cgi?id=2141686#c20 - Add support for parsing, verifying, and serializing v3 signatures (but not v3 certificates, and not generating v3 signatures!).
2022-05-09openpgp: Add a v3 certificate and key.Justus Winter
2022-02-22openpgp: Fix decrypting SKESK4 packets, simple S2K, no ESK.Justus Winter
- Previously, Sequoia refused to decrypt ESK-less SKESK4 using S2K::Simple. This behavior was introduced very early on in 2a66a5aa. In the commit message, Kai wrote: Also fixed a bug where ESK-less SKESK with simple S2K were accepted despite the RFC forbidding it. Which is an odd conclusion because the last paragraph of Section 5.3 is right next to the paragraph talking about having an ESK. - In any case, I think this advice actually applies to both variants. In both cases, CFB is used with an all zero IV, and then a high-entropy session key (if ESK is present) or a high-entropy first block (if we're using the SK to encrypt with a SEIPD packet). If session-key reuse is a problem despite the plaintext starting with a high-entropy string, then it is a problem in either case. - I see that as an advice for producers, I don't see any harm in consuming and decrypting such an artifact. - Fixes #796.
2022-02-16openpgp: Fix verifying cleartext signed messages with multiple sigs.Justus Winter
- We implement the cleartext signature framework by transforming the message on the fly to a signed message, then using our parsing framework as usual. However, we need to tweak the behavior slightly. - Notably, our CSF transformation yields just one OPS packet per encountered 'Hash' algorithm header, and it cannot know how many signatures are in fact following. Therefore, the message will not be well-formed according to the grammar. But, since we created the message structure during the transformation, we know it is good, even if it is a little out of spec. - This patch tweaks the streaming verifier's behavior to accommodate this.
2021-09-08openpgp: Constrain AEAD chunk sizes.Justus Winter
- Make sure that chunk sizes are between 64B and 4MiB. - Fixes a DoS resulting from unconstrained, attacker-controlled heap allocations. - Fixes #738.
2021-08-30openpgp: New encryption test vectors that don't use compression.Justus Winter
- Previously, the test parse::stream::test::decryptor broke if Sequoia was built without compression support because they used an compression container. Recreate the test vectors without compression. - Fixes #744.
2021-07-09openpgp: Fix CertParser::reset.Nora Widdecke
Preserve the filters through CertParser::reset.
2021-06-07openpgp: Add decryption test vectors.Justus Winter
- These test vectors are generated by GnuPG (and the one with the unclamped cv25519 secret by RNP).
2021-04-13bench: Add encrypt+sign and decrypt+verify.Nora Widdecke
2021-04-08Update MSRV to 1.48.0Nora Widdecke
- Update our MSRV to the one used in Debian bullseye, 1.48.0.
2021-03-17openpgp: Add 1pa3pc test vector from dkgpg.Justus Winter
- See #335 and https://savannah.nongnu.org/bugs/index.php?60154
2021-03-05openpgp: Fix panic when verifying signatures.Wiktor Kwapisiewicz
- Signatures with no layers generated panic at runtime as zeroth index was not available. - Make `Decryptor::from_buffered_reader` return Err when no layers are available. - Fixes #682.
2021-02-24openpgp: Verify messages using the Cleartext Signature Framework.Justus Winter
- Implement verification of messages using the Cleartext Signature Framework by detecting them in the armor reader, and transforming them on the fly to inline signed messages. - The transformation is not perfect. We need to synthesize one-pass-signatures, but we only know the hash algorithm(s) used. Luckily, this is the only information the packet parser needs. - We only enable the transformation when using stream::Verifier. The transformation is transparent to the caller. Currently, there is no way to disable this. In the next major revision, we may add ways to control this behavior. - Fixes #151.
2020-12-22openpgp: Correctly handle keys where a primary key is also a subkey.Neal H. Walfield
- It is possible for a primary key to also be a subkey. - Correctly handle that case. - In particular, don't merge Public Key packets with Public Subkey packets, etc.
2020-12-14openpgp: Fix crash in the packet parser.Justus Winter
- If no data has been read, that may indicate an error. In this case, even requesting no data may fail.
2020-11-27openpgp: Improve debugging output.Neal H. Walfield
- When two serialized messages in the for-each-artifact test differ, print more helpful debugging output.
2020-11-24openpgp: Accept any number of (unicode) dashes in armor framing.Justus Winter
- Fixes #610.
2020-11-24openpgp: Handle truncated armor prefixes.Justus Winter
- Fixes #618.
2020-11-13openpgp: Add the vectors from The first collision for full SHA-1.Justus Winter
2020-11-12openpgp: Add test vector from SHA-1 is a Shambles.Justus Winter
2020-10-18openpgp: Change Cert::into_packets to not drop any information.Neal H. Walfield
- Change `Cert::into_packets` to return the underlying packets. That is don't drop secret key material like `Cert::serialize` does.
2020-10-14Replace most 'extern crate' directives with 'use'.Justus Winter
- See #480.
2020-10-06Remove top-level sequoia packageIgor Matuszewski
This runs into surprising interactions when trying to build member packages with other than default feature set. See https://gitlab.com/sequoia-pgp/sequoia/-/issues/575 for more info.
2020-08-17openpgp: Move crypto::Keygrip to the ipc crate.Justus Winter
2020-08-17openpgp: Move crypto::sexp to the ipc crate.Justus Winter
- This is only used to communicate with the GnuPG agent, so it should not be in the openpgp crate.
2020-08-07openpgp: Check that primary key binding signatures are alive.Justus Winter
- Fixes #539.
2020-08-07openpgp: Apply the policy to primary key binding signatures.Justus Winter
- Fixes #531.
2020-07-15openpgp: Gracefully handle malformed notation names.Justus Winter
2020-06-05openpgp: Fix parsing.Justus Winter
- Previously, a signature packet with a malformed embedded signature would break the parsing, because the embedded signature is turned into an unknown packet, hence `Signature::from_reader` returns `Error::InvalidOperation` and so does `SubpacketArea::parse`. Errors from that function are handled using php_try!, but that did not make the packet turn into an unknown packet, but terminated the parsing. - Looking at `Subpacket::parse` revealed that there are more errors that would terminate parsing in the outlined way, notably `Error::MalformedPacket`, but there may be others. - Fix this by tweaking php_try! to return unknown packets on any `openpgp::Error`.
2020-04-30openpgp: Improve documentation of the parse module.Justus Winter
- See #471.
2020-04-27openpgp: Fix tests when building without compression support.Justus Winter
- Fixes #495.
2020-04-20openpgp: Add armor::Writer::with_headers.Justus Winter
- Add a new constructor that takes headers. This allows us to make the header argument polymorphic.
2020-04-16Revert "openpgp: Make PacketParserResult a std::result::Result."Justus Winter
This reverts commit 2e1eec5fe4157a391a13554ff7df3075cfe043cc.
2020-04-15openpgp: We don't throw away components with no self signaturesNeal H. Walfield
- We don't throw away components with no (valid) self signatures. - Add a test demonstrating this. - Correct the documentation.
2020-04-09openpgp: Make PacketParserResult a std::result::Result.Justus Winter
- This avoids the partial implementation imitating std::option::Option, replacing it with std::result::Result. - As a benefit, std::result::Result is in the prelude, simplifying a lot of parsing loops.
2020-04-09openpgp: Rename PacketParserBuilder::finalize to build.Justus Winter
- Writers should be finalized, builders should be built.
2020-03-31openpgp: Implement Preferences for ValidCert.Neal H. Walfield
- Preferences should be implemented for ValidComponentAmalgamation and ValidCert, not ValidComponentAmalgamation and ValidKeyAmalgamation. - Adjust the Preferences trait since ValidCert doesn't implement ValidAmalgamation.
2020-03-26openpgp: Fix test.Justus Winter
2020-03-13openpgp: Avoid casts.Justus Winter
2020-03-10openpgp: Fix keygrip computation.Justus Winter
- If we strip the opaque encoding marker, preserve any leading zeros. - Fixes #439.
2020-03-09Switch from failure to anyhow.Justus Winter
- Use the anyhow crate instead of failure to implement the dynamic side of our error handling. anyhow::Error derefs to dyn std::error::Error, allowing better interoperability with other stdlib-based error handling libraries. - Fixes #444.
2020-03-03openpgp: Only impl Serialize for objects that are normally exported.Neal H. Walfield
- 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.
2020-02-19openpgp: Add test.Justus Winter
- This test demonstrates that we consider binding signatures valid even if the primary key is not marked as certification-capable. - Fixes #321.
2020-02-11openpgp: Enable weak hash algorithms.Justus Winter
- Now that we have the policy trait, we can enable weak hash algorithms. Enable MD5 and RipeMD160. - Add test vectors.
2020-02-07openpgp: Conclude this patch series.Justus Winter
- This patch series adds methods to query key constraints and other key-related signature subpackets to trait Amalgamation. Key-related subpackets are relevant to all components. Recall that primary key constraints may be expressed on userid binding signatures, and that userid components may be stripped off. - We do the same for the key holder's preference packets. These subpackets are not relevant to subkeys, therefore we introduced a new trait Preferences that is implemented for valid componentsand primary keys. - Add the original test case from the bug report. - Fixes #215.
2020-02-06autocrypt: New crate.Justus Winter
- Move the autocrypt-related functionality to a new crate. - Fixes #424.
2020-02-05openpgp: Fix handling of unknown components during canonicalization.Justus Winter
- Previously, signatures following an unknown packet (like a version 3 signature) were attributed to the unknown component. To fix that, try to reorder all signatures on unknown components. If we fail, we put them back where we found them, assuming they are at the correct location on an component unknown to us. - Also split signatures of unknown components. - Add test case.