{"record":{"id":"828da2c8607db352","repo":"passbolt/passbolt_api","slug":"the-subscription-format-is-not-valid","errorCode":null,"errorMessage":"The subscription format is not valid.","messagePattern":"The subscription format is not valid\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"plugins/PassboltEe/Subscription/src/Form/SubscriptionKeyAsciiForm.php","lineNumber":160,"sourceCode":"        }\n\n        $subscriptionInfo['data'] = trim($keyAscii);\n\n        return SubscriptionKeyDto::createFromArray($subscriptionInfo);\n    }\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","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/Subscription/src/Form/SubscriptionKeyAsciiForm.php#L142-L178","documentation":"The submitted subscription key string could not be base64-decoded into a non-empty value, so SubscriptionKeyAsciiForm::getArmoredSignedSubscription() rejects it before any OpenPGP parsing. The library expects the subscription key to be the base64 encoding of an armored signed message.","triggerScenarios":"Calling getArmoredSignedSubscription() (or the form validation via checkSubscriptionFormat / parse) with an empty-looking or non-base64 string: base64_decode() fails (strict semantics on invalid chars, returns ''/'false'), e.g. a raw armored '-----BEGIN PGP SIGNATURE-----' block pasted directly instead of its base64 wrapper.","commonSituations":"Pasting the raw OpenPGP armored message instead of the base64 subscription key; copying only part of the key; the key getting URL-mangled (e.g. in a query string); uploading an empty file as the subscription key.","solutions":["Ensure you are using the exact base64 subscription key string provided by passbolt, not the decoded armored message.","Validate locally: `echo '<key>' | base64 -d | head -1` should output '-----BEGIN PGP MESSAGE-----'.","Trim surrounding whitespace/quotes; re-copy the key in full from the source email or account portal.","Request a fresh key if the string appears truncated."],"exampleFix":"// before: raw armored block passed as key\ncreateOrUpdate($uac, \"-----BEGIN PGP MESSAGE-----\\n...\");\n// after: base64 of the armored block (as delivered)\ncreateOrUpdate($uac, 'LS0tLS1CRUdJTiBQR1AgTUVTU0FHRS0tLS0t...');","handlingStrategy":"validation","validationCode":"if (empty($key) || base64_decode($key, true) === false) {\n    throw new \\InvalidArgumentException('Key must be a non-empty base64 string');\n}","typeGuard":null,"tryCatchPattern":"try {\n    $armored = $form->getArmoredSignedSubscription($key);\n} catch (\\Exception $e) {\n    return false; // form-rule path, or surface 'invalid format' to user\n}","preventionTips":["Use the exact base64 key string as delivered, never the raw armored block","Trim whitespace and quotes from pasted input","Beware URL/query-string transport mangling; transfer keys via secure file or POST body"],"tags":["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-22T11:17:16.035Z"}