-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding test vectors and tests for DSA with P1363 encoding.
Splitting DSA test vectors into several files depending on key size and hash. I'm only adding files for DSA parameters that are supported by libraries that are used in google3. Most projects now prefer ECDSA. Tests with additional parameters (e.g. 4096-bit keys or other hash functions) can be added, if there is a reason for doing so. Tested providers: jdk8 supports DSA with ASN encoding. jdk11 supports DSA with ASN and P1363 encoding. BouncyCastle only supports DSA with ASN encoding. (P1363 format is only supported for ECDSA). ConsCrypt does not support DSA at all. b/33446454: The tests ignore this issue to avoid missing bigger mistakes. NOKEYCHECK=True PiperOrigin-RevId: 281068296 GitOrigin-RevId: 7c4178527d940fccbcfcfdd88f1cb850a17746db
- Loading branch information
Showing
10 changed files
with
18,756 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
{ | ||
"type": "object", | ||
"definitions": { | ||
"DsaP1363TestGroup": { | ||
"type": "object", | ||
"properties": { | ||
"type": { | ||
"enum": [ | ||
"DsaP1363Verify" | ||
] | ||
}, | ||
"key": { | ||
"$ref": "#/definitions/DsaPublicKey", | ||
"description": "unencoded EC public key" | ||
}, | ||
"keyDer": { | ||
"type": "string", | ||
"format": "Der", | ||
"description": "DER encoded public key" | ||
}, | ||
"keyPem": { | ||
"type": "string", | ||
"format": "Pem", | ||
"description": "Pem encoded public key" | ||
}, | ||
"sha": { | ||
"type": "string", | ||
"format": "MdName", | ||
"description": "the hash function used for DSA" | ||
}, | ||
"tests": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/SignatureTestVector" | ||
} | ||
} | ||
} | ||
}, | ||
"DsaPublicKey": { | ||
"type": "object", | ||
"properties": { | ||
"g": { | ||
"type": "string", | ||
"format": "BigInt", | ||
"description": "the generator of the multiplicative subgroup" | ||
}, | ||
"keySize": { | ||
"type": "integer", | ||
"description": "the key size in bits" | ||
}, | ||
"p": { | ||
"type": "string", | ||
"format": "BigInt", | ||
"description": "the modulus p" | ||
}, | ||
"q": { | ||
"type": "string", | ||
"format": "BigInt", | ||
"description": "the order of the generator g" | ||
}, | ||
"type": { | ||
"type": "string", | ||
"description": "the key type", | ||
"enum": [ | ||
"DsaPublicKey" | ||
] | ||
}, | ||
"y": { | ||
"type": "string", | ||
"format": "BigInt", | ||
"description": "the public key value" | ||
} | ||
} | ||
}, | ||
"SignatureTestVector": { | ||
"type": "object", | ||
"properties": { | ||
"tcId": { | ||
"type": "integer", | ||
"description": "Identifier of the test case" | ||
}, | ||
"comment": { | ||
"type": "string", | ||
"description": "A brief description of the test case" | ||
}, | ||
"msg": { | ||
"type": "string", | ||
"format": "HexBytes", | ||
"description": "The message to sign" | ||
}, | ||
"sig": { | ||
"type": "string", | ||
"format": "HexBytes", | ||
"description": "A signature for msg" | ||
}, | ||
"result": { | ||
"type": "string", | ||
"description": "Test result", | ||
"enum": [ | ||
"valid", | ||
"invalid", | ||
"acceptable" | ||
] | ||
}, | ||
"flags": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"description": "A list of flags" | ||
} | ||
} | ||
} | ||
}, | ||
"properties": { | ||
"algorithm": { | ||
"type": "string", | ||
"description": "the primitive tested in the test file" | ||
}, | ||
"generatorVersion": { | ||
"type": "string", | ||
"description": "the version of the test vectors." | ||
}, | ||
"header": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"description": "additional documentation" | ||
}, | ||
"notes": { | ||
"type": "object", | ||
"description": "a description of the labels used in the test vectors" | ||
}, | ||
"numberOfTests": { | ||
"type": "integer", | ||
"description": "the number of test vectors in this test" | ||
}, | ||
"schema": { | ||
"enum": [ | ||
"dsa_p1363_verify_schema.json" | ||
] | ||
}, | ||
"testGroups": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/DsaP1363TestGroup" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.