rpgp: Problem verifying puppet release files

I’ve been using this in an application to verify PGP signatures in debian repositories, which has been working well for the most part. But for some reason it does not verify Puppets repository release files, and I can’t exactly tell why.

public key: https://apt.puppetlabs.com/DEB-GPG-KEY-puppet-20250406

inline-signed cleartext message https://apt.puppetlabs.com/dists/bookworm/InRelease

The id and fingerprints matches, but the verification fails here:

ensure_eq!(
    &self.signed_hash_value,
    &hash[0..2],
    "signature: invalid signed hash value"
);

Any idea why this would be? The gpg utility gives the signature an all clear.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Right, I’ll be looking through it more thoroughly this week. And I don’t particularly mind API changes at this stage, and I’ll see if the current stage of things match what I need right now. I’ll be doing some experimenting!

Yep, looks very cool! Thanks for sharing, I’m taking a look 👀

It is!

https://github.com/cyr/aptmirs

It’s a debian repository mirroring tool. Written because the other ones (apt-mirror and debmirror in particular) have some problems mirroring repositories that are hosted under specific paths, and not really being up to date on some particulars. And while rsync is nice and good, sometimes the repository you want to mirror isn’t available with rsync. And you might also not care about mirroring every arch!

Appreciate it! And I will let you know know if I find anything more on this.

Thanks, great!

CSF is super fiddly about normalization (including, but not limited to line ending encoding). Apparently some edge case is wrong in rPGP, and this message triggers the bug.

My next step will be to add a unit test with these two files to rPGP (followed by a period of cursing, presumably 😄)

Yup, I’m getting error: pgp::errors::Error - "failed reading: cleartext body Error(Error { input: [79, 114, 105, with this sample code:

use pgp::composed::cleartext::CleartextSignedMessage;
use pgp::composed::SignedPublicKey;
use pgp::Deserializable as _;
fn main() -> testresult::TestResult {
    let key = SignedPublicKey::from_armor_single(std::fs::File::open(
        "/home/wiktor/tmp/armored-keys.asc",
    )?)?
    .0;
    let msg =
        CleartextSignedMessage::from_armor(std::fs::File::open("/home/wiktor/tmp/InRelease")?)?;
    msg.0.verify(&key)?;

    Ok(())
}

Appreciate it! And I will let you know know if I find anything more on this.