aptly icon indicating copy to clipboard operation
aptly copied to clipboard

"tag byte does not have MSB set" whith gpg_provider internal

Open JupiterRider opened this issue 5 months ago • 1 comments

Hey @neolynx ,

when using the internal gpg_provider, I get the following error when creating or updating a mirror:

unable to initialize GPG verifier: failure loading trustedkeys.gpg keyring: openpgp: invalid data: tag byte does not have MSB set

I am using aptly 1.6.2. Here is a short example using the API, when trying to mirror the vscodium repo:

def add_key():
    resp = requests.get(
        "https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg")

    body = {
        "GpgKeyArmor": resp.text,
        "Keyring": "trustedkeys.gpg",
    }

    url = "http://localhost:8080/api/gpg/key"

    resp = requests.post(url, json=body)

    print(resp.status_code)
    print(resp.text)


def create_mirror():
    body = {
        "Architectures": ["amd64"],
        "Distribution": "vscodium",
        "Filter": "codium (>= 1.102.35058)",
        "FilterWithDeps": True,
        "Name": "vscodium",
        "ArchiveURL": "https://download.vscodium.com/debs",
    }

    url = "http://localhost:8080/api/mirrors"

    resp = requests.post(url, json=body)

    print(resp.status_code)
    print(resp.text)

if __name__ == "__main__":
    # add_key()
    create_mirror()

add_key() works, but create_mirror() responses with that error.

JupiterRider avatar Aug 08 '25 19:08 JupiterRider

I found the cause.

Aptly creates a GPG keybox and openpgp.ReadKeyRing throws that error. To avoid this I could use this value in the post body:

"Keyring": "gnupg-ring:trustedkeys.gpg",

Source: https://www.gnupg.org/gph/en/manual/r1574.html

JupiterRider avatar Aug 20 '25 21:08 JupiterRider