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
This commit is contained in:
bleichen
2019-09-16 06:08:27 -07:00
committed by Tink Team
parent e4219aa4c8
commit 0d659a5d4f
3 changed files with 10516 additions and 0 deletions
+106
View File
@@ -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"
}
}
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff