Adding documentation for the test vector files.

NOKEYCHECK=True
PiperOrigin-RevId: 228866607
GitOrigin-RevId: a04fbc5b6604b399e1943a04713cc19e909f9905
This commit is contained in:
bleichen
2019-01-11 05:18:04 -08:00
committed by Tink Team
parent 18175b38da
commit 8d36c35a19
4 changed files with 1606 additions and 6 deletions
+45 -6
View File
@@ -21,10 +21,49 @@
not accept them. This happens when the parameters are weak (e.g. using SHA-1
for signatures) or when the encoding is slightly non-standard.
### Some plans for version 0.7
### Version 0.7
* Adding JSON schemas for the test vectors.
* Adding documentation. In particular, there needs to be a definition
for usages of the vectors.
* Adding some tests and test vectors using SHA-3.
* Adding new primitives, e.g. HKDF, X963KDF, ED448 ...
Format changes\:
* All test vector files contain a new field `"schema"`, which points to a JSON
schema definition in the directory `wycheproof/schema/`.
* More consistent type definition: E.g. the field `"type"` in a `testGroup` is
now describing the type of the test the vectors are intended for
[types.md](types.md). The type of the test defines formatting (e.g. whether
signatures use P1363 encoding or ASN encoding) and the tested operation
(e.g. whether the test vectors signatures are primarily are meant for
verification or signature generation).
* The format of test vectors have been slightly unified: In particular,
RSA-PKCS#1 v1.5 signatures no longer have a field "padding".
* Public and private keys in jwk format were added to other formats when the
jwk format for these keys is defined.
Additional test vectors\:
* Added vectors for edge cases that can occur in ECDH computations with
projective or Jacobian coordinates. In particular this implement a detection
for the attack in "Zero-Value Point Attacks on Elliptic Curve Cryptosystem"
by T.Akishita and T Takagi, ISC 2003.
* Added more edge cases for Xdh.
* Added more test cases for ASN parsing (e.g. high number tags)
* Added test vectors for CVE-2017-18330 to CCM and EAX.
* Added more edge cases for poly1305.
* Added test vectors for HKDF.
* Added new test vectors for ED448.
* Added some test vectors using SHA-3.
* Added documentation of the tests intended by the test vector files:
[files.md](files.md)
* Removed some duplicates in the test vectors.
### Some potential plans for version 0.8
* Test vectors for long hashes and MACs. I.e. the inputs are strings and
number of repetitions. This allows to add tests for primitives like
HMAC('a' * (2**32+12345)).
* New algorithms: PMAC, X963KDF
* Adding code for capabilities of the providers. Currently this is written in
unstructured form into the logs. Better would be a standalone binary that
writes, JSON or html or text.
* Adding a component for the analysis of key generation and signature
generation. Currently, such tests only run against Java providers. The goal
is to allow any library to be tested.
+517
View File
@@ -0,0 +1,517 @@
<!-- This file is automatically generated. -->
# Test vector files
## AeadTest
Test vectors of type AeadTest test authenticated encryption with additional
data. The test vectors are intended for testing both encryption and decryption.
Test vectors with "result" \: "valid" are valid encryptions. Test vectors with
"result" \: "invalid" are using invalid parameters or contain an invalid
ciphertext or tag. Test vectors with "result" \: "acceptable" are using weak
parameters.
JSON schema\: aead_test_schema.json
Type of the test group\: [AeadTestGroup](types.md#AeadTestGroup)
Type of the test vectors\: [AeadTestVector](types.md#AeadTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
---------------------------- | --------- | ------------ | -------------
aead_aes_siv_cmac_test.json | 828 | 180, 0, 648 | AEAD-AES-SIV-CMAC
aes_ccm_test.json | 510 | 366, 0, 144 | AES-CCM
aes_eax_test.json | 171 | 78, 12, 81 | AES-EAX
aes_gcm_siv_test.json | 155 | 88, 0, 67 | AES-GCM
aes_gcm_test.json | 256 | 139, 30, 87 | AES-GCM
chacha20_poly1305_test.json | 300 | 233, 0, 67 | CHACHA20-POLY1305
xchacha20_poly1305_test.json | 284 | 220, 0, 64 | XCHACHA20-POLY1305
## DaeadTest
Test vectors of type DaeadTest are intended for verifying encryption and
decryption of deterministic authenticated encryption with additional data.
Unlike the test vectors for AEAD the tag is included in the ciphertext, since
deterministic authenticated encryption frequently uses a synthetic IV (SIV) that
is used both as IV and MAC, and since the position of the SIV often depends on
the primitive.
JSON schema\: daead_test_schema.json
Type of the test group\: [DaeadTestGroup](types.md#DaeadTestGroup)
Type of the test vectors\: [DaeadTestVector](types.md#DaeadTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
---------------------- | --------- | ------------ | -------------
aes_siv_cmac_test.json | 442 | 118, 0, 324 | AES-SIV-CMAC
## DsaVerify
Test vectors of test DsaVerify are intended for checking the signature
verification of DSA signatures.
Test vectors with "result" \: "valid" are valid signatures. Test vectors with
"result" \: "invalid" are invalid. Test vectors with "result" \: "acceptable"
are signatures that may be rejected for a number of reasons\: they can be
signatures with valid values for r and s, but with an invalid or non-standard
encoding. They can be signatures with weak or non-standard parameters. All the
test vectors of this type have a label describing the abnomaly.
JSON schema\: dsa_verify_schema.json
Type of the test group\: [DsaTestGroup](types.md#DsaTestGroup)
Type of the test vectors\:
[AsnSignatureTestVector](types.md#AsnSignatureTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
------------- | --------- | ------------ | -------------
dsa_test.json | 855 | 33, 3, 819 | DSA
## EcPublicKeyVerify
Test vectors of type EcPublicKeyVerify are intended for test that check the
verification of EC public key.
In particular, implementations are expected to verify that the public key uses a
correct encoding, that the public key point is on the curve, that the point is
not a point of low order. If the public key encodes additional parameters e.g.
cofactor and order then the test expects that these parameters are verified.
JSON schema\: ec_public_key_verify_schema.json
Type of the test group\: [EcPublicKeyTestGroup](types.md#EcPublicKeyTestGroup)
Type of the test vectors\:
[EcPublicKeyTestVector](types.md#EcPublicKeyTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
--------------- | --------- | ------------ | ---------------
eckey_test.json | 19 | 14, 0, 5 | EcPublicKeyTest
## EcdhEcpointTest
Test vectors of type EcdhWebTest are intended for testing an ECDH
implementations where the public key is just an ASN encoded point.
JSON schema\: ecdh_ecpoint_test_schema.json
Type of the test group\: [EcdhEcpointTestGroup](types.md#EcdhEcpointTestGroup)
Type of the test vectors\:
[EcdhEcpointTestVector](types.md#EcdhEcpointTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
-------------------------------- | --------- | ------------ | -------------
ecdh_secp224r1_ecpoint_test.json | 65 | 46, 1, 18 | ECDH
ecdh_secp256r1_ecpoint_test.json | 158 | 133, 1, 24 | ECDH
ecdh_secp384r1_ecpoint_test.json | 182 | 163, 1, 18 | ECDH
ecdh_secp521r1_ecpoint_test.json | 221 | 192, 1, 28 | ECDH
## EcdhTest
Test vectors of type EcdhTest are intended for testing an ECDH implementations
using PKCS8 encoded public keys and X509 encoded private keys. (i.e. what JCA is
using as default).
JSON schema\: ecdh_test_schema.json
Type of the test group\: [EcdhTestGroup](types.md#EcdhTestGroup)
Type of the test vectors\: [EcdhTestVector](types.md#EcdhTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
------------------------------ | --------- | -------------- | -------------
ecdh_brainpoolP224r1_test.json | 444 | 174, 219, 51 | ECDH
ecdh_brainpoolP256r1_test.json | 431 | 163, 219, 49 | ECDH
ecdh_brainpoolP320r1_test.json | 391 | 124, 219, 48 | ECDH
ecdh_brainpoolP384r1_test.json | 365 | 85, 219, 61 | ECDH
ecdh_brainpoolP512r1_test.json | 377 | 115, 217, 45 | ECDH
ecdh_secp224r1_test.json | 308 | 46, 219, 43 | ECDH
ecdh_secp256k1_test.json | 355 | 91, 219, 45 | ECDH
ecdh_secp256r1_test.json | 401 | 133, 219, 49 | ECDH
ecdh_secp384r1_test.json | 426 | 163, 219, 44 | ECDH
ecdh_secp521r1_test.json | 463 | 192, 217, 54 | ECDH
ecdh_test.json | 2574 | 1711, 120, 743 | ECDH
## EcdhWebcryptoTest
Test vectors of type EcdhWebTest are intended for testing an ECDH
implementations using jwk encoded public and private keys.
JSON schema\: ecdh_webcrypto_test_schema.json
Type of the test group\:
[EcdhWebcryptoTestGroup](types.md#EcdhWebcryptoTestGroup)
Type of the test vectors\:
[EcdhWebcryptoTestVector](types.md#EcdhWebcryptoTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
------------------------ | --------- | ------------ | -------------
ecdh_webcrypto_test.json | 553 | 488, 0, 65 | ECDH
## EcdsaP1363Verify
Test vectors of type EcdsaVerify are meant for the verification of IEEE P1363
encoded ECDSA signatures.
IEEE P1363 encoded signatures are the concatenation of the values r and s
encoded as unsigned integers in bigendian order using a fixed size equal to the
length of the field order.
Test vectors with "result" \: "valid" are valid signatures. Test vectors with
"result" \: "invalid" are invalid. Test vectors with "result" \: "acceptable"
are signatures that may or may not be rejected. The reasons for potential
rejection are described with labels. Weak parameters such as small curves, hash
functions weaker than the security of the curve are potential reasons.
JSON schema\: ecdsa_p1363_verify_schema.json
Type of the test group\: [EcdsaP1363TestGroup](types.md#EcdsaP1363TestGroup)
Type of the test vectors\: [SignatureTestVector](types.md#SignatureTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
-------------------------------------------- | --------- | ------------ | -------------
ecdsa_brainpoolP224r1_sha224_p1363_test.json | 188 | 118, 3, 67 | ECDSA
ecdsa_brainpoolP256r1_sha256_p1363_test.json | 218 | 147, 3, 68 | ECDSA
ecdsa_brainpoolP320r1_sha384_p1363_test.json | 221 | 150, 3, 68 | ECDSA
ecdsa_brainpoolP384r1_sha384_p1363_test.json | 249 | 178, 3, 68 | ECDSA
ecdsa_brainpoolP512r1_sha512_p1363_test.json | 292 | 222, 3, 67 | ECDSA
ecdsa_secp224r1_sha224_p1363_test.json | 185 | 115, 3, 67 | ECDSA
ecdsa_secp224r1_sha256_p1363_test.json | 213 | 143, 3, 67 | ECDSA
ecdsa_secp224r1_sha512_p1363_test.json | 282 | 212, 3, 67 | ECDSA
ecdsa_secp256k1_sha256_p1363_test.json | 209 | 139, 3, 67 | ECDSA
ecdsa_secp256k1_sha512_p1363_test.json | 278 | 208, 3, 67 | ECDSA
ecdsa_secp256r1_sha256_p1363_test.json | 217 | 144, 4, 69 | ECDSA
ecdsa_secp256r1_sha512_p1363_test.json | 286 | 213, 4, 69 | ECDSA
ecdsa_secp384r1_sha384_p1363_test.json | 237 | 165, 3, 69 | ECDSA
ecdsa_secp384r1_sha512_p1363_test.json | 274 | 202, 3, 69 | ECDSA
ecdsa_secp521r1_sha512_p1363_test.json | 275 | 203, 3, 69 | ECDSA
ecdsa_webcrypto_test.json | 336 | 244, 10, 82 | ECDSA
## EcdsaVerify
Test vectors of type EcdsaVerify are meant for the verification of ASN encoded
ECDSA signatures.
Test vectors with "result" \: "valid" are valid signatures. Test vectors with
"result" \: "invalid" are invalid. Test vectors with "result" \: "acceptable"
are signatures that may or may not be rejected. The reasons for potential
rejection are described with labels. Weak parameters such as small curves, hash
functions weaker than the security of the curve are potential reasons.
Non-standard BER encodings are other reasons.
JSON schema\: ecdsa_verify_schema.json
Type of the test group\: [EcdsaTestGroup](types.md#EcdsaTestGroup)
Type of the test vectors\:
[AsnSignatureTestVector](types.md#AsnSignatureTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
-------------------------------------- | --------- | ------------ | -------------
ecdsa_brainpoolP224r1_sha224_test.json | 343 | 119, 2, 222 | ECDSA
ecdsa_brainpoolP256r1_sha256_test.json | 373 | 148, 0, 225 | ECDSA
ecdsa_brainpoolP320r1_sha384_test.json | 376 | 151, 1, 224 | ECDSA
ecdsa_brainpoolP384r1_sha384_test.json | 404 | 179, 0, 225 | ECDSA
ecdsa_brainpoolP512r1_sha512_test.json | 446 | 223, 0, 223 | ECDSA
ecdsa_secp224r1_sha224_test.json | 340 | 116, 1, 223 | ECDSA
ecdsa_secp224r1_sha256_test.json | 368 | 144, 0, 224 | ECDSA
ecdsa_secp224r1_sha3_224_test.json | 368 | 144, 2, 222 | ECDSA
ecdsa_secp224r1_sha3_256_test.json | 376 | 152, 2, 222 | ECDSA
ecdsa_secp224r1_sha3_512_test.json | 441 | 217, 2, 222 | ECDSA
ecdsa_secp224r1_sha512_test.json | 437 | 213, 1, 223 | ECDSA
ecdsa_secp256k1_sha256_test.json | 364 | 140, 1, 223 | ECDSA
ecdsa_secp256k1_sha3_256_test.json | 372 | 148, 1, 223 | ECDSA
ecdsa_secp256k1_sha3_512_test.json | 437 | 213, 1, 223 | ECDSA
ecdsa_secp256k1_sha512_test.json | 433 | 209, 1, 223 | ECDSA
ecdsa_secp256r1_sha256_test.json | 371 | 145, 1, 225 | ECDSA
ecdsa_secp256r1_sha3_256_test.json | 379 | 153, 1, 225 | ECDSA
ecdsa_secp256r1_sha3_512_test.json | 444 | 218, 2, 224 | ECDSA
ecdsa_secp256r1_sha512_test.json | 440 | 214, 1, 225 | ECDSA
ecdsa_secp384r1_sha384_test.json | 392 | 166, 1, 225 | ECDSA
ecdsa_secp384r1_sha3_384_test.json | 402 | 176, 0, 226 | ECDSA
ecdsa_secp384r1_sha3_512_test.json | 433 | 207, 2, 224 | ECDSA
ecdsa_secp384r1_sha512_test.json | 429 | 203, 2, 224 | ECDSA
ecdsa_secp521r1_sha3_512_test.json | 433 | 208, 0, 225 | ECDSA
ecdsa_secp521r1_sha512_test.json | 431 | 204, 0, 227 | ECDSA
ecdsa_test.json | 1525 | 989, 5, 531 | ECDSA
## EddsaVerify
Test vectors of type EddsaVerify are intended for testing the verification of
Eddsa signatures.
JSON schema\: eddsa_verify_schema.json
Type of the test group\: [EddsaTestGroup](types.md#EddsaTestGroup)
Type of the test vectors\: [SignatureTestVector](types.md#SignatureTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
--------------- | --------- | ------------ | -------------
ed448_test.json | 86 | 17, 0, 69 | EDDSA
eddsa_test.json | 111 | 50, 0, 61 | EDDSA
## HkdfTest
Test vector of type HkdfTest are intended for the verification of HKDF.
HKDF differs from other key derivation function because the function accepts
more parameters. I.e. the input for HKDF is a tuple (ikm, salt, info, size).
JSON schema\: hkdf_test_schema.json
Type of the test group\: [HkdfTestGroup](types.md#HkdfTestGroup)
Type of the test vectors\: [HkdfTestVector](types.md#HkdfTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
--------------------- | --------- | ------------ | -------------
hkdf_sha1_test.json | 61 | 61, 0, 0 | HKDF-SHA-1
hkdf_sha256_test.json | 60 | 60, 0, 0 | HKDF-SHA-256
hkdf_sha512_test.json | 57 | 57, 0, 0 | HKDF-SHA-512
## IndCpaTest
Test vectors of type IndCpaTest are intended for test that verify encryption and
decryption of symmetric ciphers without authentication.
JSON schema\: ind_cpa_test_schema.json
Type of the test group\: [IndCpaTestGroup](types.md#IndCpaTestGroup)
Type of the test vectors\: [IndCpaTestVector](types.md#IndCpaTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
----------------------- | --------- | ------------ | -------------
aes_cbc_pkcs5_test.json | 183 | 72, 0, 111 | AES-CBC-PKCS5
## KeywrapTest
Test vectors of type Keywrap are intended for tests checking the wrapping and
unwrapping of key material.
Invalid test vectors may contain vectors with invalid sizes, or invalid
paddings. This is not ideal for testing whether unwrapping allows some padding
oracle. If there are key wrapping primitives that can be attacked when padding
oracles are present then we might add additional files just for checking against
padding attacks.
JSON schema\: keywrap_test_schema.json
Type of the test group\: [KeywrapTestGroup](types.md#KeywrapTestGroup)
Type of the test vectors\: [KeywrapTestVector](types.md#KeywrapTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
------------- | --------- | ------------ | -------------
kw_test.json | 162 | 36, 0, 126 | KW
kwp_test.json | 224 | 20, 60, 144 | KWP
## MacTest
Test vectors of type MacTest are intended for testing the generation and
verification of MACs.
Test vectors with invalid MACs may contain vectors that contain invalid tags,
invalid parameters or invalid formats. Hence they are not ideal for testing if
an implementation is susceptible to padding attacks. Future version might
include separate files to simplify such tests.
JSON schema\: mac_test_schema.json
Type of the test group\: [MacTestGroup](types.md#MacTestGroup)
Type of the test vectors\: [MacTestVector](types.md#MacTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
------------------ | --------- | ------------ | -------------
aes_cmac_test.json | 290 | 42, 0, 248 | AES-CMAC
## RsaKeyTest
Test vectors of type RsaKeyTest are intended for checking the decoding of RSA
public keys.
JSON schema\: rsa_key_test_schema.json
Type of the test group\: [RsaKeyTestGroup](types.md#RsaKeyTestGroup)
Type of the test vectors\: [RsaKeyTestVector](types.md#RsaKeyTestVector)
**name** | **tests** | **validity** | **algorithm** | **missingFlags** {.sortable}
------------- | --------- | ------------ | ------------- | ----------------
rsa_test.json | 334 | 1, 333, 0 | RSA | 333
## RsaesOaepDecrypt
Test vectors of type RsaOeapDecrypt are intended to check the decryption of RSA
encrypted ciphertexts.
The test vectors contain ciphertexts with invalid format (i.e. incorrect size)
and test vectors with invalid padding. Hence the test vectors are a bit
inconvenient to detect padding oracles. One potential plan is to generate
separate, new files that only contain ciphertexts with invalid paddings.
JSON schema\: rsaes_oaep_decrypt_schema.json
Type of the test group\: [RsaesOaepTestGroup](types.md#RsaesOaepTestGroup)
Type of the test vectors\: [RsaesOaepTestVector](types.md#RsaesOaepTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
----------------------------------------- | --------- | ------------ | -------------
rsa_oaep_2048_sha1_mgf1sha1_test.json | 34 | 17, 0, 17 | RSAES-OAEP
rsa_oaep_2048_sha224_mgf1sha1_test.json | 29 | 13, 0, 16 | RSAES-OAEP
rsa_oaep_2048_sha224_mgf1sha224_test.json | 33 | 17, 0, 16 | RSAES-OAEP
rsa_oaep_2048_sha256_mgf1sha1_test.json | 29 | 13, 0, 16 | RSAES-OAEP
rsa_oaep_2048_sha256_mgf1sha256_test.json | 35 | 18, 0, 17 | RSAES-OAEP
rsa_oaep_2048_sha384_mgf1sha1_test.json | 29 | 13, 0, 16 | RSAES-OAEP
rsa_oaep_2048_sha384_mgf1sha384_test.json | 32 | 16, 0, 16 | RSAES-OAEP
rsa_oaep_2048_sha512_mgf1sha1_test.json | 29 | 13, 0, 16 | RSAES-OAEP
rsa_oaep_2048_sha512_mgf1sha512_test.json | 31 | 14, 0, 17 | RSAES-OAEP
rsa_oaep_3072_sha256_mgf1sha1_test.json | 30 | 13, 0, 17 | RSAES-OAEP
rsa_oaep_3072_sha256_mgf1sha256_test.json | 35 | 18, 0, 17 | RSAES-OAEP
rsa_oaep_3072_sha512_mgf1sha1_test.json | 29 | 13, 0, 16 | RSAES-OAEP
rsa_oaep_3072_sha512_mgf1sha512_test.json | 31 | 15, 0, 16 | RSAES-OAEP
rsa_oaep_4096_sha256_mgf1sha1_test.json | 30 | 13, 0, 17 | RSAES-OAEP
rsa_oaep_4096_sha256_mgf1sha256_test.json | 35 | 18, 0, 17 | RSAES-OAEP
rsa_oaep_4096_sha512_mgf1sha1_test.json | 29 | 13, 0, 16 | RSAES-OAEP
rsa_oaep_4096_sha512_mgf1sha512_test.json | 34 | 17, 0, 17 | RSAES-OAEP
rsa_oaep_misc_test.json | 775 | 460, 315, 0 | RSAES-OAEP
## RsassaPkcs1Generate
Test vectors of class RsassaPkcs1Generate are intended for checking the
generation of RSA PKCS #1 v 1.5 signatures.
The test vectors only provide limited coverage for signature verification, since
a frequent flaw in implementations is to only check the padding partially.
JSON schema\: rsassa_pkcs1_generate_schema.json
Type of the test group\:
[RsassaPkcs1GenTestGroup](types.md#RsassaPkcs1GenTestGroup)
Type of the test vectors\: [SignatureTestVector](types.md#SignatureTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
-------------------------- | --------- | ------------ | -------------
rsa_sig_gen_misc_test.json | 158 | 80, 78, 0 | RSASSA-PKCS1-v1_5
## RsassaPkcs1Verify
Test vectors of class RsassaPkcs1Verify are intended for checking the
verification of RSA PKCS #1 v 1.5 signatures.
RSA signature verification should generally be very strict about checking the
padding. Because of this most RSA signatures with a slightly modified padding
have "result" \: "invalid". Only a small number of RSA signatures implementing
legacy behaviour (such as a missing NULL in the encoding) have "result" \:
"acceptable".
JSON schema\: rsassa_pkcs1_verify_schema.json
Type of the test group\: [RsassaPkcs1TestGroup](types.md#RsassaPkcs1TestGroup)
Type of the test vectors\: [SignatureTestVector](types.md#SignatureTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
----------------------------------- | --------- | ------------ | -------------
rsa_signature_2048_sha224_test.json | 235 | 7, 1, 227 | RSASSA-PKCS1-v1_5
rsa_signature_2048_sha256_test.json | 235 | 7, 3, 225 | RSASSA-PKCS1-v1_5
rsa_signature_2048_sha512_test.json | 234 | 7, 2, 225 | RSASSA-PKCS1-v1_5
rsa_signature_3072_sha256_test.json | 234 | 7, 2, 225 | RSASSA-PKCS1-v1_5
rsa_signature_3072_sha384_test.json | 233 | 7, 1, 225 | RSASSA-PKCS1-v1_5
rsa_signature_3072_sha512_test.json | 234 | 7, 2, 225 | RSASSA-PKCS1-v1_5
rsa_signature_4096_sha384_test.json | 233 | 7, 1, 225 | RSASSA-PKCS1-v1_5
rsa_signature_4096_sha512_test.json | 233 | 7, 1, 225 | RSASSA-PKCS1-v1_5
rsa_signature_test.json | 372 | 77, 70, 225 | RSASSA-PKCS1-v1_5
## RsassaPssVerify
Test vectors of class RsassaPssVerify are intended for checking the verification
of RSASSA-PSS signatures.
RSA signature verification should generally be very strict about checking the
padding. Because of this RSASSA-PSS signatures with a modified padding have
"result" \: "invalid".
JSON schema\: rsassa_pss_verify_schema.json
Type of the test group\: [RsassaPssTestGroup](types.md#RsassaPssTestGroup)
Type of the test vectors\: [RsassaPssTestVector](types.md#RsassaPssTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
-------------------------------------------- | --------- | ------------ | -------------
rsa_pss_2048_sha1_mgf1_20_test.json | 47 | 0, 9, 38 | RSASSA-PSS
rsa_pss_2048_sha256_mgf1_0_test.json | 44 | 7, 0, 37 | RSASSA-PSS
rsa_pss_2048_sha256_mgf1_32_params_test.json | 47 | 9, 0, 38 | RSASSA-PSS
rsa_pss_2048_sha256_mgf1_32_test.json | 47 | 9, 0, 38 | RSASSA-PSS
rsa_pss_3072_sha256_mgf1_32_test.json | 47 | 9, 0, 38 | RSASSA-PSS
rsa_pss_4096_sha256_mgf1_32_test.json | 47 | 9, 0, 38 | RSASSA-PSS
rsa_pss_4096_sha512_mgf1_32_test.json | 46 | 9, 0, 37 | RSASSA-PSS
rsa_pss_misc_params_test.json | 150 | 120, 30, 0 | RSASSA-PSS
rsa_pss_misc_test.json | 150 | 120, 30, 0 | RSASSA-PSS
## XdhAsnComp
Test vectors of type XdhComp are intended for tests that verify the computation
of and Xdh key exchange.
Public and private keys are ASN encoded.
JSON schema\: xdh_asn_comp_schema.json
Type of the test group\: [XdhAsnTestGroup](types.md#XdhAsnTestGroup)
Type of the test vectors\: [XdhAsnTestVector](types.md#XdhAsnTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
-------------------- | --------- | ------------ | -------------
x25519_asn_test.json | 175 | 61, 98, 16 | XDH
x448_asn_test.json | 150 | 59, 75, 16 | XDH
## XdhComp
Test vectors of type XdhComp are intended for tests that verify the computation
of and Xdh key exchange.
Both public and private key in the test vectors are just raw bytes. There are
separate files, where the keys are ASN.1 encoded or use the webcrypto encoding.
JSON schema\: xdh_comp_schema.json
Type of the test group\: [XdhTestGroup](types.md#XdhTestGroup)
Type of the test vectors\: [XdhTestVector](types.md#XdhTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
---------------- | --------- | ------------ | -------------
x25519_test.json | 159 | 61, 98, 0 | XDH
x448_test.json | 134 | 59, 75, 0 | XDH
## XdhJwkComp
Test vectors of type XdhComp are intended for tests that verify the computation
of and Xdh key exchange.
The public and private keys in these test vectors use the webcrypto encoding.
JSON schema\: xdh_jwk_comp_schema.json
Type of the test group\: [XdhJwkTestGroup](types.md#XdhJwkTestGroup)
Type of the test vectors\: [XdhJwkTestVector](types.md#XdhJwkTestVector)
**name** | **tests** | **validity** | **algorithm** {.sortable}
-------------------- | --------- | ------------ | -------------
x25519_jwk_test.json | 163 | 61, 98, 4 | XDH
x448_jwk_test.json | 138 | 59, 75, 4 | XDH
+124
View File
@@ -0,0 +1,124 @@
# Wycheproof formats for test vectors
[TOC]
## Overview
This document contains a general overview over the formats used and conventions
used for all test test vectors. Test types have specific formats, which are
defined in [types.md](types.md). The test files and the tests intended with
these test files are described in [files.md](files.md).
## General conventions
* All files contain valid JSON. The root structure contains the field
"schema", which is the file name of the JSON schema for this file. The JSON
schemas are in the directory `wycheproof/schemas/`. Changes in the format of
a test vector file that break compatibility will be reflected by a changed
JSON schema file.
* The data included in the header of the test vector file and the test groups
are always well formatted. Only inputs contained in the individual tests may
be malformed.
* The file name for test vectors has typically the format
`<algorithm>_<parameters>_test.json`.
* The header of testGroups often contains a key in multiple formats. All
formats encode the same key. Hence a tester can use the format that is
supported by the library that is tested.
## Naming of primitives and algebraic structures
### Hash functions
Wycheproof uses the following strings to denote hash functions: SHA-1, SHA-224,
SHA-256, SHA-384, SHA-512, SHA3-224, SHA3-256, SHA3-384, SHA3-512
### Elliptic curves
The following names for elliptic curves are used in Wycheproof. Some of the
curves have a jwk equivalent.
**Curve name** | **jwk name** | **comments and references**
:-------------- | :----------- | :--------------------------
secp224r1 | |
secp256r1 | P-256 |
secp384r1 | P-384 |
secp521r1 | P-521 |
secp256k1 | P-256K | jwk name is proposed in tools.ietf.org/html/draft-jones-webauthn-secp256k1-00
brainpoolP256r1 | | [RFC 5639]
brainpoolP320r1 | | [RFC 5639]
brainpoolP384r1 | | [RFC 5639]
brainpoolP512r1 | | [RFC 5639]
brainpoolP256t1 | | [RFC 5639]
brainpoolP320t1 | | [RFC 5639]
brainpoolP384t1 | | [RFC 5639]
brainpoolP512t1 | | [RFC 5639]
curve25519 | | Section 4.1 [RFC 7748]
curve448 | | Section 4.2 [RFC 7748]
edwards25519 | Ed25519 | A curve that is used in Eddsa. It is isomorphic to curve25519. See [RFC 8032], [RFC 8037]
edwards448 | Ed448 | A curve that is used in Eddsa. It is isomorphic to curve448. See [RFC 8032], [RFC 8037]
## Test groups and tests
Test vectors are divided into several test groups. A test group is a list of
test vectors that use some common parameters (e.g. the same public key and
algorithm)
## Representation of some data types
Some data types that don't have an exact match in Json use a specific format as
described below
| **Type** | **Representation** |
| :------- | :---------------------------------------------------------------- |
| HexBytes | This is an array of bytes represented as by hexadecimal string. |
| BigInt | An integer in hexadecimal representation using a twos complement |
: : representation and big-endian order. The integer is negative if :
: : the first byte is greater character is greater than 7. Examples\: :
: : 259\: "103", -192\: "f40", 0\: "0" :
| Asn | A hexadecimal encoded array of bytes. This may be a valid or |
: : invalid ASN encoding. :
| Der | A valid DER encoding represented as a hexadecimal string. |
## General format
This is the format for a file with test vectors.
| **Field name** | **Type** | **Explanation** |
| :--------------- | :---------- | :------------------------------------------ |
| algorithm | str | The name of the algorithm |
| schema | str | The name of the JSON schema defining the |
: : : format of the test vectors. :
| generatorVersion | str | The version of the generator that generated |
: : : the test vectors. For releases this has the :
: : : format “major.minor”, where changes in the :
: : : format will be reflected by incrementing :
: : : major. :
| numberOfTests | int | the number of test cases in the test vector |
: : : file. :
| header | list of str | description of the file |
| notes | dictionary | A dictionary describing flags. (modified in |
: : : v. 0.3) :
| testGroups | list | a list of test groups. The format of the |
: : : test group depends on the algorithm that is :
: : : tested. :
Example:
```
{
"algorithm" : "AES-EAX",
"schema" : "aead\_test\_schema.json",
"generatorVersion" : "0.7",
"numberOfTests" : 143,
"header" : [
"text",
"more text",
"maybe some references"
],
"notes" : [
"label1" : "Description of label1",
...
]
"testGroups" : [ ... ]
}
```
+920
View File
@@ -0,0 +1,920 @@
<!-- This file is automatically generated. -->
# Test vector types
Version\: 0.7
## AeadTestGroup {#AeadTestGroup}
A test group for authenticated encryption with additional data.
Fields additional to the fields in TestGroup are\:
| **name** | **type** | **desc** |
| -------- | ---------------------- | ---------------------------------------- |
| ivSize | int | The IV size in bits. All IV sizes are |
: : : multiple of 8 bits. :
| keySize | int | the keySize in bits |
| tagSize | int | The expected size of the tag in bits. |
: : : This is the size that should be used to :
: : : initialize instance of the cipher. The :
: : : actual tag in the test vector may have a :
: : : different size. Such a test vector is :
: : : always invalid and an implementation is :
: : : expected to reject such tags. All tag :
: : : sizes are multiples of 8 bits. :
| tests | List of AeadTestVector | a list of test vectors |
## AeadTestVector {#AeadTestVector}
A test vector for authenticated encryption with additional data.
Fields additional to the fields in TestVector are\:
| **name** | **type** | **desc** |
| -------- | -------- | ------------------------------------------------------ |
| key | HexBytes | the key |
| iv | HexBytes | the nonce |
| aad | HexBytes | additional authenticated data |
| msg | HexBytes | the plaintext |
| ct | HexBytes | the ciphertext (without iv and tag) |
| tag | HexBytes | The authenticatian tag. Most encryption append the tag |
: : : to the ciphertext. Encryption results in the :
: : : concatenation ct || tag and decryption expects ct || :
: : : tag as input. There are however some exceptions. For :
: : : example AEAD-AES-SIV-CMAC (RFC 5297) computes a :
: : : synthetic IV (SIV), which is used to initialize the :
: : : counter for AES. The typical encoding here is to :
: : : prepend the SIV. I.e. implementations would expect :
: : : ciphertext of the form tag || ct or iv || tag || ct. :
Used in [AeadTestGroup](#AeadTestGroup).
## AsnSignatureTestVector {#AsnSignatureTestVector}
A test vector with an ASN.1 encoded public key signature. For example, ECDSA and
DSA signatures are a pair of integers (r,s). These integers can be encoded in
different ways. A popular encoding is to represent the integers as an ASN
Sequence. The expectation is that any library generates only DER encoded
signatures. Some libraries are also strict in the sense that only DER encoded
signautes are accepted. Other libraries accept some signatures where the pair
(r,s) uses an alternative BER encoding assuming of course that the encoded (r,s)
is valid.
Fields additional to the fields in TestVector are\:
**name** | **type** | **desc**
-------- | -------- | --------------------------------
msg | HexBytes | The message to sign
sig | Asn | An ASN encoded signature for msg
Used in [DsaTestGroup](#DsaTestGroup), [EcdsaTestGroup](#EcdsaTestGroup).
## DaeadTestGroup {#DaeadTestGroup}
Fields additional to the fields in TestGroup are\:
**name** | **type** | **desc**
-------- | ----------------------- | ----------------------
keySize | int | the keySize in bits
tests | List of DaeadTestVector | a list of test vectors
## DaeadTestVector {#DaeadTestVector}
A test vector used for authenticated deterministic encryption with additional
data.
Fields additional to the fields in TestVector are\:
**name** | **type** | **desc**
-------- | -------- | -----------------------------
key | HexBytes | the key
aad | HexBytes | additional authenticated data
msg | HexBytes | the plaintext
ct | HexBytes | the ciphertext including tag
Used in [DaeadTestGroup](#DaeadTestGroup).
## DsaPrivateKey {#DsaPrivateKey}
A DSA private key. This implementation of DSA must only be used for testing rsp.
for generating test vectors. It has not been checked for flaws and in some cases
may even avoid necessary checks so that it can be used for flawed test vectors.
| **name** | **type** | **desc** | **enum** |
| -------- | -------- | ---------------------------- | ----------------- |
| g | BigInt | the generator of the | |
: : : multiplicative subgroup : :
| keySize | int | the key size in bits | |
| p | BigInt | the modulus p | |
| q | BigInt | the order of the generator g | |
| type | str | the key type | ['DsaPrivateKey'] |
| x | BigInt | the private key value | |
| y | BigInt | the public key value | |
## DsaPublicKey {#DsaPublicKey}
The public key for DSA.
| **name** | **type** | **desc** | **enum** |
| -------- | -------- | ----------------------------------- | ---------------- |
| g | BigInt | the generator of the multiplicative | |
: : : subgroup : :
| keySize | int | the key size in bits | |
| p | BigInt | the modulus p | |
| q | BigInt | the order of the generator g | |
| type | str | the key type | ['DsaPublicKey'] |
| y | BigInt | the public key value | |
## DsaTestGroup {#DsaTestGroup}
Fields additional to the fields in TestGroup are\:
**name** | **type** | **desc**
-------- | ------------------------------ | ------------------------------
key | DsaPublicKey | unenocded DSA public key
keyDer | Der | DER encoded public key
keyPem | Pem | Pem encoded public key
sha | str | the hash function used for DSA
tests | List of AsnSignatureTestVector | a list of test vectors
## EcPointTestGroup {#EcPointTestGroup}
Fields additional to the fields in TestGroup are\:
| **name** | **type** | **desc** | **enum** |
| -------- | ----------------- | ----------------- | --------------- |
| curve | str | the name of the | |
: : : elliptic curve : :
| encoding | str | the encoding used | ('compressed', |
: : : : 'uncompressed') :
| tests | List of | a list of test | |
: : EcPointTestVector : vectors : :
## EcPointTestVector {#EcPointTestVector}
Fields additional to the fields in TestVector are\:
**name** | **type** | **desc**
-------- | -------- | -------------------------------
encoded | HexBytes | X509 encoded point on the curve
x | BigInt | x-coordinate of the point
y | BigInt | y-coordiante of the point
Used in [EcPointTestGroup](#EcPointTestGroup).
## EcPublicKey {#EcPublicKey}
**name** | **type** | **desc** | **enum**
------------ | -------------------------------------------------------- | --------------------------------------------------- | --------
curve | typing.Union[ecutil.EcUnnamedGroup, ecutil.EcNamedGroup] | the EC group used by this public key |
keySize | int | the key size in bits |
type | str | the key type | ['EcPublicKey']
uncompressed | HexBytes | X509 encoded public key point in hexadecimal format |
wx | BigInt | the x-coordinate of the public key point |
wy | BigInt | the y-coordinate of the public key point |
## EcPublicKeyTestGroup {#EcPublicKeyTestGroup}
Fields additional to the fields in TestGroup are\:
| **name** | **type** | **desc** | **enum** |
| -------- | --------------------- | ------------------- | -------------- |
| encoding | Der | the encoding of the | ['asn', 'pem', |
: : : encoded keys : 'webcrypto'] :
| tests | List of | a list of test | |
: : EcPublicKeyTestVector : vectors : :
## EcPublicKeyTestVector {#EcPublicKeyTestVector}
Draft version for test vectors that test importing of EC public keys. The test
vectors contain modified EC public keys. The goal of the test is to recognize if
importing the EC public keys notices inconsistencies and bad formatting.
Fields additional to the fields in TestVector are\:
| **name** | **type** | **desc** |
| -------- | --------------------------- | ---------------------------------- |
| encoded | Asn | Encoded EC public key over a prime |
: : : order field :
| p | BigInt | The order of underlying field |
| n | BigInt | The order of the generator |
| a | BigInt | The value a of the Weierstrass |
: : : equation :
| b | BigInt | The value b of the Weierstrass |
: : : equation :
| gx | BigInt | x-coordinate of the generator |
| gy | BigInt | y-coordinate of the generator |
| h | typing.Union[int, NoneType] | the cofactor |
| wx | BigInt | x-coordinate of the public point |
| wy | BigInt | y-coordinate of the public point |
Used in [EcPublicKeyTestGroup](#EcPublicKeyTestGroup).
## EcUnnamedGroup {#EcUnnamedGroup}
An unamed EC group
| **name** | **type** | **desc** | **enum** |
| -------- | -------- | -------------------------------- | ------------------- |
| a | BigInt | coefficient a of the elliptic | |
: : : curve equation : :
| b | BigInt | coefficient b of the elliptic | |
: : : curve equation : :
| gx | BigInt | the x-coordinate of the | |
: : : generator : :
| gy | BigInt | the y-coordinate of the | |
: : : generator : :
| h | int | the cofactor | |
| n | BigInt | the order of the generator | |
| p | BigInt | the order of the underlying | |
: : : field : :
| type | str | an unnamed EC group over a prime | ['PrimeOrderCurve'] |
: : : field in Weierstrass form : :
## EcdhEcpointTestGroup {#EcdhEcpointTestGroup}
Fields additional to the fields in TestGroup are\:
**name** | **type** | **desc**
-------- | ----------------------------- | -----------------------------
tests | List of EcdhEcpointTestVector | a list of test vectors
type | str | The type of the test vectors.
## EcdhEcpointTestVector {#EcdhEcpointTestVector}
Fields additional to the fields in TestVector are\:
**name** | **type** | **desc**
-------- | -------- | ------------------------
public | Asn | ASN encoded public point
private | BigInt | The private exponent
shared | HexBytes | The shared secret key
curve | str | the name of the EC curve
Used in [EcdhEcpointTestGroup](#EcdhEcpointTestGroup).
## EcdhPemTestGroup {#EcdhPemTestGroup}
Fields additional to the fields in TestGroup are\:
**name** | **type** | **desc**
-------- | ------------------------- | -----------------------------
tests | List of EcdhPemTestVector | a list of test vectors
type | str | The type of the test vectors.
## EcdhPemTestVector {#EcdhPemTestVector}
Fields additional to the fields in TestVector are\:
**name** | **type** | **desc**
-------- | -------- | ------------------------
public | Pem | Pem encoded public key
private | BigInt | the private key
shared | HexBytes | The shared secret key
curve | str | the name of the EC curve
Used in [EcdhPemTestGroup](#EcdhPemTestGroup).
## EcdhTestGroup {#EcdhTestGroup}
Fields additional to the fields in TestGroup are\:
**name** | **type** | **desc**
-------- | ---------------------- | -----------------------------
tests | List of EcdhTestVector | a list of test vectors
type | str | The type of the test vectors.
## EcdhTestVector {#EcdhTestVector}
Fields additional to the fields in TestVector are\:
| **name** | **type** | **desc** |
| -------- | -------- | ---------------------------------------------------- |
| public | Asn | Encoded public key |
| private | BigInt | the private key |
| shared | HexBytes | The shared secret key. Some invalid test vectors |
: : : contain a shared secret, which is computed using the :
: : : curve of the private key. This allows to distinguish :
: : : between implementations ignoring public key info and :
: : : implementations using the curve of the public key. :
| curve | str | the name of the EC curve |
Used in [EcdhTestGroup](#EcdhTestGroup).
## EcdhWebcryptoTestGroup {#EcdhWebcryptoTestGroup}
Fields additional to the fields in TestGroup are\:
**name** | **type** | **desc**
-------- | ------------------------------- | -----------------------------
tests | List of EcdhWebcryptoTestVector | a list of test vectors
type | str | The type of the test vectors.
## EcdhWebcryptoTestVector {#EcdhWebcryptoTestVector}
Fields additional to the fields in TestVector are\:
**name** | **type** | **desc**
-------- | -------- | ----------------------------------
public | Json | Public key in webcrypto format
private | Json | Private key in webcrypto format
shared | HexBytes | The shared secret key
curve | str | the Webcrypto name of the EC curve
Used in [EcdhWebcryptoTestGroup](#EcdhWebcryptoTestGroup).
## EcdsaP1363TestGroup {#EcdsaP1363TestGroup}
A test group for ECDSA signatures using IEEE P1363 encoding. The test vectors in
this group are meant for signature verification. The test group contains the
same public key for the signatures in multiple representations. The public keys
are valid with the sole exception that they may use short keys and weak hash
functions such as SHA-1.
Fields additional to the fields in TestGroup are\:
| **name** | **type** | **desc** |
| -------- | --------------------------- | -------------------------------- |
| jwk | Json | [optional] the public key in |
: : : webcrypto format :
| key | EcPublicKey | unenocded EC public key |
| keyDer | Der | DER encoded public key |
| keyPem | Pem | Pem encoded public key |
| sha | str | the hash function used for ECDSA |
| tests | List of SignatureTestVector | a list of test vectors |
## EcdsaTestGroup {#EcdsaTestGroup}
A test group for ECDSA signatures. The test vectors in this group are meant for
signature verification. The test group contains the same public key for the
signatures in multiple representations. The public keys are valid with the sole
exception that they may use short keys and weak hash functions such as SHA-1.
Fields additional to the fields in TestGroup are\:
**name** | **type** | **desc**
-------- | ------------------------------ | --------------------------------
key | EcPublicKey | unenocded EC public key
keyDer | Der | DER encoded public key
keyPem | Pem | Pem encoded public key
sha | str | the hash function used for ECDSA
tests | List of AsnSignatureTestVector | a list of test vectors
## EddsaTestGroup {#EddsaTestGroup}
Fields additional to the fields in TestGroup are\:
| **name** | **type** | **desc** | **since** | **ref** |
| -------- | ------------------- | -------------- | --------- | --------- |
| jwk | Json | the private | 0.7 | RFC 8037 |
: : : key in : : Section 2 :
: : : webcrypto : : :
: : : format : : :
| key | Json | unencoded key | | |
: : : pair : : :
| keyDer | Asn | Asn encoded | | |
: : : public key : : :
| keyPem | Pem | Pem encoded | | |
: : : public key : : :
| tests | List of | a list of test | | |
: : SignatureTestVector : vectors : : :
## HkdfTestGroup {#HkdfTestGroup}
A test group for key derivation functions that take 4 arguments (ikm, salt,
info, size) as input.
Fields additional to the fields in TestGroup are\:
**name** | **type** | **desc**
-------- | ---------------------- | ---------------------------
keySize | int | the size of the ikm in bits
tests | List of HkdfTestVector | a list of test vectors
## HkdfTestVector {#HkdfTestVector}
A test vector for HKDF (or any other key derivation function with input ikm,
salt, info, size
Fields additional to the fields in TestVector are\:
**name** | **type** | **desc**
-------- | -------- | -------------------------------------------------
ikm | HexBytes | the key (input key material)
salt | HexBytes | the salt for the key derivation
info | HexBytes | additional information used in the key derivation
size | int | the size of the output in bytes
okm | HexBytes | the generated bytes (output key material)
Used in [HkdfTestGroup](#HkdfTestGroup).
## IndCpaTestGroup {#IndCpaTestGroup}
Fields additional to the fields in TestGroup are\:
**name** | **type** | **desc**
-------- | ------------------------ | ------------------------------------
ivSize | int | the IV size in bits
keySize | int | the keySize in bits
tagSize | int | the expected size of the tag in bits
tests | List of IndCpaTestVector | a list of test vectors
## IndCpaTestVector {#IndCpaTestVector}
A test vector that is used for symmetric primitives that are indistinguishable
under chosen plaintext attacks. These primitives are without an integrity check
and hence without additional authenticated data. For example AES using cipher
block chaining (CBC) is tested using this format.
Fields additional to the fields in TestVector are\:
**name** | **type** | **desc**
-------- | -------- | -------------------------------
key | HexBytes | the key
iv | HexBytes | the initialization vector
msg | HexBytes | the plaintext
ct | HexBytes | the raw ciphertext (without IV)
Used in [IndCpaTestGroup](#IndCpaTestGroup).
## KeywrapTestGroup {#KeywrapTestGroup}
Fields additional to the fields in TestGroup are\:
**name** | **type** | **desc**
-------- | ------------------------- | ----------------------
keySize | int | the keySize in bits
tests | List of KeywrapTestVector | a list of test vectors
## KeywrapTestVector {#KeywrapTestVector}
A test vector for key wrap primitives. Key wrap primitives are typically
symmetric encryptions that were specifically desigend for encrypting key
material. In some cases the input size is restricted to typical key sizes e.g. a
multiple of 8 bytes. The encryption may assume that the wrapped bytes have high
entropy. Hence some of the key wrap primitives are deterministic.
Fields additional to the fields in TestVector are\:
**name** | **type** | **desc**
-------- | -------- | ---------------------
key | HexBytes | the wrapping key
msg | HexBytes | the key bytes to wrap
ct | HexBytes | the wrapped key
Used in [KeywrapTestGroup](#KeywrapTestGroup).
## MacTestGroup {#MacTestGroup}
Fields additional to the fields in TestGroup are\:
**name** | **type** | **desc**
-------- | --------------------- | ------------------------------------
keySize | int | the keySize in bits
tagSize | int | the expected size of the tag in bits
tests | List of MacTestVector | a list of test vectors
## MacTestVector {#MacTestVector}
A test vector for message authentication codes (MAC).
Fields additional to the fields in TestVector are\:
**name** | **type** | **desc**
-------- | -------- | ----------------------
key | HexBytes | the key
msg | HexBytes | the plaintext
tag | HexBytes | the authentication tag
Used in [MacTestGroup](#MacTestGroup).
## RsaKeyTestGroup {#RsaKeyTestGroup}
Fields additional to the fields in TestGroup are\:
| **name** | **type** | **desc** | **enum** |
| -------- | ---------------- | ---------------------------- | -------------- |
| encoding | str | The encoding of the public | ['asn', 'pem'] |
: : : key in the test vectors. asn : :
: : : implies PKCS8 encoded public : :
: : : keys. pem implies a PEM : :
: : : encoded public key : :
: : : (compatible with OpenSSL. : :
| private | Json | the private key | |
| tests | List of | a list of test vectors | |
: : RsaKeyTestVector : : :
## RsaKeyTestVector {#RsaKeyTestVector}
Fields additional to the fields in TestVector are\:
**name** | **type** | **desc**
-------- | -------- | ----------------------
public | HexBytes | the encoded public key
Used in [RsaKeyTestGroup](#RsaKeyTestGroup).
## RsaesOaepTestGroup {#RsaesOaepTestGroup}
Fields additional to the fields in TestGroup are\:
| **name** | **type** | **desc** |
| --------------- | --------------------------- | --------------------------- |
| d | BigInt | The private exponent |
| e | BigInt | The public exponent |
| mgf | str | the message generating |
: : : function (e.g. MGF1) :
| mgfSha | str | The hash function used for |
: : : the message generating :
: : : function. :
| n | BigInt | The modulus of the key |
| privateKeyPem | Pem | Pem encoded private key |
| privateKeyPkcs8 | Der | Pkcs 8 encoded private key. |
| sha | str | The hash function for |
: : : hashing the label. :
| tests | List of RsaesOaepTestVector | a list of test vectors |
## RsaesOaepTestVector {#RsaesOaepTestVector}
Fields additional to the fields in TestVector are\:
**name** | **type** | **desc**
-------- | -------- | ---------------------------------
msg | HexBytes | The encrypted message
ct | HexBytes | An encryption of msg
label | HexBytes | The label used for the encryption
Used in [RsaesOaepTestGroup](#RsaesOaepTestGroup).
## RsassaPkcs1GenTestGroup {#RsassaPkcs1GenTestGroup}
Fields additional to the fields in TestGroup are\:
| **name** | **type** | **desc** | **ref** | **since** |
| ------------- | ------------------- | --------------- | -------- | --------- |
| d | BigInt | The private | | |
: : : exponent : : :
| e | BigInt | The public | | |
: : : exponent : : :
| keyAsn | Der | DER encoding of | | |
: : : the sequence : : :
: : : [n, e] : : :
| keyDer | Der | DER encoding of | | |
: : : the public key : : :
| keyJwk | Json | [Optional] | RFC 7517 | 0.7 |
: : : Private key in : : :
: : : JWK format : : :
| keyPem | Pem | Pem encoded | | |
: : : public key : : :
| keySize | int | the size of the | | |
: : : modulus in bits : : :
| n | BigInt | The modulus of | | |
: : : the key : : :
| privateKeyDer | Der | DER encoding of | | |
: : : the private key : : :
| privateKeyJwk | Json | [Optional] | RFC 7517 | 0.7 |
: : : Private key in : : :
: : : JWK format : : :
| privateKeyPem | Pem | Pem encoded | | |
: : : private key : : :
| sha | str | the hash | | |
: : : function used : : :
: : : for the message : : :
| tests | List of | a list of test | | |
: : SignatureTestVector : vectors : : :
## RsassaPkcs1TestGroup {#RsassaPkcs1TestGroup}
Fields additional to the fields in TestGroup are\:
| **name** | **type** | **desc** | **ref** | **since** |
| -------- | ------------------- | -------------------- | -------- | --------- |
| d | BigInt | The private exponent | | |
| e | BigInt | The public exponent | | |
| keyAsn | Der | ASN encoding of the | | |
: : : sequence [n, e] : : :
| keyDer | Der | ASN encoding of the | | |
: : : public key : : :
| keyJwk | Json | The public key in | RFC 7517 | 0.7 |
: : : JWK format. The key : : :
: : : is missing if the : : :
: : : signature algorithm : : :
: : : for the given hash : : :
: : : is not defined. : : :
| keyPem | Pem | Pem encoded public | | |
: : : key : : :
| keySize | int | the size of the | | |
: : : modulus in bits : : :
| n | BigInt | The modulus of the | | |
: : : key : : :
| sha | str | the hash function | | |
: : : used for the message : : :
| tests | List of | a list of test | | |
: : SignatureTestVector : vectors : : :
## RsassaPssTestGroup {#RsassaPssTestGroup}
Fields additional to the fields in TestGroup are\:
| **name** | **type** | **desc** |
| -------- | --------------------------- | ----------------------------------- |
| d | BigInt | The private exponent |
| e | BigInt | The public exponent |
| keyAsn | Der | ASN encoding of the sequence [n, e] |
| keyDer | Der | ASN encoding of the public key |
| keyPem | Pem | Pem encoded public key |
| keySize | int | the size of the modulus in bits |
| mgf | str | the message generating function |
: : : (e.g. MGF1) :
| mgfSha | str | The hash function used for the |
: : : message generating function. :
| n | BigInt | The modulus of the key |
| sha | str | The hash function for hasing the |
: : : message. :
| tests | List of RsassaPssTestVector | a list of test vectors |
## RsassaPssTestVector {#RsassaPssTestVector}
Fields additional to the fields in TestVector are\:
**name** | **type** | **desc**
-------- | -------- | -------------------
msg | HexBytes | The message to sign
sig | HexBytes | a signature for msg
Used in [RsassaPssTestGroup](#RsassaPssTestGroup).
## SignatureTestVector {#SignatureTestVector}
A test vector with a public key signature. This structure is used for public key
signatures where the primitive specifies the encoding as an array of bytes (e.g.
P1363 encoded ECDSA signatures.) Public key signatures with additional
formatting (e.g. ASN.1 encoded ECDSA signatures) have their separate types.
Fields additional to the fields in TestVector are\:
**name** | **type** | **desc**
-------- | -------- | -------------------
msg | HexBytes | The message to sign
sig | HexBytes | A signature for msg
Used in [EcdsaP1363TestGroup](#EcdsaP1363TestGroup),
[EddsaTestGroup](#EddsaTestGroup),
[RsassaPkcs1GenTestGroup](#RsassaPkcs1GenTestGroup),
[RsassaPkcs1TestGroup](#RsassaPkcs1TestGroup).
## Test {#Test}
The root type of each JSON file with tests. Each file contains one ore more test
groups. Each test group contains one ore more test vectors. All test vectors in
the same file have the same type and test the same cryptographic primitive.
| **name** | **type** | **desc** | **since** |
| ---------------- | -------- | ------------------- | --------- |
| algorithm | str | The primitive | |
: : : tested in the test : :
: : : file. This is : :
: : : mainly a brief : :
: : : description of the : :
: : : algorithm used. So : :
: : : far there is no : :
: : : formal definition : :
: : : of this field and : :
: : : its description may : :
: : : change. : :
| generatorVersion | str | The version of the | |
: : : test vectors. The : :
: : : version number has : :
: : : the format : :
: : : major.minor (or : :
: : : major.minor[release : :
: : : candidate]). The : :
: : : plan is to change : :
: : : the format of the : :
: : : test vectors in : :
: : : major versions : :
: : : only, once version : :
: : : 1.0 has been : :
: : : reached. : :
: : : Conversely, version : :
: : : 1.0 will be : :
: : : published once we : :
: : : think the format : :
: : : for the test : :
: : : vectors are : :
: : : sufficiently : :
: : : stable. : :
| header | List | additional | |
: : : documentation : :
| notes | JSON | A description of | |
: : : the labels used in : :
: : : the test vectors. : :
: : : Some test vectors : :
: : : contain labels that : :
: : : formally describe : :
: : : the test vector. It : :
: : : can be helpful to : :
: : : make test more : :
: : : precise. For : :
: : : example libraries : :
: : : differ in whether : :
: : : they accept ASN : :
: : : encodings different : :
: : : from DER. Hence : :
: : : many of the test : :
: : : vectors with : :
: : : alternative BER : :
: : : encoding are rated : :
: : : as acceptable. : :
: : : Labels allow to : :
: : : decide whether : :
: : : tests with : :
: : : alternatve BER : :
: : : encoding should be : :
: : : rejected or : :
: : : accepted when : :
: : : testing a : :
: : : particular library. : :
| numberOfTests | int | The number of test | |
: : : vectors in this : :
: : : test. Each test : :
: : : vector has a unique : :
: : : tcId in the range 1 : :
: : : .. tcId. : :
| schema | str | The filename of the | 0.7 |
: : : JSON schema that : :
: : : defines the format : :
: : : of the test vectors : :
: : : in this file. If : :
: : : the format of the : :
: : : test vectors : :
: : : changes then a new : :
: : : schema will be : :
: : : generate, so that : :
: : : comparing the name : :
: : : of the schema with : :
: : : an expected name : :
: : : can be used to : :
: : : check for : :
: : : compatibility : :
: : : between test : :
: : : vectors and test : :
: : : code. : :
| testGroups | List | a list of test | |
: : : groups : :
## TestGroup {#TestGroup}
A test group contains a list of test vectors of the same type. The test group
describes parameters that are common for all the test vectors. Often some
parameters are given in multiple formats to simplify testing. For example,
asymmetric private key are typically given in a raw format, PKCS #8 encoded and
in PEM format. All fields in a test group are corretly formatted. Incorrectly
formatted inputs are always in the test vectors. The list below describes the
fields that are common to all test groups.
Fields additional to the fields in TestGroup are\:
**name** | **type** | **desc**
-------- | -------- | -----------------------------
tests | List | a list of test vectors
type | str | The type of the test vectors.
## TestVector {#TestVector}
| **name** | **type** | **desc** | **enum** |
| -------- | -------- | ------------------------- | -------------------- |
| comment | str | A brief description of | |
: : : the test case : :
| flags | List | A list of flags for a | |
: : : test case. Flags are : :
: : : described in the header : :
: : : of the test file. : :
| result | str | The test result. The | ['valid', 'invalid', |
: : : value determines whether : 'acceptable'] :
: : : the test case is valid, : :
: : : invalid or undefined. The : :
: : : value "acceptable" is : :
: : : typically used for legacy : :
: : : cases, weak parameters : :
: : : (such as key sizes not : :
: : : reaching 112-bit : :
: : : security) or BER encoding : :
: : : that are frequent. : :
: : : Eventually, all test : :
: : : vectors with "result" \: : :
: : : "acceptable" will have : :
: : : flags describing the : :
: : : reason and allowing : :
: : : testers to decide how to : :
: : : treat these test vectors. : :
| tcId | int | A unique identifier of | |
: : : the test case in a test : :
: : : file. The identifiers are : :
: : : continuous integers. The : :
: : : identifiers of test : :
: : : vectors change between : :
: : : versions of the test : :
: : : file. Hence, the triple : :
: : : (filename, version, tcId) : :
: : : uniquely identifies a : :
: : : test vector. : :
## XdhAsnTestGroup {#XdhAsnTestGroup}
Fields additional to the fields in TestGroup are\:
| **name** | **type** | **desc** |
| -------- | ------------------------ | -------------------------------------- |
| curve | str | The name of the curve. If test vectors |
: : : encode the curve as part of the public :
: : : and private key then this field :
: : : describes the curve of the private :
: : : key. Test vectors with such encoding :
: : : can contain distinct curves. Such test :
: : : vectors are of course invalid and an :
: : : attempt to compute a shared secret is :
: : : expected to fail. :
| tests | List of XdhAsnTestVector | a list of test vectors |
## XdhAsnTestVector {#XdhAsnTestVector}
A test vector for a key exchange using XDH. Public and private keys are ASN
encoded.
Fields additional to the fields in TestVector are\:
**name** | **type** | **desc**
-------- | -------- | ----------------------------
public | Asn | X.509 encoded the public key
private | Der | PKCS #8 encoded private key
shared | HexBytes | the shared secret
Used in [XdhAsnTestGroup](#XdhAsnTestGroup).
## XdhJwkTestGroup {#XdhJwkTestGroup}
Fields additional to the fields in TestGroup are\:
| **name** | **type** | **desc** |
| -------- | ------------------------ | -------------------------------------- |
| curve | str | The name of the curve. If test vectors |
: : : encode the curve as part of the public :
: : : and private key then this field :
: : : describes the curve of the private :
: : : key. Test vectors with such encoding :
: : : can contain distinct curves. Such test :
: : : vectors are of course invalid and an :
: : : attempt to compute a shared secret is :
: : : expected to fail. :
| tests | List of XdhJwkTestVector | a list of test vectors |
## XdhJwkTestVector {#XdhJwkTestVector}
A test vector for a key exchange using XDH. XDH is a Diffie-Hellman key exchange
defined in RFC 7748. Both public and private key in this test vector are using
the jwk format.
Fields additional to the fields in TestVector are\:
**name** | **type** | **desc** | **ref**
-------- | -------- | ----------------------------- | --------
public | JSON | the public key in jwk format | RFC 8037
private | JSON | the private key in jwk format | RFC 8037
shared | HexBytes | the shared secret |
Used in [XdhJwkTestGroup](#XdhJwkTestGroup).
## XdhTestGroup {#XdhTestGroup}
Fields additional to the fields in TestGroup are\:
| **name** | **type** | **desc** |
| -------- | --------------------- | ----------------------------------------- |
| curve | str | The name of the curve. If test vectors |
: : : encode the curve as part of the public :
: : : and private key then this field describes :
: : : the curve of the private key. Test :
: : : vectors with such encoding can contain :
: : : distinct curves. Such test vectors are of :
: : : course invalid and an attempt to compute :
: : : a shared secret is expected to fail. :
| tests | List of XdhTestVector | a list of test vectors |
## XdhTestVector {#XdhTestVector}
A test vector for a key exchange using XDH. XDH is a Diffie-Hellman key exchange
defined in RFC 7748. Both public and private key in this test vector are just
raw bytes. That is valid public keys and valid private keys are 32 bytes each
for X25519 and 56 bytes for X448.
Fields additional to the fields in TestVector are\:
**name** | **type** | **desc**
-------- | -------- | -------------------------------
public | HexBytes | the raw bytes of the public key
private | HexBytes | the raw bytes of private key
shared | HexBytes | the shared secret
Used in [XdhTestGroup](#XdhTestGroup).