{"record":{"id":"39acb6411375acaa","repo":"passbolt/passbolt_api","slug":"the-data-entered-are-not-correct-0-gpgkeyimportcontroller","errorCode":null,"errorMessage":"The data entered are not correct: {0}","messagePattern":"The data entered are not correct: (.+?)","errorType":"exception","errorClass":"CakeException","httpStatus":500,"severity":"error","filePath":"plugins/PassboltCe/WebInstaller/src/Controller/GpgKeyImportController.php","lineNumber":46,"sourceCode":"    public function initialize(): void\n    {\n        parent::initialize();\n        $this->stepInfo['template'] = 'Pages/gpg_key_import';\n        $this->stepInfo['generate_key_cta'] = '/install/gpg_key';\n    }\n\n    /**\n     * @inheritDoc\n     */\n    protected function validateData(array $data): void\n    {\n        $form = new GpgKeyForm();\n        $confIsValid = $form->execute($data);\n        $this->set('formExecuteResult', $form);\n        if (!$confIsValid) {\n            $errors = Hash::flatten($form->getErrors());\n            $errorMessage = implode('; ', $errors);\n            throw new CakeException(__('The data entered are not correct: {0}', $errorMessage));\n        }\n    }\n}\n","sourceCodeStart":28,"sourceCodeEnd":50,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltCe/WebInstaller/src/Controller/GpgKeyImportController.php#L28-L50","documentation":"GpgKeyImportController::validateData executes GpgKeyForm on the posted key-import data and, when validation fails, throws CakeException 'The data entered are not correct: {0}' containing flattened, semicolon-joined errors, and stores the form result as formExecuteResult. It guards the WebInstaller step where an existing OpenPGP key is imported instead of generated.","triggerScenarios":"POSTing the WebInstaller GPG key import step with a missing/empty armored key, a payload that is not a valid ASCII-armored key block, or failing GpgKeyForm rules — execute() returns false.","commonSituations":"Pasting a fingerprint or key ID instead of the full armored block; copy/paste stripping the BEGIN/END PGP lines or introducing HTML entities; importing a public key where a private key is required; wrong field name in scripted requests.","solutions":["Check the {0} error details in the message for the exact failing rule.","Paste the complete ASCII-armored key including '-----BEGIN PGP ... KEY BLOCK-----' and matching END line, in the correct field.","Re-export with gpg --armor --export-secret-keys <fingerprint> (or --export for public) and copy the full block verbatim.","Ensure the key matches what the step expects (e.g. private server key) and the name/email rules pass."],"exampleFix":"// before\n{'armored_key': 'AB12CD34'}  // fingerprint, not a key block\n// after\n{'armored_key': '-----BEGIN PGP PRIVATE KEY BLOCK-----\\n...\\n-----END PGP PRIVATE KEY BLOCK-----'}","handlingStrategy":"validation","validationCode":"if (!armoredKey.includes('-----BEGIN PGP')) throw new Error('not an ASCII-armored key block');\nif (!armoredKey.includes('-----END PGP')) throw new Error('armored block is truncated');\nif (/<|&|>/.test(armoredKey)) throw new Error('armored key contains HTML-escaped characters');","typeGuard":"function isArmoredKey(s) {\n  return typeof s === 'string' &&\n    s.includes('-----BEGIN PGP') && s.includes('-----END PGP');\n}","tryCatchPattern":"try {\n  await post('/install/gpg_key_import', { armored_key: armoredKey });\n} catch (e) {\n  if (String(e.message).startsWith('The data entered are not correct:')) {\n    // the {0} suffix lists the failing rules; verify the armored block and retry\n  }\n  throw e;\n}","preventionTips":["Paste the full armored block including BEGIN/END lines, not a fingerprint.","Re-export with gpg --armor and copy verbatim (avoid editors that wrap/escape).","Check whether the step requires the private (server) key rather than the public one.","Send the key under the exact expected field name."],"tags":["webinstaller","form-validation","gpg","openpgp"],"backgroundTag":"invalid-argument-format","analyzedSha":"31c1bbc10f32808a607fa9bd81891e898779c0bc","analyzedAt":"2026-09-17T00:04:38.960Z","contentChangedAt":"2026-09-17T00:04:38.960Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}