jdx/mise · error

no trusted public keys available for verification

Error message

no trusted public keys available for verification

What it means

`verify_detached` in gpg.rs verifies a detached signature against a set of trusted public keys. Before doing any cryptographic work it parses the provided armored key material and, if no public keys could be parsed out of it, bails with "no trusted public keys available for verification". Empty trusted-key input can never succeed, so it fails fast.

Solutions

  1. Check that the public key source (file/setting) is non-empty and actually contains ASCII-armored PGP public key blocks (-----BEGIN PGP PUBLIC KEY BLOCK-----).
  2. Re-download the official keyring (e.g. nodejs.org dist keys) and update your configured keys.
  3. Fix the config path/setting name that selects the trusted keys — a wrong path often yields empty content.
  4. If keys are provided programmatically, assert the parse result is non-empty before calling verify.

Example fix

// before
let keys = std::fs::read_to_string("trusted.asc")?; // file may be empty/HTML
verify_detached(&keys, &sig, &data)?;
// after
let keys = std::fs::read_to_string("trusted.asc")?;
eyre::ensure!(keys.contains("BEGIN PGP PUBLIC KEY BLOCK"), "keyring missing armored keys");
verify_detached(&keys, &sig, &data)?;
Defensive patterns

Strategy: validation

Validate before calling

fn has_armored_public_keys(blob: &str) -> bool {
    blob.contains("-----BEGIN PGP PUBLIC KEY BLOCK-----")
}
// call before verify_detached
assert!(has_armored_public_keys(&public_keys_asc), "trusted key material empty or malformed");

Try / catch

match verify_detached(&keys, &sig, &data) {
    Err(e) if e.to_string().contains("no trusted public keys") => {
        eprintln!("keyring empty; re-download official keys");
        let keys = refresh_official_keyring()?;
        verify_detached(&keys, &sig, &data)
    }
    other => other,
}

Prevention

When it happens

Trigger: Calling verify_detached (directly or via verify_node/verify_swift/verify_swift_bytes) with a public_keys_asc string/blob containing no parseable keys — empty string, whitespace, no armored blocks, or only corrupted/non-PGP content.

Common situations: A settings/config key list pointing at a file that is empty or was truncated; pasting the signature instead of the key; downloading a keyring and getting an HTML error page; a tool upgrade renaming key config so the old lookup yields nothing.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/825774d3df2aac90. Report an issue: GitHub.

Appendix: source

Thrown at src/gpg.rs:41

}

/// Verify a detached signature entirely in-process (no external `gpg` binary).
///
/// `public_keys_asc` is one or more ASCII-armored public key blocks (a trusted keyring bundled
/// with mise). `open_data` returns a fresh reader over the signed content each time it is called,
/// so the content can be streamed (and, if necessary, re-read for another candidate key) without
/// buffering large files in memory.
///
/// Verification succeeds if any signature validates against any of the trusted keys or their
/// subkeys, mirroring `gpg --verify` against an imported keyring.
fn verify_detached<R, F>(public_keys_asc: &str, signature: &[u8], open_data: F) -> Result<()>
where
    R: Read,
    F: Fn() -> Result<R>,
{
    let keys = parse_public_keys(public_keys_asc)?;
    if keys.is_empty() {
        bail!("no trusted public keys available for verification");
    }
    let signatures = parse_signatures(signature)?;
    if signatures.is_empty() {
        bail!("no signature found to verify");
    }

    // Fast path: only try keys whose id/fingerprint matches the signature's issuer, so the signed
    // content is hashed at most once in the common case.
    for sig in &signatures {
        if verify_against_keys(sig, &keys, &open_data, true)? {
            return Ok(());
        }
    }
    // Fallback: try every trusted key, but only for signatures that carried no usable issuer
    // hint. A signature that named an issuer we don't trust is genuinely unverifiable, so skip it
    // rather than re-hashing the (potentially large) content against every key.
    for sig in signatures.iter().filter(|sig| !has_issuer(&sig.signature)) {
        if verify_against_keys(sig, &keys, &open_data, false)? {

View on GitHub (pinned to 533346cc37)