{"record":{"id":"905f2aa13848a4b4","repo":"gchq/CyberChef","slug":"enter-the-public-key-of-the-signer","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/PGPDecryptAndVerify.mjs","lineNumber":72,"sourceCode":"                \"name\": \"Private key password\",\n                \"type\": \"string\",\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, privateKey, passphrase] = 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        if (!privateKey) throw new OperationError(\"Enter the private key of the recipient.\");\n        const privKey = await importPrivateKey(privateKey, passphrase);\n        const pubKey = await importPublicKey(publicKey);\n        keyring.add_key_manager(privKey);\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 \";","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/PGPDecryptAndVerify.mjs#L54-L90","documentation":"PGPDecryptAndVerify.run reads args[0] as the signer's public key. If it is falsy the operation aborts before importing any keys. This is an input-validation guard - decryption and verification cannot proceed without the signer's public key.","triggerScenarios":"The 'Public key of signer' argument is empty; the args array is shorter than expected; the key text was not bound into the recipe.","commonSituations":"User supplied only the recipient private key and forgot the signer public key; programmatic call with a missing first argument; blank UI field.","solutions":["Provide the signer's ASCII-armoured PGP public key in the first argument.","Also provide the recipient's private key (and passphrase) in the remaining arguments.","Verify the public key begins with '-----BEGIN PGP PUBLIC KEY BLOCK-----'."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const [publicKey, privateKey, passphrase] = args;\nif (!publicKey || !publicKey.trim()) {\n    throw new Error('Signer public key argument is required before running PGP Decrypt and 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 first.","Validate the key is an armoured PGP public key block.","Supply the recipient private key and passphrase too."],"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"}