-
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 PEM encoded test vectors for XDH.
The test vectors allow to check libraries that read PEM files against bugs similar to: https://bugs.openjdk.java.net/browse/JDK-8213363 Testing: So far I'm testing against hazmat (i.e. a python wrapper around openssl). The version in google3 google3/third_party/py/cryptography/hazmat/ only supports x25519, hence the x448 test vectors are not tested. The test vectors are essentially the same as in x448_asn_test.json, which pass BouncyCastle (with some fixes for overflow). NOKEYCHECK=True PiperOrigin-RevId: 269317802 GitOrigin-RevId: f29c60bccd75d3a9a16f833e108bdf83e385fc87
- Loading branch information
Showing
3 changed files
with
10,516 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
{ | ||
"type": "object", | ||
"definitions": { | ||
"XdhPemTestGroup": { | ||
"type": "object", | ||
"properties": { | ||
"type": { | ||
"enum": [ | ||
"XdhPemComp" | ||
] | ||
}, | ||
"curve": { | ||
"type": "string", | ||
"format": "EcCurve", | ||
"description": "the name of the curve" | ||
}, | ||
"tests": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/XdhPemTestVector" | ||
} | ||
} | ||
} | ||
}, | ||
"XdhPemTestVector": { | ||
"type": "object", | ||
"properties": { | ||
"tcId": { | ||
"type": "integer", | ||
"description": "Identifier of the test case" | ||
}, | ||
"comment": { | ||
"type": "string", | ||
"description": "A brief description of the test case" | ||
}, | ||
"public": { | ||
"type": "string", | ||
"format": "Pem", | ||
"description": "PEM encoded public key" | ||
}, | ||
"private": { | ||
"type": "string", | ||
"format": "Pem", | ||
"description": "a raw private key" | ||
}, | ||
"shared": { | ||
"type": "string", | ||
"format": "HexBytes", | ||
"description": "the shared secret" | ||
}, | ||
"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": [ | ||
"xdh_pem_comp_schema.json" | ||
] | ||
}, | ||
"testGroups": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/XdhPemTestGroup" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.