gchq/CyberChef · warning · OperationError
Enter the public key of the recipient.
Error message
Enter the public key of the recipient.
What it means
PGPEncrypt.run reads args[0] as the recipient's public key. If it is falsy the operation aborts before importing any key - there is no key to encrypt for. This is an input-validation guard.
Source
Thrown at src/core/operations/PGPEncrypt.mjs:60
"type": "text",
"value": ""
}
];
}
/**
* @param {string} input
* @param {Object[]} args
* @returns {string}
*
* @throws {OperationError} if failed private key import or failed encryption
*/
async run(input, args) {
const plaintextMessage = input,
plainPubKey = args[0];
let encryptedMessage;
if (!plainPubKey) throw new OperationError("Enter the public key of the recipient.");
const key = await importPublicKey(plainPubKey);
try {
encryptedMessage = await promisify(kbpgp.box)({
"msg": plaintextMessage,
"encrypt_for": key,
"asp": ASP
});
} catch (err) {
throw new OperationError(`Couldn't encrypt message with provided public key: ${err}`);
}
return encryptedMessage.toString();
}
}
View on GitHub (pinned to 4290ea7539)
Solutions
- Provide the recipient's ASCII-armoured PGP public key in the first argument.
- Verify the key begins with '-----BEGIN PGP PUBLIC KEY BLOCK-----'.
- Ensure the key has an encryption-capable subkey.
Defensive patterns
Strategy: validation
Validate before calling
const plainPubKey = args[0];
if (!plainPubKey || !plainPubKey.trim()) {
throw new Error('Recipient public key argument is required before running PGP Encrypt.');
} Type guard
const isArmouredPublicKey = (s) =>
typeof s === 'string' && /-----BEGIN PGP PUBLIC KEY BLOCK-----/.test(s); Prevention
- Populate the recipient public-key argument before running.
- Validate the key is an armoured PGP public key block.
- Ensure the key has an encryption-capable subkey.
When it happens
Trigger: The 'Public key of recipient' argument is empty; the args array is missing element 0; the key text was not bound into the recipe.
Common situations: User forgot to paste the recipient public key; programmatic call with a missing argument; blank UI field.
Related errors
- Enter the private key of the recipient.
- Enter the public key of the signer.
- Enter the private key of the signer.
- Enter the private key of the signer.
- Enter the public key of the signer.
AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13).
Data as JSON: /api/errors/1039fe8c1eaf64ec.
Report an issue: GitHub.