{"record":{"id":"12e2038edef9a1bb","repo":"gchq/CyberChef","slug":"enter-the-public-key-of-the-signer-12e203","errorCode":null,"errorMessage":"Enter the public key of the signer.","messagePattern":"Enter the public key of the signer\\.","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"warning","filePath":"src/core/operations/PGPVerify.mjs","lineNumber":62,"sourceCode":"                \"name\": \"Public key of signer\",\n                \"type\": \"text\",\n                \"value\": \"\"\n            }\n        ];\n    }\n\n    /**\n     * @param {string} input\n     * @param {Object[]} args\n     * @returns {string}\n     */\n    async run(input, args) {\n        const signedMessage = input,\n            [publicKey] = args,\n            keyring = new kbpgp.keyring.KeyRing();\n        let unboxedLiterals;\n\n        if (!publicKey) throw new OperationError(\"Enter the public key of the signer.\");\n        const pubKey = await importPublicKey(publicKey);\n        keyring.add_key_manager(pubKey);\n\n        try {\n            unboxedLiterals = await promisify(kbpgp.unbox)({\n                armored: signedMessage,\n                keyfetch: keyring,\n                asp: ASP\n            });\n            const ds = unboxedLiterals[0].get_data_signer();\n            if (ds) {\n                const km = ds.get_key_manager();\n                if (km) {\n                    const signer = km.get_userids_mark_primary()[0].components;\n                    let text = \"Signed by \";\n                    if (signer.email || signer.username || signer.comment) {\n                        if (signer.username) {\n                            text += `${signer.username} `;","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/PGPVerify.mjs#L44-L80","documentation":"PGPVerify.run reads args[0] as the signer's public key. If it is falsy the operation aborts before importing any key - verification cannot proceed without the signer's public key. This is an input-validation guard.","triggerScenarios":"The 'Public key of signer' argument is empty; the args array is missing element 0; the key text was not bound into the recipe.","commonSituations":"User forgot to paste the signer public key; programmatic call with a missing argument; blank UI field.","solutions":["Provide the signer's ASCII-armoured PGP public key in the first argument.","Verify the key begins with '-----BEGIN PGP PUBLIC KEY BLOCK-----'.","Ensure the key includes the signing subkey that produced the signature."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const [publicKey] = args;\nif (!publicKey || !publicKey.trim()) {\n    throw new Error('Signer public key argument is required before running PGP Verify.');\n}","typeGuard":"const isArmouredPublicKey = (s) =>\n    typeof s === 'string' && /-----BEGIN PGP PUBLIC KEY BLOCK-----/.test(s);","tryCatchPattern":null,"preventionTips":["Populate the signer public-key argument before running.","Validate the key is an armoured PGP public key block.","Ensure the key includes the signing subkey that produced the signature."],"tags":["pgp","validation","kbpgp","cryptography"],"backgroundTag":null,"analyzedSha":"4290ea753912378913b1f3f54e0fc5720afeda5d","analyzedAt":"2026-08-13T06:05:50.210Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}