diff --git a/doc/types.md b/doc/types.md index d8b1991..094632f 100644 --- a/doc/types.md +++ b/doc/types.md @@ -1,4 +1,4 @@ - + # Test vector types @@ -8,22 +8,28 @@ Version\: 0.7 A test group for authenticated encryption with additional data. -Fields additional to the fields in TestGroup are\: +Fields in AeadTestGroup 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 | +| **name** | **type** | **desc** | **enum** | +| -------- | ---------------------- | --------------------------- | ---------- | +| 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. : : +| type | str | the type of the test | 'AeadTest' | +| tests | List of AeadTestVector | a list of test vectors | | ## AeadTestVector {#AeadTestVector} @@ -72,12 +78,13 @@ Used in [DsaTestGroup](#DsaTestGroup), [EcdsaTestGroup](#EcdsaTestGroup). ## DaeadTestGroup {#DaeadTestGroup} -Fields additional to the fields in TestGroup are\: +Fields in DaeadTestGroup are\: -**name** | **type** | **desc** --------- | ----------------------- | ---------------------- -keySize | int | the keySize in bits -tests | List of DaeadTestVector | a list of test vectors +**name** | **type** | **desc** | **enum** +-------- | ----------------------- | ---------------------- | ----------- +keySize | int | the keySize in bits | +type | str | the type of the test | 'DaeadTest' +tests | List of DaeadTestVector | a list of test vectors | ## DaeadTestVector {#DaeadTestVector} @@ -101,55 +108,59 @@ 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 | | +| **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 | | +| **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\: +Fields in DsaTestGroup 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 +| **name** | **type** | **desc** | **enum** | +| -------- | ---------------------- | -------------------------- | ----------- | +| 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 : : +| type | str | the type of the test | 'DsaVerify' | +| tests | List of | a list of test vectors | | +: : AsnSignatureTestVector : : : ## EcPointTestGroup {#EcPointTestGroup} -Fields additional to the fields in TestGroup are\: +Fields in EcPointTestGroup 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 : : +| **name** | **type** | **desc** | **enum** | +| -------- | ----------------- | -------------------- | -------------- | +| curve | str | the name of the | | +: : : elliptic curve : : +| encoding | str | the encoding used | 'compressed', | +: : : : 'uncompressed' : +| type | str | the type of the test | 'EcPointTest' | +| tests | List of | a list of test | | +: : EcPointTestVector : vectors : : ## EcPointTestVector {#EcPointTestVector} @@ -165,25 +176,49 @@ Used in [EcPointTestGroup](#EcPointTestGroup). ## EcPublicKey {#EcPublicKey} +An EC public key. The EC public key can specify the underlying curve parameters +in two ways. (1) as a named curve (2) as a structure containing the curve +parameters generator, order and cofactor. + **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'] +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 | +## EcPublicKeyOnNamedCurve {#EcPublicKeyOnNamedCurve} + +An EC public key. This data type allows only named curves to specify the +underlying EC parameters. + +| **name** | **type** | **desc** | **enum** | +| ------------ | ------------ | ------------------------------ | ------------- | +| curve | 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\: +Fields in EcPublicKeyTestGroup 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 : : +| **name** | **type** | **desc** | **enum** | +| -------- | --------------------- | ------------------- | ------------------- | +| encoding | str | the encoding of the | 'asn', 'pem', | +: : : encoded keys : 'webcrypto' : +| type | str | the type of the | 'EcPublicKeyVerify' | +: : : test : : +| tests | List of | a list of test | | +: : EcPublicKeyTestVector : vectors : : ## EcPublicKeyTestVector {#EcPublicKeyTestVector} @@ -193,21 +228,18 @@ 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 | +**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 | int | [optional] the cofactor +wx | BigInt | x-coordinate of the public point +wy | BigInt | y-coordinate of the public point Used in [EcPublicKeyTestGroup](#EcPublicKeyTestGroup). @@ -215,112 +247,129 @@ Used in [EcPublicKeyTestGroup](#EcPublicKeyTestGroup). 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 : : +| **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\: +Fields in EcdhEcpointTestGroup are\: -**name** | **type** | **desc** --------- | ----------------------------- | ----------------------------- -tests | List of EcdhEcpointTestVector | a list of test vectors -type | str | The type of the test vectors. +| **name** | **type** | **desc** | **enum** | +| -------- | --------------------- | -------------------- | ----------------- | +| curve | str | the curve of the | | +: : : private key : : +| encoding | str | the encoding of the | 'ecpoint' | +: : : public key : : +| type | str | the type of the test | 'EcdhEcpointTest' | +| tests | List of | a list of test | | +: : EcdhEcpointTestVector : 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 +| **name** | **type** | **desc** | **format** | **ref** | +| -------- | -------- | ------------------ | ------------ | -------------- | +| public | Asn | ASN encoded public | OCTET STRING | X9.62, Section | +: : : point : : 4.3.6 : +| private | BigInt | The private | | | +: : : exponent : : : +| shared | HexBytes | The shared secret | | | +: : : key : : : Used in [EcdhEcpointTestGroup](#EcdhEcpointTestGroup). ## EcdhPemTestGroup {#EcdhPemTestGroup} -Fields additional to the fields in TestGroup are\: +Fields in EcdhPemTestGroup are\: -**name** | **type** | **desc** --------- | ------------------------- | ----------------------------- -tests | List of EcdhPemTestVector | a list of test vectors -type | str | The type of the test vectors. +| **name** | **type** | **desc** | **enum** | +| -------- | ----------------- | ---------------------------- | ------------- | +| curve | str | the curve of the private key | | +| encoding | str | the encoding of the public | 'pem' | +: : : key : : +| type | str | the type of the test | 'EcdhPemTest' | +| tests | List of | a list of test vectors | | +: : EcdhPemTestVector : : : ## 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\: +Fields in EcdhTestGroup are\: -**name** | **type** | **desc** --------- | ---------------------- | ----------------------------- -tests | List of EcdhTestVector | a list of test vectors -type | str | The type of the test vectors. +**name** | **type** | **desc** | **enum** +-------- | ---------------------- | ------------------------------ | ---------- +curve | str | the curve of the private key | +encoding | str | the encoding of the public key | 'asn' +type | str | the type of the test | 'EcdhTest' +tests | List of EcdhTestVector | a list of 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 | +| **name** | **type** | **desc** | +| -------- | -------- | ------------------------------------------------------ | +| public | Asn | X509 encoded public key. The encoding of the public | +: : : key contains the type of the public key, the curve and : +: : : possibly the curve parameters. The test vectors : +: : : contain cases where these fields do not match the : +: : : curve in the testGroup. : +| 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. : Used in [EcdhTestGroup](#EcdhTestGroup). ## EcdhWebcryptoTestGroup {#EcdhWebcryptoTestGroup} -Fields additional to the fields in TestGroup are\: +Fields in EcdhWebcryptoTestGroup are\: -**name** | **type** | **desc** --------- | ------------------------------- | ----------------------------- -tests | List of EcdhWebcryptoTestVector | a list of test vectors -type | str | The type of the test vectors. +| **name** | **type** | **desc** | **enum** | +| -------- | ----------------------- | ---------------- | ------------------- | +| curve | str | the curve of the | | +: : : private key : : +| encoding | str | the encoding of | 'webcrypto' | +: : : the public key : : +| type | str | the type of the | 'EcdhWebcryptoTest' | +: : : test : : +| tests | List of | a list of test | | +: : EcdhWebcryptoTestVector : 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). @@ -332,17 +381,22 @@ 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\: +Fields in EcdsaP1363TestGroup 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 | +| **name** | **type** | **desc** | **enum** | +| -------- | ------------------- | ---------------------- | ------------------ | +| 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 : : +| type | str | the type of the test | 'EcdsaP1363Verify' | +| tests | List of | a list of test vectors | | +: : SignatureTestVector : : : ## EcdsaTestGroup {#EcdsaTestGroup} @@ -351,46 +405,44 @@ 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\: +Fields in EcdsaTestGroup 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 +| **name** | **type** | **desc** | **enum** | +| -------- | ---------------------- | ----------------------- | ------------- | +| 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 : : +| type | str | the type of the test | 'EcdsaVerify' | +| tests | List of | a list of test vectors | | +: : AsnSignatureTestVector : : : ## EddsaTestGroup {#EddsaTestGroup} -Fields additional to the fields in TestGroup are\: +Fields in EddsaTestGroup 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 : : : +**name** | **type** | **desc** | **since** | **ref** | **enum** +-------- | --------------------------- | ----------------------------------- | --------- | ------------------ | -------- +jwk | Json | the private key in webcrypto format | 0.7 | RFC 8037 Section 2 | +key | Json | unencoded key pair | | | +keyDer | Asn | Asn encoded public key | | | +keyPem | Pem | Pem encoded public key | | | +type | str | the type of the test | | | 'EddsaVerify' +tests | List of SignatureTestVector | a list of test 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\: +Fields in HkdfTestGroup are\: -**name** | **type** | **desc** --------- | ---------------------- | --------------------------- -keySize | int | the size of the ikm in bits -tests | List of HkdfTestVector | a list of test vectors +**name** | **type** | **desc** | **enum** +-------- | ---------------------- | --------------------------- | ---------- +keySize | int | the size of the ikm in bits | +type | str | the type of the test | 'HkdfTest' +tests | List of HkdfTestVector | a list of test vectors | ## HkdfTestVector {#HkdfTestVector} @@ -411,14 +463,17 @@ Used in [HkdfTestGroup](#HkdfTestGroup). ## IndCpaTestGroup {#IndCpaTestGroup} -Fields additional to the fields in TestGroup are\: +Fields in IndCpaTestGroup 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 +| **name** | **type** | **desc** | **enum** | +| -------- | ---------------- | ------------------------------- | ------------ | +| ivSize | int | the IV size in bits | | +| keySize | int | the keySize in bits | | +| tagSize | int | the expected size of the tag in | | +: : : bits : : +| type | str | the type of the test | 'IndCpaTest' | +| tests | List of | a list of test vectors | | +: : IndCpaTestVector : : : ## IndCpaTestVector {#IndCpaTestVector} @@ -440,12 +495,13 @@ Used in [IndCpaTestGroup](#IndCpaTestGroup). ## KeywrapTestGroup {#KeywrapTestGroup} -Fields additional to the fields in TestGroup are\: +Fields in KeywrapTestGroup are\: -**name** | **type** | **desc** --------- | ------------------------- | ---------------------- -keySize | int | the keySize in bits -tests | List of KeywrapTestVector | a list of test vectors +**name** | **type** | **desc** | **enum** +-------- | ------------------------- | ---------------------- | ------------- +keySize | int | the keySize in bits | +type | str | the type of the test | 'KeywrapTest' +tests | List of KeywrapTestVector | a list of test vectors | ## KeywrapTestVector {#KeywrapTestVector} @@ -467,13 +523,15 @@ Used in [KeywrapTestGroup](#KeywrapTestGroup). ## MacTestGroup {#MacTestGroup} -Fields additional to the fields in TestGroup are\: +Fields in MacTestGroup 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 +| **name** | **type** | **desc** | **enum** | +| -------- | --------------------- | ---------------------------- | --------- | +| keySize | int | the keySize in bits | | +| tagSize | int | the expected size of the tag | | +: : : in bits : : +| type | str | the type of the test | 'MacTest' | +| tests | List of MacTestVector | a list of test vectors | | ## MacTestVector {#MacTestVector} @@ -491,19 +549,20 @@ Used in [MacTestGroup](#MacTestGroup). ## RsaKeyTestGroup {#RsaKeyTestGroup} -Fields additional to the fields in TestGroup are\: +Fields in RsaKeyTestGroup 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 : : : +| **name** | **type** | **desc** | **enum** | +| -------- | ---------------- | ------------------------------- | ------------ | +| encoding | str | The encoding of the public key | 'asn', 'pem' | +: : : 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 | | +| type | str | the type of the test | 'RsaKeyTest' | +| tests | List of | a list of test vectors | | +: : RsaKeyTestVector : : : ## RsaKeyTestVector {#RsaKeyTestVector} @@ -517,23 +576,37 @@ Used in [RsaKeyTestGroup](#RsaKeyTestGroup). ## RsaesOaepTestGroup {#RsaesOaepTestGroup} -Fields additional to the fields in TestGroup are\: +Fields in RsaesOaepTestGroup 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 | +| **name** | **type** | **desc** | **enum** | +| --------------- | ------------------- | --------------- | ------------------ | +| 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. : : +| type | str | the type of the | 'RsaesOaepDecrypt' | +: : : test : : +| tests | List of | a list of test | | +: : RsaesOaepTestVector : vectors : : ## RsaesOaepTestVector {#RsaesOaepTestVector} @@ -549,90 +622,69 @@ Used in [RsaesOaepTestGroup](#RsaesOaepTestGroup). ## RsassaPkcs1GenTestGroup {#RsassaPkcs1GenTestGroup} -Fields additional to the fields in TestGroup are\: +Fields in RsassaPkcs1GenTestGroup 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 : : : +**name** | **type** | **desc** | **ref** | **since** | **enum** +------------- | --------------------------- | -------------------------------------- | -------- | --------- | -------- +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] Private key in JWK format | RFC 7517 | 0.7 | +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] Private key in JWK format | RFC 7517 | 0.7 | +privateKeyPem | Pem | Pem encoded private key | | | +sha | str | the hash function used for the message | | | +type | str | the type of the test | | | 'RsassaPkcs1Generate' +tests | List of SignatureTestVector | a list of test vectors | | | ## RsassaPkcs1TestGroup {#RsassaPkcs1TestGroup} -Fields additional to the fields in TestGroup are\: +Fields in RsassaPkcs1TestGroup 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 : : : +**name** | **type** | **desc** | **ref** | **since** | **enum** +-------- | --------------------------- | -------------------------------------------------------------------------------------------------------------- | -------- | --------- | -------- +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 JWK format. The key is missing if the signature algorithm for the given hash is not defined. | RFC 7517 | 0.7 | +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 | | | +type | str | the type of the test | | | 'RsassaPkcs1Verify' +tests | List of SignatureTestVector | a list of test vectors | | | ## RsassaPssTestGroup {#RsassaPssTestGroup} -Fields additional to the fields in TestGroup are\: +Fields in RsassaPssTestGroup 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 | +| **name** | **type** | **desc** | **enum** | +| -------- | ------------------- | ----------------------- | ----------------- | +| 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. : : +| type | str | the type of the test | 'RsassaPssVerify' | +| tests | List of | a list of test vectors | | +: : RsassaPssTestVector : : : ## RsassaPssTestVector {#RsassaPssTestVector} @@ -659,8 +711,8 @@ Fields additional to the fields in TestVector are\: msg | HexBytes | The message to sign sig | HexBytes | A signature for msg -Used in [EcdsaP1363TestGroup](#EcdsaP1363TestGroup), -[EddsaTestGroup](#EddsaTestGroup), +Used in +[EcdsaP1363TestGroup](#EcdsaP1363TestGroup), [EddsaTestGroup](#EddsaTestGroup), [RsassaPkcs1GenTestGroup](#RsassaPkcs1GenTestGroup), [RsassaPkcs1TestGroup](#RsassaPkcs1TestGroup). @@ -774,69 +826,73 @@ 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\: +Fields in TestGroup are\: **name** | **type** | **desc** --------- | -------- | ----------------------------- +-------- | -------- | ---------------------- tests | List | a list of test vectors -type | str | The type of the test vectors. +type | str | the type of the test ## 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. : : +| **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\: +Fields in XdhAsnTestGroup 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 | +| **name** | **type** | **desc** | **enum** | +| -------- | ---------------- | ------------------------------- | ------------ | +| 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. : : +| type | str | the type of the test | 'XdhAsnComp' | +| tests | List of | a list of test vectors | | +: : XdhAsnTestVector : : : ## XdhAsnTestVector {#XdhAsnTestVector} @@ -855,20 +911,24 @@ Used in [XdhAsnTestGroup](#XdhAsnTestGroup). ## XdhJwkTestGroup {#XdhJwkTestGroup} -Fields additional to the fields in TestGroup are\: +Fields in XdhJwkTestGroup 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 | +| **name** | **type** | **desc** | **enum** | +| -------- | ---------------- | ------------------------------- | ------------ | +| 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. : : +| type | str | the type of the test | 'XdhJwkComp' | +| tests | List of | a list of test vectors | | +: : XdhJwkTestVector : : : ## XdhJwkTestVector {#XdhJwkTestVector} @@ -888,19 +948,24 @@ Used in [XdhJwkTestGroup](#XdhJwkTestGroup). ## XdhTestGroup {#XdhTestGroup} -Fields additional to the fields in TestGroup are\: +Fields in XdhTestGroup 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 | +| **name** | **type** | **desc** | **enum** | +| -------- | --------------------- | ----------------------------- | --------- | +| 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. : : +| type | str | the type of the test | 'XdhComp' | +| tests | List of XdhTestVector | a list of test vectors | | ## XdhTestVector {#XdhTestVector}