gchq/CyberChef · error · OperationError
No "r" value in the signature JSON
Error message
No "r" value in the signature JSON
What it means
Thrown in ECDSAVerify.run, Raw JSON branch, when the parsed signature JSON has no truthy r field. Identical to the corresponding guard in ECDSASignatureConversion: after format resolution to Raw JSON and JSON.parse, the r scalar is checked first; a missing r aborts before s is inspected.
Source
Thrown at src/core/operations/ECDSAVerify.mjs:133
// convert to ASN.1 signature
let signatureASN1Hex;
switch (inputFormat) {
case "Auto":
throw new OperationError("Signature format could not be detected");
case "ASN.1 HEX":
signatureASN1Hex = input;
break;
case "P1363 HEX":
signatureASN1Hex = r.KJUR.crypto.ECDSA.concatSigToASN1Sig(input);
break;
case "JSON Web Signature":
if (!inputBase64) inputBase64 = fromBase64(input, "A-Za-z0-9-_");
signatureASN1Hex = r.KJUR.crypto.ECDSA.concatSigToASN1Sig(toHexFast(inputBase64));
break;
case "Raw JSON": {
if (!inputJson) inputJson = JSON.parse(input);
if (!inputJson.r) {
throw new OperationError('No "r" value in the signature JSON');
}
if (!inputJson.s) {
throw new OperationError('No "s" value in the signature JSON');
}
signatureASN1Hex = r.KJUR.crypto.ECDSA.hexRSSigToASN1Sig(inputJson.r, inputJson.s);
break;
}
}
// verify signature
const internalAlgorithmName = mdAlgo.replace("-", "") + "withECDSA";
const sig = new r.KJUR.crypto.Signature({ alg: internalAlgorithmName });
const key = r.KEYUTIL.getKey(keyPem);
if (key.type !== "EC") {
throw new OperationError("Provided key is not an EC key.");
}
if (!key.isPublic) {
throw new OperationError("Provided key is not a public key.");View on GitHub (pinned to 4290ea7539)
Solutions
- Provide JSON with lowercase 'r' and 's' hex strings.
- Rename mismatched fields from your source data.
- If the data is base64/concatenation, use the JSON Web Signature or P1363 format instead.
Example fix
// before
verifyRun('{"s":"a3..."}', ['Raw JSON', ...]); // missing r
// after
verifyRun('{"r":"bb...","s":"a3..."}', ['Raw JSON', ...]); Defensive patterns
Strategy: validation
Validate before calling
const o = JSON.parse(sig);
if (!o || typeof o !== "object" || !o.r) throw new Error("signature JSON needs an 'r' field"); Type guard
const hasR = (o) => o != null && typeof o === "object" && Object.prototype.hasOwnProperty.call(o, "r");
Prevention
- Use lowercase r/s field names in raw-JSON signatures.
- Validate the JSON shape before verifying.
When it happens
Trigger: Input Format is Raw JSON (or Auto resolved there) and the object lacks 'r' - e.g. {"s":"..."}, wrong-cased keys, or unrelated JSON.
Common situations: Field-name mismatch from the producing library; truncated JSON; pasting a non-ECDSA JSON structure.
Related errors
- No "r" value in the signature JSON
- No "s" value in the signature JSON
- No "s" value in the signature JSON
- Signature format could not be detected
- Signature format could not be detected
AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13).
Data as JSON: /api/errors/2060a2e6fe372e73.
Report an issue: GitHub.