{"record":{"id":"a75d2795c44fd2b4","repo":"passbolt/passbolt_api","slug":"the-subscription-format-is-not-valid-invalid-format","errorCode":null,"errorMessage":"The subscription format is not valid. Invalid format.","messagePattern":"The subscription format is not valid\\. Invalid format\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"plugins/PassboltEe/Subscription/src/Form/SubscriptionKeyAsciiForm.php","lineNumber":165,"sourceCode":"    }\n\n    /**\n     * Get the armored subscription.\n     *\n     * @param string $keyAscii key in ascii\n     * @return string The armored signed subscription\n     * @throws \\Exception If the subscription format is not valid\n     */\n    public function getArmoredSignedSubscription(string $keyAscii): string\n    {\n        $armoredSignedSubscription = base64_decode($keyAscii);\n        if (!$armoredSignedSubscription) {\n            throw new Exception(__('The subscription format is not valid.'));\n        }\n\n        $isSignedMessage = $this->getGpg()->isParsableArmoredSignedMessage($armoredSignedSubscription);\n        if (!$isSignedMessage) {\n            throw new Exception(__('The subscription format is not valid. Invalid format.'));\n        }\n\n        return $armoredSignedSubscription;\n    }\n\n    /**\n     * Verify the subscription signature\n     *\n     * @param string $subscriptionSigned The signed subscription to verify.\n     * @psalm-suppress InvalidNullableReturnType always returns a string\n     * @return string The subscription info.\n     * @throws \\Exception If the gpg public subscription key cannot be imported into the keyring\n     * @throws \\Exception If the subscription cannot be verified\n     */\n    protected function _verifySignature(string $subscriptionSigned): string\n    {\n        $msg = __('The subscription key cannot be verified.');\n        $subscription = '';","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/Subscription/src/Form/SubscriptionKeyAsciiForm.php#L147-L183","documentation":"The string base64-decoded successfully but is not a parsable OpenPGP armored signed message, per OpenPGPBackend::isParsableArmoredSignedMessage(). getArmoredSignedSubscription() throws this when the decoded content lacks a valid PGP signed-message structure.","triggerScenarios":"base64_decode($keyAscii) succeeds on arbitrary text (base64 rarely hard-fails), but the decoded bytes are not a '-----BEGIN PGP MESSAGE-----' block with a signature packet — e.g. wrong content base64-encoded, a public key block, or a partially edited key.","commonSituations":"Encoding the wrong file/content into base64 and submitting that; passing a license from another vendor; a key mangled by automatic text transformation (smart quotes, HTML escaping) before submission; older or newer subscription format incompatible with the installed passbolt version.","solutions":["Decode and inspect: `echo '<key>' | base64 -d` — it must start with '-----BEGIN PGP MESSAGE-----' and contain a signature packet.","Do not modify the key text; submit it verbatim as received from passbolt.","Confirm the key is for the correct edition and product version; request a regenerated key from passbolt if the payload structure is unrecognized."],"exampleFix":"// before: base64 of the wrong payload\n$bad = base64_encode(file_get_contents('public.key'));\ncreateOrUpdate($uac, $bad);\n// after: use the delivered key verbatim\ncreateOrUpdate($uac, $keyFromPassboltAccount);","handlingStrategy":"validation","validationCode":"$decoded = base64_decode($key, true);\nif ($decoded === false || strpos($decoded, '-----BEGIN PGP MESSAGE-----') !== 0) {\n    throw new \\InvalidArgumentException('Key must base64-decode to an armored signed message');\n}","typeGuard":null,"tryCatchPattern":"try {\n    $armored = $form->getArmoredSignedSubscription($key);\n} catch (\\Exception $e) {\n    Log::error('Not a parsable armored signed message');\n    // instruct user to use the key verbatim\n}","preventionTips":["Never base64-encode your own content as a 'key' — use the vendor-issued string","Don't let editors/email clients transform the text (smart quotes, wrapping)","Confirm key edition/product matches the installed passbolt version"],"tags":["openpgp","base64","subscription-key","php"],"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-21T09:17:21.228Z"}