Skip to content

Commit

Permalink
Adding PEM encoded test vectors for XDH.
Browse files Browse the repository at this point in the history
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
bleichen authored and Tink Team committed Nov 26, 2019
1 parent e4219aa commit 0d659a5
Show file tree
Hide file tree
Showing 3 changed files with 10,516 additions and 0 deletions.
106 changes: 106 additions & 0 deletions schemas/xdh_pem_comp_schema.json
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"
}
}
}
}
Loading

0 comments on commit 0d659a5

Please sign in to comment.