jgpg

Crates.iojgpg
lib.rsjgpg
version0.1.0
created_at2025-11-08 11:31:47.067501+00
updated_at2025-11-08 11:31:47.067501+00
descriptionA Rust binary and library for converting gpg --list-keys (apt-key list etc.) output to JSON in DevOps, CI/CD pipelines.
homepage
repositoryhttps://github.com/achianumba/jgpg
max_upload_size
id1922783
size41,806
Arinze Chianumba (achianumba)

documentation

README

jgpg

A Rust binary and library for converting gpg --list-keys (apt-key list etc.) output to JSON in DevOps, CI/CD pipelines. jgpg parses human-oriented GPG keyring listings into structured JSON, including key metadata, user IDs, trust indicators, and subkeys.

Usage

Pipe GPG output into the tool:

Installation

From Crates.io

cargo install jgpg

Or as a library

cargo add jgpg

From source

cargo install --git https://github.com/achianumba/jgpg

Usage

gpg --list-keys | jgpg

Sample Output

{
  "/home/USERNAME/.gnupg/pubring.kbx": [
    {
      "key_type": "rsa3072",
      "created": "2025-08-13",
      "can_sign": true,
      "can_certify": true,
      "can_encrypt": false,
      "can_authenticate": false,
      "expires": "2027-08-13",
      "id": "A6C4C64CCC8E8D4A278660B0A78A721FDBC087D9",
      "fingerprint": null,
      "trust_level": "ultimate",
      "real_name": "testing",
      "email": "testing@local",
      "sub_keys": [
        {
          "key_type": "rsa3072",
          "created": "2025-08-13",
          "can_sign": false,
          "can_certify": false,
          "can_encrypt": true,
          "can_authenticate": false,
          "expires": "2027-08-13"
        }
      ]
    }
  ]
}

Get an array of key names stored in /etc/apt/trusted.gpg using jgpg and jq.

apt-key list | cargo run | jq '."/etc/apt/trusted.gpg" | map(.real_name)''

Sample Output

[
  "Launchpad PPA for Ubuntu Git Maintainers",
  "Launchpad PPA for Janek Bevendorff",
  "Launchpad PPA for wereturtle"
]
Commit count: 0

cargo fmt