make the ECDSA JSON signature parsing more robust

also rename the format to "Raw JSON"
as I will later introduce "JSON Web Signature"
This commit is contained in:
CPlusSharp 2024-04-14 12:42:44 +02:00
parent 7b54d9e873
commit 1fbc7e03f0
4 changed files with 70 additions and 19 deletions

View file

@ -271,6 +271,28 @@ TestRegister.addTests([
}
]
},
{
name: "ECDSA Verify: JSON signature missing r",
input: JSON.stringify({s: JSON.parse(P256.signature.sha256.json).s}),
expectedOutput: 'No "r" value in the signature JSON',
recipeConfig: [
{
"op": "ECDSA Verify",
"args": ["Auto", "SHA-256", P256.publicKey, ASCII_TEXT]
}
]
},
{
name: "ECDSA Verify: JSON signature missing s",
input: JSON.stringify({r: JSON.parse(P256.signature.sha256.json).r}),
expectedOutput: 'No "s" value in the signature JSON',
recipeConfig: [
{
"op": "ECDSA Verify",
"args": ["Auto", "SHA-256", P256.publicKey, ASCII_TEXT]
}
]
},
{
name: "ECDSA Verify: Using private key fails",
input: P256.signature.sha256.asn1,
@ -324,7 +346,7 @@ TestRegister.addTests([
recipeConfig: [
{
"op": "ECDSA Signature Conversion",
"args": ["Auto", "JSON"]
"args": ["Auto", "Raw JSON"]
}
]
},
@ -357,7 +379,7 @@ TestRegister.addTests([
recipeConfig: [
{
"op": "ECDSA Signature Conversion",
"args": ["Auto", "JSON"]
"args": ["Auto", "Raw JSON"]
}
]
},
@ -390,7 +412,7 @@ TestRegister.addTests([
recipeConfig: [
{
"op": "ECDSA Signature Conversion",
"args": ["Auto", "JSON"]
"args": ["Auto", "Raw JSON"]
}
]
}