├── clippy.toml ├── .gitignore ├── src ├── ec_curve.rs ├── xdh.rs ├── cipher.rs ├── hkdf.rs ├── primality.rs ├── eddsa.rs ├── mac_with_nonce.rs ├── mldsa_verify.rs ├── rsa_pkcs1_decrypt.rs ├── keywrap.rs ├── mldsa_sign.rs ├── fpe_str.rs ├── fpe_list.rs ├── dsa.rs ├── mac.rs ├── ecdh.rs ├── rsa_pkcs1_verify.rs ├── rsa_oaep.rs ├── aead.rs ├── rsa_pss_verify.rs ├── test_keys.rs ├── ecdsa.rs ├── data │ ├── seed_wrap_test.json │ ├── siphash_1_3_test.json │ ├── siphash_2_4_test.json │ ├── siphash_4_8_test.json │ ├── siphashx_2_4_test.json │ ├── siphashx_4_8_test.json │ └── ec_prime_order_curves_test.json └── lib.rs ├── Cargo.toml ├── .github └── workflows │ └── ci.yml ├── NEWS.md ├── README.md ├── tests └── tests.rs └── LICENSE /clippy.toml: -------------------------------------------------------------------------------- 1 | msrv = "1.57.0" 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | Cargo.lock 3 | -------------------------------------------------------------------------------- /src/ec_curve.rs: -------------------------------------------------------------------------------- 1 | //! Elliptic Curve Information 2 | 3 | use super::*; 4 | 5 | define_test_set!("EC Curve", "ec_curve_test_schema.json"); 6 | 7 | define_test_set_names!( 8 | EcCurveInfo => "ec_prime_order_curves" 9 | ); 10 | 11 | define_test_flags!(); 12 | 13 | define_test_group_type_id!( 14 | "EcCurveTest" => EcCurve, 15 | ); 16 | 17 | define_algorithm_map!( 18 | "EcCurveTest" => EcCurve 19 | ); 20 | 21 | define_test_group!(); 22 | 23 | define_test!( 24 | name: String, 25 | oid: String, 26 | "ref" => reference: String, 27 | p: LargeInteger, 28 | n: LargeInteger, 29 | a: LargeInteger, 30 | b: LargeInteger, 31 | gx: LargeInteger, 32 | gy: LargeInteger, 33 | h: usize, 34 | ); 35 | -------------------------------------------------------------------------------- /src/xdh.rs: -------------------------------------------------------------------------------- 1 | //! Montgomery curve ECDH tests 2 | 3 | use super::*; 4 | 5 | define_test_set!("xDH", "xdh_comp_schema.json"); 6 | 7 | define_test_set_names!( 8 | X25519 => "x25519", 9 | X448 => "x448", 10 | ); 11 | 12 | define_algorithm_map!("XDH" => Xdh); 13 | 14 | define_test_flags!( 15 | EdgeCaseMultiplication, 16 | EdgeCasePrivateKey, 17 | EdgeCaseShared, 18 | "Ktv" => KnownTestVector, 19 | LowOrderPublic, 20 | NonCanonicalPublic, 21 | Normal, 22 | PublicKeyTooLong, 23 | SmallPublicKey, 24 | SpecialPublicKey, 25 | Twist, 26 | ZeroSharedSecret, 27 | ); 28 | 29 | define_test_group_type_id!( 30 | "XdhComp" => KeyAgreement, 31 | ); 32 | 33 | define_test_group!(curve: MontgomeryCurve); 34 | 35 | define_test!( 36 | "public" => public_key: ByteString, 37 | "private" => private_key: ByteString, 38 | "shared" => shared_secret: ByteString, 39 | ); 40 | -------------------------------------------------------------------------------- /src/cipher.rs: -------------------------------------------------------------------------------- 1 | //! IND-CPA cipher tests 2 | 3 | use super::*; 4 | 5 | define_test_set!("Cipher", "ind_cpa_test_schema.json"); 6 | 7 | define_test_set_names!( 8 | AesCbcPkcs5 => "aes_cbc_pkcs5", 9 | AesXts => "aes_xts", 10 | AriaCbcPkcs5 => "aria_cbc_pkcs5", 11 | CamelliaCbcPkcs5 => "camellia_cbc_pkcs5", 12 | ); 13 | 14 | define_algorithm_map!( 15 | "AES-CBC-PKCS5" => AesCbcPkcs5, 16 | "AES-XTS" => AesXts, 17 | "ARIA-CBC-PKCS5" => AriaCbcPkcs5, 18 | "CAMELLIA-CBC-PKCS5" => CamelliaCbcPkcs5, 19 | ); 20 | 21 | define_test_flags!(BadPadding, NoPadding, Pseudorandom); 22 | 23 | define_test_group_type_id!( 24 | "IndCpaTest" => Cipher, 25 | ); 26 | 27 | define_test_group!( 28 | "ivSize" => nonce_size: usize, 29 | "keySize" => key_size: usize, 30 | ); 31 | 32 | define_test!( 33 | "iv" => nonce: ByteString, 34 | key: ByteString, 35 | "msg" => pt: ByteString, 36 | ct: ByteString, 37 | ); 38 | -------------------------------------------------------------------------------- /src/hkdf.rs: -------------------------------------------------------------------------------- 1 | //! HKDF tests 2 | 3 | use super::*; 4 | 5 | define_test_set!("HKDF", "hkdf_test_schema.json"); 6 | 7 | define_test_set_names!( 8 | HkdfSha1 => "hkdf_sha1", 9 | HkdfSha256 => "hkdf_sha256", 10 | HkdfSha384 => "hkdf_sha384", 11 | HkdfSha512 => "hkdf_sha512", 12 | ); 13 | 14 | define_algorithm_map!( 15 | "HKDF-SHA-1" => HkdfSha1, 16 | "HKDF-SHA-256" => HkdfSha256, 17 | "HKDF-SHA-384" => HkdfSha384, 18 | "HKDF-SHA-512" => HkdfSha512, 19 | ); 20 | 21 | define_test_flags!( 22 | EmptySalt, 23 | MaximalOutputSize, 24 | Normal, 25 | OutputCollision, 26 | SizeTooLarge, 27 | ); 28 | 29 | define_test_group_type_id!( 30 | "HkdfTest" => KDF, 31 | ); 32 | 33 | define_test_group!( 34 | "keySize" => key_size: usize, 35 | ); 36 | 37 | define_test!( 38 | ikm: ByteString, 39 | salt: ByteString, 40 | info: ByteString, 41 | size: usize, 42 | okm: ByteString, 43 | ); 44 | -------------------------------------------------------------------------------- /src/primality.rs: -------------------------------------------------------------------------------- 1 | //! Primality checking tests 2 | 3 | use super::*; 4 | 5 | define_test_set!("Primality", "primality_test_schema.json"); 6 | 7 | define_test_set_names!( 8 | Primality => "primality" 9 | ); 10 | 11 | define_algorithm_map!("PrimalityTest" => Primality); 12 | 13 | define_test_flags!( 14 | AndDub00, 15 | Arnault96, 16 | Bleichen05, 17 | BoundDeterministic, 18 | CarmichaelNumber, 19 | FermatTest, 20 | FixedMillerRabinBasis, 21 | GaMaPa19, 22 | Howe98, 23 | Jaeschke93, 24 | Mueller, 25 | NegativeOfPrime, 26 | Pinch06, 27 | Pinch93, 28 | Prime, 29 | SmallInteger, 30 | SmallNumberOfMillerRabinTests, 31 | SorWeb15, 32 | Stephan20, 33 | ); 34 | 35 | define_test_group_type_id!( 36 | "PrimalityTest" => PrimalityTest, 37 | ); 38 | 39 | define_test_group!(); 40 | 41 | // Not a LargeInteger because actually 2s-complement 42 | define_test!(value: ByteString); 43 | -------------------------------------------------------------------------------- /src/eddsa.rs: -------------------------------------------------------------------------------- 1 | //! EdDSA verification tests 2 | 3 | use super::*; 4 | 5 | define_test_set!("EdDSA verify", "eddsa_verify_schema.json"); 6 | 7 | define_test_set_names!( 8 | Ed25519 => "ed25519", 9 | Ed448 => "ed448", 10 | ); 11 | 12 | define_algorithm_map!("EDDSA" => EdDsa); 13 | 14 | define_test_flags!( 15 | CompressedSignature, 16 | InvalidEncoding, 17 | InvalidSignature, 18 | "Ktv" => KnownTestVector, 19 | "InvalidKtv" => InvalidKnownTestVector, 20 | SignatureMalleability, 21 | SignatureWithGarbage, 22 | TinkOverflow, 23 | TruncatedSignature, 24 | Valid, 25 | ); 26 | 27 | define_test_group_type_id!( 28 | "EddsaVerify" => Eddsa, 29 | ); 30 | 31 | define_test_group!( 32 | "publicKeyJwk" => jwk: EddsaPublicJwk, 33 | "publicKey" => key: EddsaPublic, 34 | "publicKeyDer" => der: ByteString, 35 | "publicKeyPem" => pem: String, 36 | ); 37 | 38 | define_test!(msg: ByteString, sig: ByteString); 39 | -------------------------------------------------------------------------------- /src/mac_with_nonce.rs: -------------------------------------------------------------------------------- 1 | //! Message Authentication Code tests 2 | 3 | use super::*; 4 | 5 | define_test_set!("MAC with IV", "mac_with_iv_test_schema.json"); 6 | 7 | define_test_set_names!( 8 | Gmac => "aes_gmac", 9 | Vmac64 => "vmac_64", 10 | Vmac128 => "vmac_128", 11 | ); 12 | 13 | define_algorithm_map!( 14 | "AES-GMAC" => AesGmac, 15 | "VMAC-AES" => VmacAes, 16 | ); 17 | 18 | define_test_group_type_id!( 19 | "MacWithIvTest" => MacWithIv, 20 | ); 21 | 22 | define_test_flags!( 23 | EdgeCase, 24 | InvalidNonce, 25 | "Ktv" => KnownTestVector, 26 | ModifiedTag, 27 | Pseudorandom, 28 | SpecialCaseTag, 29 | TagCollision, 30 | ); 31 | 32 | define_test_group!( 33 | "keySize" => key_size: usize, 34 | "tagSize" => tag_size: usize, 35 | "ivSize" => nonce_size: usize, 36 | ); 37 | 38 | define_test!( 39 | key: ByteString, 40 | "iv" => nonce: ByteString, 41 | msg: ByteString, 42 | tag: ByteString, 43 | ); 44 | -------------------------------------------------------------------------------- /src/mldsa_verify.rs: -------------------------------------------------------------------------------- 1 | //! MLDSA-Verify tests 2 | 3 | use super::*; 4 | 5 | define_test_set!("MLDSA Verify", "mldsa_verify_schema.json"); 6 | 7 | define_test_set_names!( 8 | MlDsa44Verify => "mldsa_44_verify", 9 | MlDsa65Verify => "mldsa_65_verify", 10 | MlDsa87Verify => "mldsa_87_verify", 11 | ); 12 | 13 | define_algorithm_map!( 14 | "ML-DSA-44" => MlDsa44, 15 | "ML-DSA-65" => MlDsa65, 16 | "ML-DSA-87" => MlDsa87, 17 | ); 18 | 19 | define_test_flags!( 20 | BoundaryCondition, 21 | IncorrectPublicKeyLength, 22 | IncorrectSignatureLength, 23 | InvalidHintsEncoding, 24 | InvalidPrivateKey, 25 | InvalidContext, 26 | ManySteps, 27 | ModifiedSignature, 28 | ValidSignature, 29 | ZeroPublicKey, 30 | ); 31 | 32 | define_test_group_type_id!( 33 | "MlDsaVerify" => MlDsaVerify, 34 | ); 35 | 36 | define_test_group!( 37 | "publicKey" => pubkey: ByteString, 38 | ); 39 | 40 | define_test!(msg: ByteString, sig: ByteString, ctx: Option); 41 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "wycheproof" 3 | version = "0.6.0" 4 | edition = "2021" 5 | authors = ["Jack Lloyd "] 6 | license = "Apache-2.0" 7 | description = "Wycheproof test vectors" 8 | repository = "https://github.com/randombit/wycheproof-rs" 9 | documentation = "https://docs.rs/wycheproof" 10 | categories = [ "cryptography" ] 11 | rust-version = "1.57" 12 | 13 | [features] 14 | # By default all tests are included 15 | default = ["aead", "cipher", "dsa", "ec", "ecdh", "ecdsa", "eddsa", "fpe", "hkdf", "keywrap", "mac", "primality", "rsa_enc", "rsa_sig", "xdh", "mldsa_sign", "mldsa_verify"] 16 | 17 | aead = [] 18 | cipher = [] 19 | dsa = [] 20 | ec = [] 21 | ecdh = [] 22 | ecdsa = [] 23 | eddsa = [] 24 | fpe = [] 25 | hkdf = [] 26 | keywrap = [] 27 | mac = [] 28 | primality = [] 29 | rsa_enc = [] 30 | rsa_sig = [] 31 | xdh = [] 32 | mldsa_sign = [] 33 | mldsa_verify = [] 34 | 35 | [dependencies] 36 | serde = { version = "1" } 37 | serde_derive = { version = "1" } 38 | serde_json = "1" 39 | data-encoding = "2" 40 | 41 | num-bigint = { version = "0.4", optional = true } 42 | -------------------------------------------------------------------------------- /src/rsa_pkcs1_decrypt.rs: -------------------------------------------------------------------------------- 1 | //! RSA PKCS1v1.5 decryption tests 2 | 3 | use super::*; 4 | 5 | define_test_set!("RSA PKCS1 decrypt", "rsaes_pkcs1_decrypt_schema.json"); 6 | 7 | define_algorithm_map!("RSAES-PKCS1-v1_5" => RsaPkcs1v15Encryption); 8 | 9 | define_test_set_names!( 10 | Rsa2048 => "rsa_pkcs1_2048", 11 | Rsa3072 => "rsa_pkcs1_3072", 12 | Rsa4096 => "rsa_pkcs1_4096" 13 | ); 14 | 15 | define_test_flags!( 16 | "CVE 2020-14967" => LeadingZerosOnCiphertext, 17 | "CVE 2021-3580" => CiphertextTooLarge, 18 | InvalidCiphertextFormat, 19 | InvalidPkcs1Padding, 20 | Normal, 21 | SpecialCase, 22 | SpecialCasePadding, 23 | Sslv23Padding, 24 | ); 25 | 26 | define_test_group_type_id!( 27 | "RsaesPkcs1Decrypt" => RsaPkcs1Decrypt, 28 | ); 29 | 30 | define_test_group!( 31 | "privateKey" => key: RsaPrivate, 32 | "keySize" => key_size: usize, 33 | "privateKeyJwk" => jwk: Option, 34 | "privateKeyPkcs8" => pkcs8: ByteString, 35 | "privateKeyPem" => pem: String, 36 | ); 37 | 38 | define_test!("msg" => pt: ByteString, ct: ByteString); 39 | -------------------------------------------------------------------------------- /src/keywrap.rs: -------------------------------------------------------------------------------- 1 | //! NIST keywrapping tests 2 | 3 | use super::*; 4 | 5 | define_test_set!("Keywrap", "keywrap_test_schema.json"); 6 | 7 | define_test_set_names!( 8 | AesKeyWrap => "aes_wrap", 9 | AesKeyWrapWithPadding => "aes_kwp", 10 | AriaKeyWrap => "aria_wrap", 11 | AriaKeyWrapWithPadding => "aria_kwp", 12 | CamelliaKeyWrap => "camellia_wrap", 13 | SeedKeyWrap => "seed_wrap", 14 | ); 15 | 16 | define_algorithm_map!( 17 | "AES-KWP" => AesKeyWrapWithPadding, 18 | "AES-WRAP" => AesKeyWrap, 19 | "ARIA-KWP" => AriaKeyWrapWithPadding, 20 | "ARIA-WRAP" => AriaKeyWrap, 21 | "CAMELLIA-WRAP" => CamelliaKeyWrap, 22 | "SEED-WRAP" => SeedKeyWrap, 23 | ); 24 | 25 | define_test_flags!( 26 | CounterOverflow, 27 | EmptyKey, 28 | InvalidWrappingSize, 29 | ModifiedIv, 30 | ModifiedPadding, 31 | Normal, 32 | ShortKey, 33 | SmallKey, 34 | WrongDataSize, 35 | ); 36 | 37 | define_test_group_type_id!( 38 | "KeywrapTest" => Keywrap 39 | ); 40 | 41 | define_test_group!( 42 | "keySize" => key_size: usize, 43 | ); 44 | 45 | define_test!( 46 | key: ByteString, 47 | "msg" => pt: ByteString, 48 | ct: ByteString 49 | ); 50 | -------------------------------------------------------------------------------- /src/mldsa_sign.rs: -------------------------------------------------------------------------------- 1 | //! MLDSA-Sign tests 2 | 3 | use super::*; 4 | 5 | define_test_set!( 6 | "MLDSA Sign", 7 | "mldsa_sign_noseed_schema.json", 8 | "mldsa_sign_seed_schema.json" 9 | ); 10 | 11 | define_test_set_names!( 12 | MlDsa44SignNoSeed => "mldsa_44_sign_noseed", 13 | MlDsa44SignSeed => "mldsa_44_sign_seed", 14 | MlDsa65SignNoSeed => "mldsa_65_sign_noseed", 15 | MlDsa65SignSeed => "mldsa_65_sign_seed", 16 | MlDsa87SignNoSeed => "mldsa_87_sign_noseed", 17 | MlDsa87SignSeed => "mldsa_87_sign_seed", 18 | ); 19 | 20 | define_algorithm_map!( 21 | "ML-DSA-44" => MlDsa44, 22 | "ML-DSA-65" => MlDsa65, 23 | "ML-DSA-87" => MlDsa87, 24 | ); 25 | 26 | define_test_flags!( 27 | BoundaryCondition, 28 | IncorrectPrivateKeyLength, 29 | InvalidPrivateKey, 30 | InvalidContext, 31 | ManySteps, 32 | ValidSignature, 33 | ); 34 | 35 | define_test_group_type_id!( 36 | "MlDsaSign" => MlDsaSign, 37 | ); 38 | 39 | define_test_group!( 40 | "privateKey" => privkey: Option, 41 | "privateSeed" => privseed: Option, 42 | "source" => source: Source, 43 | ); 44 | 45 | define_test!(msg: ByteString, sig: ByteString, ctx: Option); 46 | -------------------------------------------------------------------------------- /src/fpe_str.rs: -------------------------------------------------------------------------------- 1 | //! Format Preseverving Encryption 2 | 3 | use super::*; 4 | 5 | define_test_set!("FPE_str", "fpe_str_test_schema.json"); 6 | 7 | define_test_set_names!( 8 | AesFf1Base10 => "aes_ff1_base10", 9 | AesFf1Base16 => "aes_ff1_base16", 10 | AesFf1Base26 => "aes_ff1_base26", 11 | AesFf1Base32 => "aes_ff1_base32", 12 | AesFf1Base36 => "aes_ff1_base36", 13 | AesFf1Base45 => "aes_ff1_base45", 14 | AesFf1Base62 => "aes_ff1_base62", 15 | AesFf1Base64 => "aes_ff1_base64", 16 | AesFf1Base85 => "aes_ff1_base85", 17 | ); 18 | 19 | define_algorithm_map!( 20 | "AES-FF1" => AesFf1 21 | ); 22 | 23 | define_test_flags!( 24 | EdgeCasePrf, 25 | EdgeCaseState, 26 | InvalidKeySize, 27 | InvalidMessageSize, 28 | InvalidPlaintext, 29 | LargeMessageSize, 30 | NormalMessageSize, 31 | SmallMessageSize, 32 | ); 33 | 34 | define_test_group_type_id!( 35 | "FpeStrTest" => FpeStrTest, 36 | ); 37 | 38 | define_test_group!( 39 | alphabet: String, 40 | "keySize" => key_size: usize, 41 | "msgSize" => msg_size: usize, 42 | radix: usize, 43 | ); 44 | 45 | define_test!( 46 | key: ByteString, 47 | tweak: ByteString, 48 | "msg" => pt: String, 49 | ct: String 50 | ); 51 | -------------------------------------------------------------------------------- /src/fpe_list.rs: -------------------------------------------------------------------------------- 1 | //! Format Preseverving Encryption 2 | 3 | use super::*; 4 | 5 | define_test_set!("FPE_list", "fpe_list_test_schema.json"); 6 | 7 | define_test_set_names!( 8 | AesFf1Radix10 => "aes_ff1_radix10", 9 | AesFf1Radix16 => "aes_ff1_radix16", 10 | AesFf1Radix255 => "aes_ff1_radix255", 11 | AesFf1Radix256 => "aes_ff1_radix256", 12 | AesFf1Radix26 => "aes_ff1_radix26", 13 | AesFf1Radix32 => "aes_ff1_radix32", 14 | AesFf1Radix36 => "aes_ff1_radix36", 15 | AesFf1Radix45 => "aes_ff1_radix45", 16 | AesFf1Radix62 => "aes_ff1_radix62", 17 | AesFf1Radix64 => "aes_ff1_radix64", 18 | AesFf1Radix65535 => "aes_ff1_radix65535", 19 | AesFf1Radix65536 => "aes_ff1_radix65536", 20 | AesFf1Radix85 => "aes_ff1_radix85", 21 | ); 22 | 23 | define_algorithm_map!( 24 | "AES-FF1" => AesFf1 25 | ); 26 | 27 | define_test_flags!( 28 | EdgeCasePrf, 29 | EdgeCaseState, 30 | InvalidKeySize, 31 | InvalidMessageSize, 32 | InvalidPlaintext, 33 | LargeMessageSize, 34 | NormalMessageSize, 35 | SmallMessageSize, 36 | ); 37 | 38 | define_test_group_type_id!( 39 | "FpeListTest" => FpeList, 40 | ); 41 | 42 | define_test_group!( 43 | "keySize" => key_size: usize, 44 | "msgSize" => msg_size: usize, 45 | radix: usize, 46 | ); 47 | 48 | define_test!( 49 | key: ByteString, 50 | tweak: ByteString, 51 | "msg" => pt: Vec, 52 | ct: Vec, 53 | ); 54 | -------------------------------------------------------------------------------- /src/dsa.rs: -------------------------------------------------------------------------------- 1 | //! DSA verification tests 2 | 3 | use super::*; 4 | 5 | define_test_set!( 6 | "DSA verify", 7 | "dsa_verify_schema.json", 8 | "dsa_p1363_verify_schema.json" 9 | ); 10 | 11 | define_algorithm_map!("DSA" => Dsa); 12 | 13 | define_test_set_names!( 14 | Dsa2048_224Sha224 => "dsa_2048_224_sha224", 15 | Dsa2048_224Sha256 => "dsa_2048_224_sha256", 16 | Dsa2048_256Sha256 => "dsa_2048_256_sha256", 17 | Dsa3072_256Sha256 => "dsa_3072_256_sha256", 18 | Dsa2048_224Sha224P1363 => "dsa_2048_224_sha224_p1363", 19 | Dsa2048_224Sha256P1363 => "dsa_2048_224_sha256_p1363", 20 | Dsa2048_256Sha256P1363 => "dsa_2048_256_sha256_p1363", 21 | Dsa3072_256Sha256P1363 => "dsa_3072_256_sha256_p1363", 22 | ); 23 | 24 | define_test_flags!( 25 | ArithmeticError, 26 | BerEncodedSignature, 27 | IntegerOverflow, 28 | InvalidEncoding, 29 | InvalidSignature, 30 | InvalidTypesInSignature, 31 | MissingZero, 32 | ModifiedInteger, 33 | ModifiedSignature, 34 | ModularInverse, 35 | Normal, 36 | RangeCheck, 37 | SmallRandS, 38 | SpecialCaseHash, 39 | ); 40 | 41 | define_test_group_type_id!( 42 | "DsaVerify" => DsaVerify, 43 | "DsaP1363Verify" => DsaVerifyP1363, 44 | ); 45 | 46 | define_test_group!( 47 | "publicKey" => key: DsaPublic, 48 | "publicKeyDer" => der: ByteString, 49 | "publicKeyPem" => pem: String, 50 | "sha" => hash: HashFunction, 51 | ); 52 | 53 | define_test!(msg: ByteString, sig: ByteString); 54 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: ci 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | env: 10 | # https://github.com/rust-lang/cargo/issues/11014 11 | CARGO_NET_GIT_FETCH_WITH_CLI: true 12 | 13 | jobs: 14 | rustfmt: 15 | runs-on: ubuntu-24.04 16 | 17 | steps: 18 | - uses: dtolnay/rust-toolchain@master 19 | with: 20 | toolchain: nightly 21 | components: rustfmt 22 | 23 | - uses: actions/checkout@v4 24 | 25 | - run: cargo fmt -- --check 26 | clippy: 27 | runs-on: ubuntu-24.04 28 | 29 | steps: 30 | - uses: dtolnay/rust-toolchain@master 31 | with: 32 | toolchain: nightly 33 | components: clippy 34 | 35 | - uses: actions/checkout@v4 36 | 37 | - run: cargo +nightly clippy -- --deny warnings 38 | ci: 39 | runs-on: ubuntu-24.04 40 | 41 | strategy: 42 | fail-fast: false 43 | 44 | matrix: 45 | include: 46 | - toolchain: stable 47 | - toolchain: beta 48 | - toolchain: nightly 49 | - toolchain: 1.57.0 # MSRV 50 | 51 | steps: 52 | - uses: actions/checkout@v4 53 | - uses: dtolnay/rust-toolchain@master 54 | with: 55 | toolchain: ${{ matrix.toolchain }} 56 | - run: cargo test 57 | - run: cargo test --no-default-features 58 | - run: cargo test --no-default-features --features=aead 59 | - run: cargo test --no-default-features --features=ecdsa 60 | - run: cargo test --no-default-features --features=rsa_sig 61 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | ## 0.6.0 2024-08-27 2 | 3 | * Avoid inlining of the test data, which more completely resolves the 4 | binary size blowup fixed in 0.5.2. 5 | * Add features which can be used to control which tests are included 6 | 7 | ## 0.5.2 2024-08-27 8 | 9 | * Change to using include_bytes instead of include_str, which for some 10 | unknown reason leads to dramatically smaller binaries. 11 | * Switch to using data-encoding instead of base64/hex crates 12 | 13 | ## 0.5.1 2023-07-13 14 | 15 | * Update base64 dependency from 0.13 to 0.21 16 | 17 | ## 0.5.0 2023-03-04 18 | 19 | * Update the Wycheproof test data to the new set released on 20 | 2023-02-27. This set removes the daead and pkcs1_sign tests. 21 | * Several small structure changes which reflect changes in the 22 | Wycheproof data. 23 | * Various types within the tests that were Vec are now 24 | wrapped in LargeInteger or ByteString types 25 | * Add num-bigint feature for converting LargeInteger into 26 | a num_bigint::BigUint 27 | * Previously no MSRV was set for this crate. It is now 1.57.0 28 | * Use 2021 Edition 29 | 30 | ## 0.4.0 2021-07-11 31 | 32 | * Split the `mac` tests into `mac` and `mac_with_iv` to better 33 | match the Wycheproof schema. 34 | * Some macro helper improvements 35 | 36 | ## 0.3.0 2021-07-04 37 | 38 | * `TestSet::algorithm` is now an enumeration 39 | * `TestSet::header` is now a `String` instead of a `Vec` 40 | * Add many macros to reduce code duplication 41 | 42 | ## 0.2.0 2021-07-01 43 | 44 | * Add `TestName` enums to allow better typechecking 45 | * Split up into several modules; now everything is of the form 46 | `wycheproof::foo::{TestName, TestSet, TestGroup, Test, TestFlag}` 47 | * Some data was inadvertantly not `pub` 48 | 49 | ## 0.1.0 2021-06-26 50 | 51 | * First release 52 | 53 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Wycheproof (Deserialized) 2 | =========================== 3 | 4 | [![crates.io](https://img.shields.io/crates/v/wycheproof.svg)](https://crates.io/crates/wycheproof) 5 | [![docs.rs](https://docs.rs/wycheproof/badge.svg)](https://docs.rs/wycheproof) 6 | 7 | Google's [Wycheproof](https://github.com/google/wycheproof) project is an 8 | immensely useful set of tests which cover common corner cases in cryptographic 9 | code. 10 | 11 | The author is currently on their third job in a row where he had to write code 12 | in Rust to deserialize the JSON formatted Wycheproof tests so they can be used 13 | to test some code. This crate was born out of a desire to never ever have to do 14 | this again. It also does all the nice things I wanted but didn't have the time 15 | to do on previous attempts, like decoding the hex and base64 during 16 | deserialization, using enums to aid type checking, verifying that schemas match 17 | the expected one, etc. 18 | 19 | The minimum supported Rust version (MSRV) of this crate is currently Rust 1.57.0. 20 | If the MSRV increases in the future, this will be accompanied by an increment to 21 | the minor version number. 22 | 23 | Comments and patches are welcome. 24 | 25 | This crate is licensed Apache 2.0-only, just as Wycheproof itself is. The files 26 | in `src/data` are taken from 27 | [the latest Wycheproof commit](https://github.com/google/wycheproof/commit/b063b4aedae951c69df014cd25fa6d69ae9e8cb9) 28 | 29 | By default all available tests are compiled in. If you only need to test a few 30 | specific algorithms, you can do so with `no-default-features` plus one or more 31 | feature flags 32 | 33 | * `aead` 34 | * `cipher` 35 | * `dsa` 36 | * `ec` 37 | * `ecdh` 38 | * `ecdsa` 39 | * `eddsa` 40 | * `fpe` 41 | * `hkdf` 42 | * `keywrap` 43 | * `mac` 44 | * `primality` 45 | * `rsa_enc` 46 | * `rsa_sig` 47 | * `xdh` 48 | * `mldsa-sign` 49 | * `mldsa-verify` 50 | -------------------------------------------------------------------------------- /src/mac.rs: -------------------------------------------------------------------------------- 1 | //! Message Authentication Code tests 2 | 3 | use super::*; 4 | 5 | define_test_set!("MAC", "mac_test_schema.json"); 6 | 7 | define_test_set_names!( 8 | AesCmac => "aes_cmac", 9 | AriaCmac => "aria_cmac", 10 | CamelliaCmac => "camellia_cmac", 11 | HmacSha1 => "hmac_sha1", 12 | HmacSha224 => "hmac_sha224", 13 | HmacSha256 => "hmac_sha256", 14 | HmacSha384 => "hmac_sha384", 15 | HmacSha3_224 => "hmac_sha3_224", 16 | HmacSha3_256 => "hmac_sha3_256", 17 | HmacSha3_384 => "hmac_sha3_384", 18 | HmacSha3_512 => "hmac_sha3_512", 19 | HmacSha512 => "hmac_sha512", 20 | HmacSha512_224 => "hmac_sha512_224", 21 | HmacSha512_256 => "hmac_sha512_256", 22 | HmacSm3 => "hmac_sm3", 23 | Kmac128 => "kmac128_no_customization", 24 | Kmac256 => "kmac256_no_customization", 25 | SipHash_1_3 => "siphash_1_3", 26 | SipHash_2_4 => "siphash_2_4", 27 | SipHash_4_8 => "siphash_4_8", 28 | SipHashx_2_4 => "siphashx_2_4", 29 | SipHashx_4_8 => "siphashx_4_8", 30 | ); 31 | 32 | define_algorithm_map!( 33 | "AES-CMAC" => AesCmac, 34 | "ARIA-CMAC" => AriaCmac, 35 | "CAMELLIA-CMAC" => CamelliaCmac, 36 | "HMACSHA1" => HmacSha1, 37 | "HMACSHA224" => HmacSha224, 38 | "HMACSHA256" => HmacSha256, 39 | "HMACSHA3-224" => HmacSha3_224, 40 | "HMACSHA3-256" => HmacSha3_256, 41 | "HMACSHA3-384" => HmacSha3_384, 42 | "HMACSHA3-512" => HmacSha3_512, 43 | "HMACSHA384" => HmacSha384, 44 | "HMACSHA512" => HmacSha512, 45 | "HMACSHA512/224" => HmacSha512_224, 46 | "HMACSHA512/256" => HmacSha512_256, 47 | "HMACSM3" => HmacSm3, 48 | "KMAC128" => Kmac128, 49 | "KMAC256" => Kmac256, 50 | "SipHash-1-3" => Siphash_1_3, 51 | "SipHash-2-4" => Siphash_2_4, 52 | "SipHash-4-8" => Siphash_4_8, 53 | "SipHashX-2-4" => Siphashx_2_4, 54 | "SipHashX-4-8" => Siphashx_4_8, 55 | ); 56 | 57 | define_test_group_type_id!( 58 | "MacTest" => Mac, 59 | ); 60 | 61 | define_test_flags!(InvalidKeySize, ModifiedTag, Pseudorandom, TruncatedHmac,); 62 | 63 | define_test_group!( 64 | "keySize" => key_size: usize, 65 | "tagSize" => tag_size: usize, 66 | ); 67 | 68 | define_test!(key: ByteString, msg: ByteString, tag: ByteString,); 69 | -------------------------------------------------------------------------------- /src/ecdh.rs: -------------------------------------------------------------------------------- 1 | //! ECDH key agreement tests 2 | 3 | use super::*; 4 | 5 | define_test_set!( 6 | "ECDH", 7 | "ecdh_test_schema.json", 8 | "ecdh_ecpoint_test_schema.json" 9 | ); 10 | 11 | define_algorithm_map!("ECDH" => Ecdh); 12 | 13 | define_test_set_names!( 14 | EcdhBrainpool224r1 => "ecdh_brainpoolP224r1", 15 | EcdhBrainpool256r1 => "ecdh_brainpoolP256r1", 16 | EcdhBrainpool320r1 => "ecdh_brainpoolP320r1", 17 | EcdhBrainpool384r1 => "ecdh_brainpoolP384r1", 18 | EcdhBrainpool512r1 => "ecdh_brainpoolP512r1", 19 | EcdhSecp224r1 => "ecdh_secp224r1", 20 | EcdhSecp256k1 => "ecdh_secp256k1", 21 | EcdhSecp256r1 => "ecdh_secp256r1", 22 | EcdhSecp384r1 => "ecdh_secp384r1", 23 | EcdhSecp521r1 => "ecdh_secp521r1", 24 | EcdhSecp224r1Ecpoint => "ecdh_secp224r1_ecpoint", 25 | EcdhSecp256r1Ecpoint => "ecdh_secp256r1_ecpoint", 26 | EcdhSecp384r1Ecpoint => "ecdh_secp384r1_ecpoint", 27 | EcdhSecp521r1Ecpoint => "ecdh_secp521r1_ecpoint", 28 | ); 29 | 30 | define_test_flags!( 31 | AdditionChain, 32 | "CVE-2017-8932" => GolangScalarmulBug, 33 | "CVE_2017_10176" => JavaAdditionChainBug, 34 | CompressedPoint, 35 | CompressedPublic, 36 | EdgeCaseDoubling, 37 | EdgeCaseEphemeralKey, 38 | EdgeCaseSharedSecret, 39 | InvalidAsn, 40 | InvalidCompressedPublic, 41 | InvalidCurveAttack, 42 | InvalidEncoding, 43 | InvalidPublic, 44 | InvalidPem, 45 | IsomorphicPublicKey, 46 | GroupIsomorphism, 47 | LargeCofactor, 48 | "Modified curve parameter" => ModifiedCurveParameter, 49 | ModifiedCofactor, 50 | ModifiedGenerator, 51 | ModifiedGroup, 52 | ModifiedPrime, 53 | ModifiedPublicPoint, 54 | NegativeCofactor, 55 | Normal, 56 | UnnamedCurve, 57 | UnusedParam, 58 | WeakPublicKey, 59 | WrongCurve, 60 | WrongOrder, 61 | ); 62 | 63 | #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 64 | pub enum EcdhEncoding { 65 | #[serde(rename = "asn")] 66 | Asn1, 67 | #[serde(rename = "ecpoint")] 68 | EcPoint, 69 | } 70 | 71 | define_test_group_type_id!( 72 | "EcdhTest" => Ecdh, 73 | "EcdhEcpointTest" => EcdhEcpoint, 74 | ); 75 | 76 | define_test_group!(curve: EllipticCurve, encoding: EcdhEncoding); 77 | 78 | define_test!( 79 | "public" => public_key: ByteString, 80 | "private" => private_key: ByteString, 81 | "shared" => shared_secret: ByteString, 82 | ); 83 | -------------------------------------------------------------------------------- /src/rsa_pkcs1_verify.rs: -------------------------------------------------------------------------------- 1 | //! RSA PKCS1v1.5 verification tests 2 | 3 | use super::*; 4 | 5 | define_test_set!("RSA PKCS1 verify", "rsassa_pkcs1_verify_schema.json"); 6 | 7 | define_algorithm_map!("RSASSA-PKCS1-v1_5" => RsaPkcs1v15); 8 | 9 | define_test_set_names!( 10 | Rsa2048Sha224 => "rsa_signature_2048_sha224", 11 | Rsa2048Sha256 => "rsa_signature_2048_sha256", 12 | Rsa2048Sha3_224 => "rsa_signature_2048_sha3_224", 13 | Rsa2048Sha3_256 => "rsa_signature_2048_sha3_256", 14 | Rsa2048Sha3_384 => "rsa_signature_2048_sha3_384", 15 | Rsa2048Sha3_512 => "rsa_signature_2048_sha3_512", 16 | Rsa2048Sha384 => "rsa_signature_2048_sha384", 17 | Rsa2048Sha512_224 => "rsa_signature_2048_sha512_224", 18 | Rsa2048Sha512_256 => "rsa_signature_2048_sha512_256", 19 | Rsa2048Sha512 => "rsa_signature_2048_sha512", 20 | Rsa3072Sha256 => "rsa_signature_3072_sha256", 21 | Rsa3072Sha3_256 => "rsa_signature_3072_sha3_256", 22 | Rsa3072Sha3_384 => "rsa_signature_3072_sha3_384", 23 | Rsa3072Sha3_512 => "rsa_signature_3072_sha3_512", 24 | Rsa3072Sha384 => "rsa_signature_3072_sha384", 25 | Rsa3072Sha512_256 => "rsa_signature_3072_sha512_256", 26 | Rsa3072Sha512 => "rsa_signature_3072_sha512", 27 | Rsa4096Sha256 => "rsa_signature_4096_sha256", 28 | Rsa4096Sha384 => "rsa_signature_4096_sha384", 29 | Rsa4096Sha512_256 => "rsa_signature_4096_sha512_256", 30 | Rsa4096Sha512 => "rsa_signature_4096_sha512", 31 | Rsa8192Sha256 => "rsa_signature_8192_sha256", 32 | Rsa8192Sha384 => "rsa_signature_8192_sha384", 33 | Rsa8192Sha512 => "rsa_signature_8192_sha512", 34 | ); 35 | 36 | define_test_flags!( 37 | BerEncodedPadding, 38 | EdgeCaseSignature, 39 | InvalidAsnInPadding, 40 | InvalidPadding, 41 | InvalidSignature, 42 | MissingNull, 43 | ModifiedPadding, 44 | NoHash, 45 | ShortPadding, 46 | SignatureMalleability, 47 | SmallPublicKey, 48 | SmallSignature, 49 | WrongHash, 50 | WrongPrimitive, 51 | ); 52 | 53 | define_test_group_type_id!( 54 | "RsassaPkcs1Verify" => RsaPkcs1Verify, 55 | ); 56 | 57 | define_test_group!( 58 | "publicKey" => key: RsaPublic, 59 | "publicKeyAsn" => asn_key: ByteString, 60 | "publicKeyDer" => der: ByteString, 61 | "keyJwk" => jwk: Option, 62 | "publicKeyPem" => pem: String, 63 | "keySize" => key_size: usize, 64 | "sha" => hash: HashFunction, 65 | ); 66 | 67 | define_test!(msg: ByteString, sig: ByteString); 68 | -------------------------------------------------------------------------------- /src/rsa_oaep.rs: -------------------------------------------------------------------------------- 1 | //! RSA OAEP decryption tests 2 | 3 | use super::*; 4 | 5 | define_test_set!("RSA OAEP decrypt", "rsaes_oaep_decrypt_schema.json"); 6 | 7 | /* 8 | Currently skips: 9 | 10 | rsa_three_primes_oaep_2048_sha1_mgf1sha1_test.json 11 | rsa_three_primes_oaep_3072_sha224_mgf1sha224_test.json 12 | rsa_three_primes_oaep_4096_sha256_mgf1sha256_test.json 13 | */ 14 | define_test_set_names!( 15 | Rsa2048Sha1Mgf1Sha1 => "rsa_oaep_2048_sha1_mgf1sha1", 16 | Rsa2048Sha224Mgf1Sha1 => "rsa_oaep_2048_sha224_mgf1sha1", 17 | Rsa2048Sha224Mgf1Sha224 => "rsa_oaep_2048_sha224_mgf1sha224", 18 | Rsa2048Sha256Mgf1Sha1 => "rsa_oaep_2048_sha256_mgf1sha1", 19 | Rsa2048Sha256Mgf1Sha256 => "rsa_oaep_2048_sha256_mgf1sha256", 20 | Rsa2048Sha384Mgf1Sha1 => "rsa_oaep_2048_sha384_mgf1sha1", 21 | Rsa2048Sha384Mgf1Sha384 => "rsa_oaep_2048_sha384_mgf1sha384", 22 | Rsa2048Sha512Mgf1Sha1 => "rsa_oaep_2048_sha512_mgf1sha1", 23 | Rsa2048Sha512Mgf1Sha512 => "rsa_oaep_2048_sha512_mgf1sha512", 24 | Rsa2048Sha512_224Mgf1Sha1 => "rsa_oaep_2048_sha512_224_mgf1sha1", 25 | Rsa2048Sha512_224Mgf1Sha512_224 => "rsa_oaep_2048_sha512_224_mgf1sha512_224", 26 | Rsa3072Sha256Mgf1Sha1 => "rsa_oaep_3072_sha256_mgf1sha1", 27 | Rsa3072Sha256Mgf1Sha256 => "rsa_oaep_3072_sha256_mgf1sha256", 28 | Rsa3072Sha512Mgf1Sha1 => "rsa_oaep_3072_sha512_mgf1sha1", 29 | Rsa3072Sha512Mgf1Sha512 => "rsa_oaep_3072_sha512_mgf1sha512", 30 | Rsa3072Sha512_256Mgf1Sha1 => "rsa_oaep_3072_sha512_256_mgf1sha1", 31 | Rsa3072Sha512_256Mgf1Sha512_256 => "rsa_oaep_3072_sha512_256_mgf1sha512_256", 32 | Rsa4096Sha256Mgf1Sha1 => "rsa_oaep_4096_sha256_mgf1sha1", 33 | Rsa4096Sha256Mgf1Sha256 => "rsa_oaep_4096_sha256_mgf1sha256", 34 | Rsa4096Sha512Mgf1Sha1 => "rsa_oaep_4096_sha512_mgf1sha1", 35 | Rsa4096Sha512Mgf1Sha512 => "rsa_oaep_4096_sha512_mgf1sha512", 36 | RsaMisc => "rsa_oaep_misc", 37 | ); 38 | 39 | define_algorithm_map!("RSAES-OAEP" => RsaOaep); 40 | 41 | define_test_flags!( 42 | Constructed, 43 | EncryptionWithLabel, 44 | InvalidCiphertext, 45 | InvalidOaepPadding, 46 | Normal, 47 | SmallModulus, 48 | ); 49 | 50 | define_test_group_type_id!( 51 | "RsaesOaepDecrypt" => RsaOaepDecrypt, 52 | ); 53 | 54 | define_test_group!( 55 | "privateKey" => key: RsaPrivate, 56 | "keySize" => key_size: usize, 57 | mgf: Mgf, 58 | "mgfSha" => mgf_hash: HashFunction, 59 | "privateKeyJwk" => jwk: Option, 60 | "privateKeyPkcs8" => pkcs8: ByteString, 61 | "privateKeyPem" => pem: String, 62 | "sha" => hash: HashFunction, 63 | ); 64 | 65 | define_test!("msg" => pt: ByteString, ct: ByteString, label: ByteString); 66 | -------------------------------------------------------------------------------- /src/aead.rs: -------------------------------------------------------------------------------- 1 | //! AEAD tests 2 | 3 | use super::*; 4 | 5 | define_test_set!("AEAD", "aead_test_schema.json"); 6 | 7 | define_test_set_names!( 8 | Aegis128 => "aegis128", 9 | Aegis128L => "aegis128L", 10 | Aegis256 => "aegis256", 11 | Aes128CbcHmacSha256 => "a128cbc_hs256", 12 | Aes192CbcHmacSha384 => "a192cbc_hs384", 13 | Aes256CbcHmacSha512 => "a256cbc_hs512", 14 | AesCcm => "aes_ccm", 15 | AesEax => "aes_eax", 16 | AesGcm => "aes_gcm", 17 | AesGcmSiv => "aes_gcm_siv", 18 | AesSivCmac => "aead_aes_siv_cmac", 19 | AriaCcm => "aria_ccm", 20 | AriaGcm => "aria_gcm", 21 | Ascon128 => "ascon128", 22 | Ascon128a => "ascon128a", 23 | Ascon80pq => "ascon80pq", 24 | CamelliaCcm => "camellia_ccm", 25 | ChaCha20Poly1305 => "chacha20_poly1305", 26 | Morus1280 => "morus1280", 27 | Morus640 => "morus640", 28 | SeedCcm => "seed_ccm", 29 | SeedGcm => "seed_gcm", 30 | Sm4Ccm => "sm4_ccm", 31 | Sm4Gcm => "sm4_gcm", 32 | XChaCha20Poly1305 => "xchacha20_poly1305", 33 | ); 34 | 35 | define_algorithm_map!( 36 | "A128CBC-HS256" => Aes128CbcHmacSha256, 37 | "A192CBC-HS384" => Aes192CbcHmacSha384, 38 | "A256CBC-HS512" => Aes256CbcHmacSha512, 39 | "AEAD-AES-SIV-CMAC" => AesSivCmac, 40 | "AEGIS128" => Aegis128, 41 | "AEGIS128L" => Aegis128L, 42 | "AEGIS256" => Aegis256, 43 | "AES-CCM" => AesCcm, 44 | "AES-EAX" => AesEax, 45 | "AES-GCM" => AesGcm, 46 | "AES-GCM-SIV" => AesGcmSiv, 47 | "ARIA-CCM" => AriaCcm, 48 | "ARIA-GCM" => AriaGcm, 49 | "ASCON128" => Ascon128, 50 | "ASCON128A" => Ascon128a, 51 | "ASCON80PQ" => Ascon80pq, 52 | "CAMELLIA-CCM" => CamelliaCcm, 53 | "CAMELLIA-GCM" => CamelliaGcm, 54 | "CHACHA20-POLY1305" => ChaCha20Poly1305, 55 | "MORUS1280" => Morus1280, 56 | "MORUS640" => Morus640, 57 | "SEED-CCM" => SeedCcm, 58 | "SEED-GCM" => SeedGcm, 59 | "SM4-CCM" => Sm4Ccm, 60 | "SM4-GCM" => Sm4Gcm, 61 | "XCHACHA20-POLY1305" => XChaCha20Poly1305, 62 | ); 63 | 64 | define_test_flags!( 65 | "CVE-2017-18330" => LongNonce, 66 | "Ktv" => KnownTestVector, 67 | "TagCollision_1" => TagCollisionPtext, 68 | "TagCollision_2" => TagCollisionAad, 69 | CounterWrap, 70 | EdgeCaseCiphertext, 71 | EdgeCasePoly1305, 72 | EdgeCasePolyKey, 73 | EdgeCaseSiv, 74 | EdgeCaseTag, 75 | InsecureTagSize, 76 | InvalidNonceSize, 77 | InvalidTagSize, 78 | LongIv, 79 | ModifiedTag, 80 | OldVersion, 81 | Pseudorandom, 82 | SmallIv, 83 | SpecialCase, 84 | SpecialCaseIv, 85 | WrappedIv, 86 | ZeroLengthIv, 87 | ); 88 | 89 | define_test_group_type_id!( 90 | "AeadTest" => Aead, 91 | ); 92 | 93 | define_test_group!( 94 | "ivSize" => nonce_size: usize, 95 | "keySize" => key_size: usize, 96 | "tagSize" => tag_size: usize, 97 | ); 98 | 99 | define_test!( 100 | key: ByteString, 101 | "iv" => nonce: ByteString, 102 | aad: ByteString, 103 | "msg" => pt: ByteString, 104 | ct: ByteString, 105 | tag: ByteString, 106 | ); 107 | -------------------------------------------------------------------------------- /src/rsa_pss_verify.rs: -------------------------------------------------------------------------------- 1 | //! RSA PSS verification tests 2 | 3 | use super::*; 4 | 5 | define_test_set!( 6 | "RSA PKCS1 verify", 7 | "rsassa_pss_verify_schema.json", 8 | "rsassa_pss_with_parameters_verify_schema.json" 9 | ); 10 | 11 | define_test_set_names!( 12 | RsaPss2048Sha1Mgf1SaltLen20WithParams => "rsa_pss_2048_sha1_mgf1_20_params", 13 | RsaPss2048Sha1Mgf1SaltLen20 => "rsa_pss_2048_sha1_mgf1_20", 14 | RsaPss2048Sha256Mgf1SaltLen0WithParams => "rsa_pss_2048_sha256_mgf1_0_params", 15 | RsaPss2048Sha256Mgf1SaltLen0 => "rsa_pss_2048_sha256_mgf1_0", 16 | RsaPss2048Sha256Mgf1SaltLen32WithParams => "rsa_pss_2048_sha256_mgf1_32_params", 17 | RsaPss2048Sha256Mgf1SaltLen32 => "rsa_pss_2048_sha256_mgf1_32", 18 | RsaPss2048Sha256Mgf1Sha1_20 => "rsa_pss_2048_sha256_mgf1sha1_20", 19 | RsaPss2048Sha384Mgf1SaltLen48 => "rsa_pss_2048_sha384_mgf1_48", 20 | RsaPss2048Sha512_224Mgf1SaltLen28 => "rsa_pss_2048_sha512_224_mgf1_28", 21 | RsaPss2048Sha512_256Mgf1SaltLen32 => "rsa_pss_2048_sha512_256_mgf1_32", 22 | RsaPss2048Sha512Mgf1Sha256SaltLen32WithParams => "rsa_pss_2048_sha512_mgf1sha256_32_params", 23 | RsaPss2048Shake128WithParams => "rsa_pss_2048_shake128_params", 24 | RsaPss2048Shake128 => "rsa_pss_2048_shake128", 25 | RsaPss2048Shake256 => "rsa_pss_2048_shake256", 26 | RsaPss3072Sha256Mgf1SaltLen32WithParams => "rsa_pss_3072_sha256_mgf1_32_params", 27 | RsaPss3072Sha256Mgf1SaltLen32 => "rsa_pss_3072_sha256_mgf1_32", 28 | RsaPss3072Shake128WithParams => "rsa_pss_3072_shake128_params", 29 | RsaPss3072Shake128 => "rsa_pss_3072_shake128", 30 | RsaPss3072Shake256WithParams => "rsa_pss_3072_shake256_params", 31 | RsaPss3072Shake256 => "rsa_pss_3072_shake256", 32 | RsaPss4096Sha256Mgf1SaltLen32 => "rsa_pss_4096_sha256_mgf1_32", 33 | RsaPss4096Sha384Mgf1SaltLen48 => "rsa_pss_4096_sha384_mgf1_48", 34 | RsaPss4096Sha512Mgf1SaltLen32WithParams => "rsa_pss_4096_sha512_mgf1_32_params", 35 | RsaPss4096Sha512Mgf1SaltLen32 => "rsa_pss_4096_sha512_mgf1_32", 36 | RsaPss4096Sha512Mgf1SaltLen64WithParams => "rsa_pss_4096_sha512_mgf1_64_params", 37 | RsaPss4096Sha512Mgf1SaltLen64 => "rsa_pss_4096_sha512_mgf1_64", 38 | RsaPss4096Shake256WithParams => "rsa_pss_4096_shake256_params", 39 | RsaPss4096Shake256 => "rsa_pss_4096_shake256", 40 | RsaPssmiscWithParams => "rsa_pss_misc_params", 41 | RsaPssmisc => "rsa_pss_misc", 42 | ); 43 | 44 | define_algorithm_map!("RSASSA-PSS" => RsaPss); 45 | 46 | define_test_flags!( 47 | DistinctHash, 48 | ModifiedSignature, 49 | Mgf1Sha1, 50 | Normal, 51 | ParameterTest, 52 | SpecialCaseHash, 53 | SpecifyPkcs1Algorithm, 54 | WeakHash, 55 | WrongPrimitive, 56 | ); 57 | 58 | define_test_group_type_id!( 59 | "RsassaPssVerify" => RsaPssVerify, 60 | "RsassaPssWithParametersVerify" => RsaPssVerifyWithParam, 61 | ); 62 | 63 | fn deser_mgf_hash<'de, D: Deserializer<'de>>( 64 | deserializer: D, 65 | ) -> Result, D::Error> { 66 | let s: &str = Deserialize::deserialize(deserializer)?; 67 | match s { 68 | "" => Ok(None), 69 | "SHA-1" => Ok(Some(HashFunction::Sha1)), 70 | "SHA-224" => Ok(Some(HashFunction::Sha2_224)), 71 | "SHA-256" => Ok(Some(HashFunction::Sha2_256)), 72 | "SHA-384" => Ok(Some(HashFunction::Sha2_384)), 73 | "SHA-512" => Ok(Some(HashFunction::Sha2_512)), 74 | "SHA-512/224" => Ok(Some(HashFunction::Sha2_512_224)), 75 | "SHA-512/256" => Ok(Some(HashFunction::Sha2_512_256)), 76 | h => panic!("Unknown hash {}", h), 77 | } 78 | } 79 | 80 | define_test_group!( 81 | "publicKey" => key: RsaPublic, 82 | "publicKeyAsn" => asn_key: ByteString, 83 | "publicKeyDer" => der: ByteString, 84 | "publicKeyPem" => pem: String, 85 | "publicKeyJwk" => jwk: Option, 86 | "keySize" => key_size: usize, 87 | mgf: Mgf, 88 | "mgfSha" => mgf_hash: Option | "deser_mgf_hash", 89 | "sLen" => salt_size: usize, 90 | "sha" => hash: HashFunction, 91 | ); 92 | 93 | define_test!(msg: ByteString, sig: ByteString); 94 | -------------------------------------------------------------------------------- /src/test_keys.rs: -------------------------------------------------------------------------------- 1 | use super::*; 2 | 3 | #[allow(dead_code)] 4 | fn int_from_base64<'de, D: Deserializer<'de>>(deserializer: D) -> Result { 5 | let s: &str = Deserialize::deserialize(deserializer)?; 6 | let bytes = data_encoding::BASE64URL_NOPAD 7 | .decode(s.as_bytes()) 8 | .map_err(D::Error::custom)?; 9 | Ok(LargeInteger::new(bytes)) 10 | } 11 | 12 | #[cfg(feature = "ecdsa")] 13 | #[derive(Debug, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 14 | #[serde(deny_unknown_fields)] 15 | pub struct EcdsaPublicJwk { 16 | #[serde(rename = "crv")] 17 | pub curve: EllipticCurve, 18 | pub kid: String, 19 | pub kty: String, 20 | #[serde(deserialize_with = "int_from_base64", rename = "x")] 21 | pub affine_x: LargeInteger, 22 | #[serde(deserialize_with = "int_from_base64", rename = "y")] 23 | pub affine_y: LargeInteger, 24 | } 25 | 26 | #[cfg(feature = "rsa_sig")] 27 | #[derive(Debug, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 28 | #[serde(deny_unknown_fields)] 29 | pub struct RsaPublicJwk { 30 | pub alg: String, 31 | #[serde(deserialize_with = "int_from_base64")] 32 | pub e: LargeInteger, 33 | pub kid: String, 34 | pub kty: String, 35 | #[serde(deserialize_with = "int_from_base64")] 36 | pub n: LargeInteger, 37 | } 38 | 39 | #[cfg(feature = "rsa_enc")] 40 | #[derive(Debug, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 41 | #[serde(deny_unknown_fields)] 42 | pub struct RsaPrivateJwk { 43 | pub alg: String, 44 | #[serde(deserialize_with = "int_from_base64")] 45 | pub d: LargeInteger, 46 | #[serde(deserialize_with = "int_from_base64")] 47 | pub dp: LargeInteger, 48 | #[serde(deserialize_with = "int_from_base64")] 49 | pub dq: LargeInteger, 50 | #[serde(deserialize_with = "int_from_base64")] 51 | pub e: LargeInteger, 52 | pub kid: String, 53 | pub kty: String, 54 | #[serde(deserialize_with = "int_from_base64")] 55 | pub n: LargeInteger, 56 | #[serde(deserialize_with = "int_from_base64")] 57 | pub p: LargeInteger, 58 | #[serde(deserialize_with = "int_from_base64")] 59 | pub q: LargeInteger, 60 | #[serde(deserialize_with = "int_from_base64")] 61 | pub qi: LargeInteger, 62 | } 63 | 64 | #[cfg(feature = "eddsa")] 65 | #[derive(Debug, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 66 | #[serde(deny_unknown_fields)] 67 | pub struct EddsaPublicJwk { 68 | #[serde(rename = "crv")] 69 | pub curve: EdwardsCurve, 70 | pub kid: String, 71 | pub kty: String, 72 | #[serde(deserialize_with = "int_from_base64")] 73 | pub x: LargeInteger, 74 | } 75 | 76 | #[cfg(feature = "rsa_enc")] 77 | #[derive(Debug, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 78 | #[serde(deny_unknown_fields)] 79 | pub struct RsaPrivate { 80 | #[serde(rename = "publicExponent")] 81 | pub e: LargeInteger, 82 | #[serde(rename = "privateExponent")] 83 | pub d: LargeInteger, 84 | #[serde(rename = "modulus")] 85 | pub n: LargeInteger, 86 | #[serde(rename = "prime1")] 87 | pub p: LargeInteger, 88 | #[serde(rename = "prime2")] 89 | pub q: LargeInteger, 90 | #[serde(rename = "exponent1")] 91 | pub d1: LargeInteger, 92 | #[serde(rename = "exponent2")] 93 | pub d2: LargeInteger, 94 | #[serde(rename = "coefficient")] 95 | pub c: LargeInteger, 96 | } 97 | 98 | #[cfg(feature = "rsa_sig")] 99 | #[derive(Debug, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 100 | #[serde(deny_unknown_fields)] 101 | pub struct RsaPublic { 102 | #[serde(rename = "publicExponent")] 103 | pub e: LargeInteger, 104 | #[serde(rename = "modulus")] 105 | pub n: LargeInteger, 106 | } 107 | 108 | define_typeid!(EcPublicKeyTypeId => "EcPublicKey"); 109 | 110 | #[cfg(feature = "ecdsa")] 111 | #[derive(Debug, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 112 | #[serde(deny_unknown_fields)] 113 | pub struct EcdsaPublic { 114 | pub curve: EllipticCurve, 115 | #[serde(rename = "keySize")] 116 | pub key_size: usize, 117 | #[serde(rename = "type")] 118 | typ: EcPublicKeyTypeId, 119 | #[serde(rename = "uncompressed")] 120 | pub key: ByteString, 121 | #[serde(rename = "wx")] 122 | pub affine_x: LargeInteger, 123 | #[serde(rename = "wy")] 124 | pub affine_y: LargeInteger, 125 | } 126 | 127 | define_typeid!(DsaPublicKeyTypeId => "DsaPublicKey"); 128 | 129 | #[cfg(feature = "dsa")] 130 | #[derive(Debug, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 131 | #[serde(deny_unknown_fields)] 132 | pub struct DsaPublic { 133 | pub g: LargeInteger, 134 | #[serde(rename = "keySize")] 135 | pub key_size: usize, 136 | pub p: LargeInteger, 137 | pub q: LargeInteger, 138 | #[serde(rename = "type")] 139 | typ: DsaPublicKeyTypeId, 140 | pub y: LargeInteger, 141 | } 142 | 143 | define_typeid!(EddsaPublicKeyTypeId => "EDDSAPublicKey"); 144 | 145 | #[cfg(feature = "eddsa")] 146 | #[derive(Debug, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 147 | #[serde(deny_unknown_fields)] 148 | pub struct EddsaPublic { 149 | pub curve: EdwardsCurve, 150 | #[serde(rename = "keySize")] 151 | pub key_size: usize, 152 | pub pk: ByteString, 153 | #[serde(rename = "type")] 154 | typ: EddsaPublicKeyTypeId, 155 | } 156 | -------------------------------------------------------------------------------- /tests/tests.rs: -------------------------------------------------------------------------------- 1 | #[cfg(feature = "aead")] 2 | #[test] 3 | fn test_aead_parsing() -> Result<(), wycheproof::WycheproofError> { 4 | for test in wycheproof::aead::TestName::all() { 5 | let _kat = wycheproof::aead::TestSet::load(test)?; 6 | } 7 | Ok(()) 8 | } 9 | 10 | #[cfg(feature = "cipher")] 11 | #[test] 12 | fn test_cipher_parsing() -> Result<(), wycheproof::WycheproofError> { 13 | for test in wycheproof::cipher::TestName::all() { 14 | let _kat = wycheproof::cipher::TestSet::load(test)?; 15 | } 16 | Ok(()) 17 | } 18 | 19 | #[cfg(feature = "dsa")] 20 | #[test] 21 | fn test_dsa_parsing() -> Result<(), wycheproof::WycheproofError> { 22 | for test in wycheproof::dsa::TestName::all() { 23 | let _kat = wycheproof::dsa::TestSet::load(test)?; 24 | } 25 | Ok(()) 26 | } 27 | 28 | #[cfg(feature = "ecdh")] 29 | #[test] 30 | fn test_ecdh_parsing() -> Result<(), wycheproof::WycheproofError> { 31 | for test in wycheproof::ecdh::TestName::all() { 32 | let _kat = wycheproof::ecdh::TestSet::load(test)?; 33 | } 34 | Ok(()) 35 | } 36 | 37 | #[cfg(feature = "ecdsa")] 38 | #[test] 39 | fn test_ecdsa_parsing() -> Result<(), wycheproof::WycheproofError> { 40 | for test in wycheproof::ecdsa::TestName::all() { 41 | let _kat = wycheproof::ecdsa::TestSet::load(test)?; 42 | } 43 | Ok(()) 44 | } 45 | 46 | #[cfg(feature = "eddsa")] 47 | #[test] 48 | fn test_eddsa_parsing() -> Result<(), wycheproof::WycheproofError> { 49 | for test in wycheproof::eddsa::TestName::all() { 50 | let _kat = wycheproof::eddsa::TestSet::load(test)?; 51 | } 52 | Ok(()) 53 | } 54 | 55 | #[cfg(feature = "ec")] 56 | #[test] 57 | fn test_ec_curve_parsing() -> Result<(), wycheproof::WycheproofError> { 58 | for test in wycheproof::ec_curve::TestName::all() { 59 | let _kat = wycheproof::ec_curve::TestSet::load(test)?; 60 | } 61 | Ok(()) 62 | } 63 | 64 | #[cfg(feature = "fpe")] 65 | #[test] 66 | fn test_fpe_str_parsing() -> Result<(), wycheproof::WycheproofError> { 67 | for test in wycheproof::fpe_str::TestName::all() { 68 | let _kat = wycheproof::fpe_str::TestSet::load(test)?; 69 | } 70 | Ok(()) 71 | } 72 | 73 | #[cfg(feature = "fpe")] 74 | #[test] 75 | fn test_fpe_list_parsing() -> Result<(), wycheproof::WycheproofError> { 76 | for test in wycheproof::fpe_list::TestName::all() { 77 | let _kat = wycheproof::fpe_list::TestSet::load(test)?; 78 | } 79 | Ok(()) 80 | } 81 | 82 | #[cfg(feature = "hkdf")] 83 | #[test] 84 | fn test_hkdf_parsing() -> Result<(), wycheproof::WycheproofError> { 85 | for test in wycheproof::hkdf::TestName::all() { 86 | let _kat = wycheproof::hkdf::TestSet::load(test)?; 87 | } 88 | Ok(()) 89 | } 90 | 91 | #[cfg(feature = "keywrap")] 92 | #[test] 93 | fn test_keywrap_parsing() -> Result<(), wycheproof::WycheproofError> { 94 | for test in wycheproof::keywrap::TestName::all() { 95 | let _kat = wycheproof::keywrap::TestSet::load(test)?; 96 | } 97 | Ok(()) 98 | } 99 | 100 | #[cfg(feature = "mac")] 101 | #[test] 102 | fn test_mac_parsing() -> Result<(), wycheproof::WycheproofError> { 103 | for test in wycheproof::mac::TestName::all() { 104 | let _kat = wycheproof::mac::TestSet::load(test)?; 105 | } 106 | Ok(()) 107 | } 108 | 109 | #[cfg(feature = "mac")] 110 | #[test] 111 | fn test_mac_with_nonce_parsing() -> Result<(), wycheproof::WycheproofError> { 112 | for test in wycheproof::mac_with_nonce::TestName::all() { 113 | let _kat = wycheproof::mac_with_nonce::TestSet::load(test)?; 114 | } 115 | Ok(()) 116 | } 117 | 118 | #[cfg(feature = "primality")] 119 | #[test] 120 | fn test_primality_parsing() -> Result<(), wycheproof::WycheproofError> { 121 | for test in wycheproof::primality::TestName::all() { 122 | let _kat = wycheproof::primality::TestSet::load(test)?; 123 | } 124 | Ok(()) 125 | } 126 | 127 | #[cfg(feature = "rsa_enc")] 128 | #[test] 129 | fn test_rsa_oaep_parsing() -> Result<(), wycheproof::WycheproofError> { 130 | for test in wycheproof::rsa_oaep::TestName::all() { 131 | let _kat = wycheproof::rsa_oaep::TestSet::load(test)?; 132 | } 133 | Ok(()) 134 | } 135 | 136 | #[cfg(feature = "rsa_enc")] 137 | #[test] 138 | fn test_rsa_pkcs1_decrypt_parsing() -> Result<(), wycheproof::WycheproofError> { 139 | for test in wycheproof::rsa_pkcs1_decrypt::TestName::all() { 140 | let _kat = wycheproof::rsa_pkcs1_decrypt::TestSet::load(test)?; 141 | } 142 | Ok(()) 143 | } 144 | 145 | #[cfg(feature = "rsa_sig")] 146 | #[test] 147 | fn test_rsa_pkcs1_verify_parsing() -> Result<(), wycheproof::WycheproofError> { 148 | for test in wycheproof::rsa_pkcs1_verify::TestName::all() { 149 | let _kat = wycheproof::rsa_pkcs1_verify::TestSet::load(test)?; 150 | } 151 | Ok(()) 152 | } 153 | 154 | #[cfg(feature = "rsa_sig")] 155 | #[test] 156 | fn test_rsa_pss_verify_parsing() -> Result<(), wycheproof::WycheproofError> { 157 | for test in wycheproof::rsa_pss_verify::TestName::all() { 158 | let _kat = wycheproof::rsa_pss_verify::TestSet::load(test)?; 159 | } 160 | Ok(()) 161 | } 162 | 163 | #[cfg(feature = "xdh")] 164 | #[test] 165 | fn test_xdh_parsing() -> Result<(), wycheproof::WycheproofError> { 166 | for test in wycheproof::xdh::TestName::all() { 167 | let _kat = wycheproof::xdh::TestSet::load(test)?; 168 | } 169 | Ok(()) 170 | } 171 | 172 | #[cfg(feature = "mldsa_sign")] 173 | #[test] 174 | fn test_mldsa_sign_parsing() -> Result<(), wycheproof::WycheproofError> { 175 | for test in wycheproof::mldsa_sign::TestName::all() { 176 | let _kat = wycheproof::mldsa_sign::TestSet::load(test)?; 177 | } 178 | Ok(()) 179 | } 180 | 181 | #[cfg(feature = "mldsa_verify")] 182 | #[test] 183 | fn test_mldsa_verify_parsing() -> Result<(), wycheproof::WycheproofError> { 184 | for test in wycheproof::mldsa_verify::TestName::all() { 185 | let _kat = wycheproof::mldsa_verify::TestSet::load(test)?; 186 | } 187 | Ok(()) 188 | } 189 | -------------------------------------------------------------------------------- /src/ecdsa.rs: -------------------------------------------------------------------------------- 1 | //! ECDSA tests 2 | 3 | use super::*; 4 | 5 | define_test_set!( 6 | "ECDSA verify", 7 | "ecdsa_verify_schema.json", 8 | "ecdsa_p1363_verify_schema.json", 9 | "ecdsa_bitcoin_verify_schema.json" 10 | ); 11 | 12 | define_algorithm_map!("ECDSA" => Ecdsa); 13 | 14 | define_test_set_names!( 15 | EcdsaBrainpool224r1Sha224P1363 => "ecdsa_brainpoolP224r1_sha224_p1363", 16 | EcdsaBrainpool224r1Sha224 => "ecdsa_brainpoolP224r1_sha224", 17 | EcdsaBrainpool224r1Sha3_224 => "ecdsa_brainpoolP224r1_sha3_224", 18 | EcdsaBrainpool256r1Sha256P1363 => "ecdsa_brainpoolP256r1_sha256_p1363", 19 | EcdsaBrainpool256r1Sha256 => "ecdsa_brainpoolP256r1_sha256", 20 | EcdsaBrainpool256r1Sha3_256 => "ecdsa_brainpoolP256r1_sha3_256", 21 | EcdsaBrainpool320r1Sha3_384 => "ecdsa_brainpoolP320r1_sha3_384", 22 | EcdsaBrainpool320r1Sha384P1363 => "ecdsa_brainpoolP320r1_sha384_p1363", 23 | EcdsaBrainpool320r1Sha384 => "ecdsa_brainpoolP320r1_sha384", 24 | EcdsaBrainpool384r1Sha3_384 => "ecdsa_brainpoolP384r1_sha3_384", 25 | EcdsaBrainpool384r1Sha384P1363 => "ecdsa_brainpoolP384r1_sha384_p1363", 26 | EcdsaBrainpool384r1Sha384 => "ecdsa_brainpoolP384r1_sha384", 27 | EcdsaBrainpool512r1Sha3_512 => "ecdsa_brainpoolP512r1_sha3_512", 28 | EcdsaBrainpool512r1Sha512P1363 => "ecdsa_brainpoolP512r1_sha512_p1363", 29 | EcdsaBrainpool512r1Sha512 => "ecdsa_brainpoolP512r1_sha512", 30 | EcdsaSecp160k1Sha256P1363 => "ecdsa_secp160k1_sha256_p1363", 31 | EcdsaSecp160k1Sha256 => "ecdsa_secp160k1_sha256", 32 | EcdsaSecp160r1Sha256P1363 => "ecdsa_secp160r1_sha256_p1363", 33 | EcdsaSecp160r1Sha256 => "ecdsa_secp160r1_sha256", 34 | EcdsaSecp160r2Sha256P1363 => "ecdsa_secp160r2_sha256_p1363", 35 | EcdsaSecp160r2Sha256 => "ecdsa_secp160r2_sha256", 36 | EcdsaSecp192k1Sha256P1363 => "ecdsa_secp192k1_sha256_p1363", 37 | EcdsaSecp192k1Sha256 => "ecdsa_secp192k1_sha256", 38 | EcdsaSecp192r1Sha256P1363 => "ecdsa_secp192r1_sha256_p1363", 39 | EcdsaSecp192r1Sha256 => "ecdsa_secp192r1_sha256", 40 | EcdsaSecp224k1Sha224P1363 => "ecdsa_secp224k1_sha224_p1363", 41 | EcdsaSecp224k1Sha224 => "ecdsa_secp224k1_sha224", 42 | EcdsaSecp224k1Sha256P1363 => "ecdsa_secp224k1_sha256_p1363", 43 | EcdsaSecp224k1Sha256 => "ecdsa_secp224k1_sha256", 44 | EcdsaSecp224r1Sha224P1363 => "ecdsa_secp224r1_sha224_p1363", 45 | EcdsaSecp224r1Sha224 => "ecdsa_secp224r1_sha224", 46 | EcdsaSecp224r1Sha256P1363 => "ecdsa_secp224r1_sha256_p1363", 47 | EcdsaSecp224r1Sha256 => "ecdsa_secp224r1_sha256", 48 | EcdsaSecp224r1Sha3_224 => "ecdsa_secp224r1_sha3_224", 49 | EcdsaSecp224r1Sha3_256 => "ecdsa_secp224r1_sha3_256", 50 | EcdsaSecp224r1Sha3_512 => "ecdsa_secp224r1_sha3_512", 51 | EcdsaSecp224r1Sha512P1363 => "ecdsa_secp224r1_sha512_p1363", 52 | EcdsaSecp224r1Sha512 => "ecdsa_secp224r1_sha512", 53 | EcdsaSecp224r1Shake128P1363 => "ecdsa_secp224r1_shake128_p1363", 54 | EcdsaSecp224r1Shake128 => "ecdsa_secp224r1_shake128", 55 | EcdsaSecp256k1Sha256Bitcoin => "ecdsa_secp256k1_sha256_bitcoin", 56 | EcdsaSecp256k1Sha256P1363 => "ecdsa_secp256k1_sha256_p1363", 57 | EcdsaSecp256k1Sha256 => "ecdsa_secp256k1_sha256", 58 | EcdsaSecp256k1Sha3_256 => "ecdsa_secp256k1_sha3_256", 59 | EcdsaSecp256k1Sha3_512 => "ecdsa_secp256k1_sha3_512", 60 | EcdsaSecp256k1Sha512P1363 => "ecdsa_secp256k1_sha512_p1363", 61 | EcdsaSecp256k1Sha512 => "ecdsa_secp256k1_sha512", 62 | EcdsaSecp256k1Shake128P1363 => "ecdsa_secp256k1_shake128_p1363", 63 | EcdsaSecp256k1Shake128 => "ecdsa_secp256k1_shake128", 64 | EcdsaSecp256k1Shake256P1363 => "ecdsa_secp256k1_shake256_p1363", 65 | EcdsaSecp256k1Shake256 => "ecdsa_secp256k1_shake256", 66 | EcdsaSecp256r1Sha256P1363 => "ecdsa_secp256r1_sha256_p1363", 67 | EcdsaSecp256r1Sha256 => "ecdsa_secp256r1_sha256", 68 | EcdsaSecp256r1Sha3_256 => "ecdsa_secp256r1_sha3_256", 69 | EcdsaSecp256r1Sha3_512 => "ecdsa_secp256r1_sha3_512", 70 | EcdsaSecp256r1Sha512P1363 => "ecdsa_secp256r1_sha512_p1363", 71 | EcdsaSecp256r1Sha512 => "ecdsa_secp256r1_sha512", 72 | EcdsaSecp256r1Shake128P1363 => "ecdsa_secp256r1_shake128_p1363", 73 | EcdsaSecp256r1Shake128 => "ecdsa_secp256r1_shake128", 74 | EcdsaSecp256r1Webcrypto => "ecdsa_secp256r1_webcrypto", 75 | EcdsaSecp384r1Sha256 => "ecdsa_secp384r1_sha256", 76 | EcdsaSecp384r1Sha3_384 => "ecdsa_secp384r1_sha3_384", 77 | EcdsaSecp384r1Sha3_512 => "ecdsa_secp384r1_sha3_512", 78 | EcdsaSecp384r1Sha384P1363 => "ecdsa_secp384r1_sha384_p1363", 79 | EcdsaSecp384r1Sha384 => "ecdsa_secp384r1_sha384", 80 | EcdsaSecp384r1Sha512P1363 => "ecdsa_secp384r1_sha512_p1363", 81 | EcdsaSecp384r1Sha512 => "ecdsa_secp384r1_sha512", 82 | EcdsaSecp384r1Shake256P1363 => "ecdsa_secp384r1_shake256_p1363", 83 | EcdsaSecp384r1Shake256 => "ecdsa_secp384r1_shake256", 84 | EcdsaSecp384r1Webcrypto => "ecdsa_secp384r1_webcrypto", 85 | EcdsaSecp521r1Sha3_512 => "ecdsa_secp521r1_sha3_512", 86 | EcdsaSecp521r1Sha512P1363 => "ecdsa_secp521r1_sha512_p1363", 87 | EcdsaSecp521r1Sha512 => "ecdsa_secp521r1_sha512", 88 | EcdsaSecp521r1Shake256P1363 => "ecdsa_secp521r1_shake256_p1363", 89 | EcdsaSecp521r1Shake256 => "ecdsa_secp521r1_shake256", 90 | EcdsaSecp521r1Webcrypto => "ecdsa_secp521r1_webcrypto", 91 | ); 92 | 93 | define_test_flags!( 94 | ArithmeticError, 95 | BerEncodedSignature, 96 | EdgeCasePublicKey, 97 | EdgeCaseShamirMultiplication, 98 | GroupIsomorphism, 99 | IntegerOverflow, 100 | InvalidEncoding, 101 | InvalidSignature, 102 | InvalidTypesInSignature, 103 | MissingZero, 104 | ModifiedInteger, 105 | ModifiedSignature, 106 | ModularInverse, 107 | PointDuplication, 108 | RangeCheck, 109 | SignatureSize, 110 | SignatureMalleabilityBitcoin, 111 | SmallRandS, 112 | SpecialCaseHash, 113 | Untruncatedhash, 114 | ValidSignature, 115 | ); 116 | 117 | define_test_group_type_id!( 118 | "EcdsaVerify" => Ecdsa, 119 | "EcdsaP1363Verify" => EcdsaP1363, 120 | "EcdsaBitcoinVerify" => EcdsaBitcoin, 121 | ); 122 | 123 | define_test_group!( 124 | "publicKeyJwk" => jwk: Option, 125 | "publicKey" => key: EcdsaPublic, 126 | "publicKeyDer" => der: ByteString, 127 | "publicKeyPem" => pem: String, 128 | "sha" => hash: HashFunction, 129 | ); 130 | 131 | define_test!(msg: ByteString, sig: ByteString); 132 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. -------------------------------------------------------------------------------- /src/data/seed_wrap_test.json: -------------------------------------------------------------------------------- 1 | { 2 | "algorithm" : "SEED-WRAP", 3 | "schema" : "keywrap_test_schema.json", 4 | "generatorVersion" : "0.9", 5 | "numberOfTests" : 35, 6 | "header" : [ 7 | "Test vectors of type Keywrap are intended for tests", 8 | "checking the wrapping and unwrapping of key material." 9 | ], 10 | "notes" : { 11 | "CounterOverflow" : { 12 | "bugType" : "FUNCTIONALITY", 13 | "description" : "The test vector contains a value that is long enough so that the round counter becames larger than 256." 14 | }, 15 | "EmptyKey" : { 16 | "bugType" : "AUTH_BYPASS", 17 | "description" : "An empty key cannot be wrapped. Incorrectly wrapping an empty key may result in key independent result. Incorrectly unwrapping an empty key may allow to circumvent authentication." 18 | }, 19 | "InvalidWrappingSize" : { 20 | "bugType" : "MODIFIED_PARAMETER", 21 | "description" : "The size of the wrapped key is invalid" 22 | }, 23 | "ModifiedIv" : { 24 | "bugType" : "MISSING_STEP", 25 | "description" : "The test vector contains a ciphertext that was obtained with an incorrect IV. Unwrapping should verify that the IV is valid and hence reject this test vector." 26 | }, 27 | "Normal" : { 28 | "bugType" : "BASIC", 29 | "description" : "The test vector contains a pseudorandomly generated, valid test case. Implementations are expected to pass this test." 30 | }, 31 | "ShortKey" : { 32 | "bugType" : "MISSING_STEP", 33 | "description" : "NIST SP 800-38F does not define the wrapping of 8 byte keys. RFC 3394 Section 2 on the other hand specifies that 8 byte keys are wrapped by directly encrypting one block with AES." 34 | }, 35 | "WrongDataSize" : { 36 | "bugType" : "MISSING_STEP", 37 | "description" : "KW cannot be used to wrap a key that is not a multiple of 8 bytes. Inputs of such sizes should be rejected." 38 | } 39 | }, 40 | "testGroups" : [ 41 | { 42 | "type" : "KeywrapTest", 43 | "keySize" : 128, 44 | "tests" : [ 45 | { 46 | "tcId" : 1, 47 | "comment" : "", 48 | "flags" : [ 49 | "Normal" 50 | ], 51 | "key" : "6f67486d1e914419cb43c28509c7c1ea", 52 | "msg" : "8dc0632d92ee0be4f740028410b08270", 53 | "ct" : "36124f93b4d7b9e1467f74614a028714ed76d0f301c3866c", 54 | "result" : "valid" 55 | }, 56 | { 57 | "tcId" : 2, 58 | "comment" : "", 59 | "flags" : [ 60 | "Normal" 61 | ], 62 | "key" : "a0b17172bb296db7f5c869e9a36b5ce3", 63 | "msg" : "615dd022d607c910f20178cbdf42060f", 64 | "ct" : "7592c3bb3714e769d0dd11ab1729f81ef95da142c4204e92", 65 | "result" : "valid" 66 | }, 67 | { 68 | "tcId" : 3, 69 | "comment" : "", 70 | "flags" : [ 71 | "Normal" 72 | ], 73 | "key" : "0e49d571c19b5250effd41d94bde39d6", 74 | "msg" : "f25e4de8caca363fd5f29442eb147b55", 75 | "ct" : "beb5f8d591aadf9e8124625edbabb685deaaf80f08ec53b6", 76 | "result" : "valid" 77 | }, 78 | { 79 | "tcId" : 4, 80 | "comment" : "Round counter larger than 256", 81 | "flags" : [ 82 | "CounterOverflow" 83 | ], 84 | "key" : "31cacbb17d6dbbecae40727c5048fe0c", 85 | "msg" : "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 86 | "ct" : "286570d4d7851495d29af1f1c1717c2b20f44b5543eace58951cac77df414c6b9954b53c6424c3340c9bd769f2bf0aa3a597d8d6574ed3a86852016dfca2a20a31a93748cf1a591bf6b6ace9f382c9ff4a31c8c547f04b047d23e80ff143631086a4b8f52183de0aab5c962a78d6d23e30e686258b55998c420b398179e996e0ebd0854ca3bb2edd3c55c36950727258c800e5816b9d170d5f96e2fa849cc8c1091c97a179bb895d69db9606c5945a2535c7b15dec0286b82b315d067aef652941ffa59f16bc876a558034be930a61136616ae49953646ca911362ab2c2c76f4cfc5f319b51b5444be59c4bea12431ea95630301e19c35714844749d7712a24958542823a0c8b5d94c2c1da2fb0cea64c84627774f794867c311ce68848827b3bd45babf9218001517ede204bac2eb250c6330e17166433be67ae5daf84bc4a750a1725133c159c4eebaa2e1a13e9898f70df33cce9998db5fa7a4f899c6ef9cbb4f6fc47195b3068182ce5fbf0ba38fb3817c3fbbbc056da46c1bf5333a5c571df7a418849f1fc8", 87 | "result" : "valid" 88 | }, 89 | { 90 | "tcId" : 5, 91 | "comment" : "empty keys cannot be wrapped", 92 | "flags" : [ 93 | "EmptyKey" 94 | ], 95 | "key" : "574957151fc2afe0fa3dc7a9a7da6495", 96 | "msg" : "", 97 | "ct" : "a6a6a6a6a6a6a6a6", 98 | "result" : "invalid" 99 | }, 100 | { 101 | "tcId" : 6, 102 | "comment" : "wrapping an 8 byte key", 103 | "flags" : [ 104 | "ShortKey" 105 | ], 106 | "key" : "574957151fc2afe0fa3dc7a9a7da6495", 107 | "msg" : "0001020304050607", 108 | "ct" : "dcf6d0c9b2913140d5cd4da1c80c1719", 109 | "result" : "acceptable" 110 | }, 111 | { 112 | "tcId" : 7, 113 | "comment" : "incorrect wrapping of 8 bytes", 114 | "flags" : [ 115 | "ShortKey" 116 | ], 117 | "key" : "574957151fc2afe0fa3dc7a9a7da6495", 118 | "msg" : "0001020304050607", 119 | "ct" : "f2bd97877cd38d5412707355848ec82b", 120 | "result" : "invalid" 121 | }, 122 | { 123 | "tcId" : 8, 124 | "comment" : "wrapped key size must be divisible by 8", 125 | "flags" : [ 126 | "WrongDataSize" 127 | ], 128 | "key" : "574957151fc2afe0fa3dc7a9a7da6495", 129 | "msg" : "00", 130 | "ct" : "", 131 | "result" : "invalid" 132 | }, 133 | { 134 | "tcId" : 9, 135 | "comment" : "wrapped key size must be divisible by 8", 136 | "flags" : [ 137 | "WrongDataSize" 138 | ], 139 | "key" : "574957151fc2afe0fa3dc7a9a7da6495", 140 | "msg" : "0001", 141 | "ct" : "", 142 | "result" : "invalid" 143 | }, 144 | { 145 | "tcId" : 10, 146 | "comment" : "wrapped key size must be divisible by 8", 147 | "flags" : [ 148 | "WrongDataSize" 149 | ], 150 | "key" : "574957151fc2afe0fa3dc7a9a7da6495", 151 | "msg" : "000102", 152 | "ct" : "", 153 | "result" : "invalid" 154 | }, 155 | { 156 | "tcId" : 11, 157 | "comment" : "wrapped key size must be divisible by 8", 158 | "flags" : [ 159 | "WrongDataSize" 160 | ], 161 | "key" : "574957151fc2afe0fa3dc7a9a7da6495", 162 | "msg" : "00010203", 163 | "ct" : "", 164 | "result" : "invalid" 165 | }, 166 | { 167 | "tcId" : 12, 168 | "comment" : "wrapped key size must be divisible by 8", 169 | "flags" : [ 170 | "WrongDataSize" 171 | ], 172 | "key" : "574957151fc2afe0fa3dc7a9a7da6495", 173 | "msg" : "0001020304", 174 | "ct" : "", 175 | "result" : "invalid" 176 | }, 177 | { 178 | "tcId" : 13, 179 | "comment" : "wrapped key size must be divisible by 8", 180 | "flags" : [ 181 | "WrongDataSize" 182 | ], 183 | "key" : "574957151fc2afe0fa3dc7a9a7da6495", 184 | "msg" : "000102030405", 185 | "ct" : "", 186 | "result" : "invalid" 187 | }, 188 | { 189 | "tcId" : 14, 190 | "comment" : "wrapped key size must be divisible by 8", 191 | "flags" : [ 192 | "WrongDataSize" 193 | ], 194 | "key" : "574957151fc2afe0fa3dc7a9a7da6495", 195 | "msg" : "00010203040506", 196 | "ct" : "", 197 | "result" : "invalid" 198 | }, 199 | { 200 | "tcId" : 15, 201 | "comment" : "wrapped key size must be divisible by 8", 202 | "flags" : [ 203 | "WrongDataSize" 204 | ], 205 | "key" : "574957151fc2afe0fa3dc7a9a7da6495", 206 | "msg" : "000102030405060708090a0b0c0d0e0f10111213", 207 | "ct" : "", 208 | "result" : "invalid" 209 | }, 210 | { 211 | "tcId" : 16, 212 | "comment" : "invalid size of wrapped key", 213 | "flags" : [ 214 | "InvalidWrappingSize" 215 | ], 216 | "key" : "fe60fc8df7d9f4ebb5416ca4e82182f7", 217 | "msg" : "", 218 | "ct" : "", 219 | "result" : "invalid" 220 | }, 221 | { 222 | "tcId" : 17, 223 | "comment" : "invalid size of wrapped key", 224 | "flags" : [ 225 | "InvalidWrappingSize" 226 | ], 227 | "key" : "fe60fc8df7d9f4ebb5416ca4e82182f7", 228 | "msg" : "", 229 | "ct" : "9f", 230 | "result" : "invalid" 231 | }, 232 | { 233 | "tcId" : 18, 234 | "comment" : "invalid size of wrapped key", 235 | "flags" : [ 236 | "InvalidWrappingSize" 237 | ], 238 | "key" : "fe60fc8df7d9f4ebb5416ca4e82182f7", 239 | "msg" : "", 240 | "ct" : "dc9e9580", 241 | "result" : "invalid" 242 | }, 243 | { 244 | "tcId" : 19, 245 | "comment" : "invalid size of wrapped key", 246 | "flags" : [ 247 | "InvalidWrappingSize" 248 | ], 249 | "key" : "fe60fc8df7d9f4ebb5416ca4e82182f7", 250 | "msg" : "", 251 | "ct" : "b9b282d138693000", 252 | "result" : "invalid" 253 | }, 254 | { 255 | "tcId" : 20, 256 | "comment" : "invalid size of wrapped key", 257 | "flags" : [ 258 | "InvalidWrappingSize" 259 | ], 260 | "key" : "fe60fc8df7d9f4ebb5416ca4e82182f7", 261 | "msg" : "", 262 | "ct" : "0efc635b2d61e244056b9d4591ca6b", 263 | "result" : "invalid" 264 | }, 265 | { 266 | "tcId" : 21, 267 | "comment" : "invalid size of wrapped key", 268 | "flags" : [ 269 | "InvalidWrappingSize" 270 | ], 271 | "key" : "fe60fc8df7d9f4ebb5416ca4e82182f7", 272 | "msg" : "", 273 | "ct" : "4a305dae087b0d24d62af41831338f33ae", 274 | "result" : "invalid" 275 | }, 276 | { 277 | "tcId" : 22, 278 | "comment" : "invalid size of wrapped key", 279 | "flags" : [ 280 | "InvalidWrappingSize" 281 | ], 282 | "key" : "fe60fc8df7d9f4ebb5416ca4e82182f7", 283 | "msg" : "", 284 | "ct" : "82cb927097cf31ea4affea440b0d8ca6a240b900", 285 | "result" : "invalid" 286 | }, 287 | { 288 | "tcId" : 23, 289 | "comment" : "bytes appended to wrapped key", 290 | "flags" : [ 291 | "InvalidWrappingSize" 292 | ], 293 | "key" : "fe60fc8df7d9f4ebb5416ca4e82182f7", 294 | "msg" : "000102030405060708090a0b0c0d0e0f", 295 | "ct" : "29d8e449c375f239433bdd658c3966eb2a78c40d583690e700", 296 | "result" : "invalid" 297 | }, 298 | { 299 | "tcId" : 24, 300 | "comment" : "byte 0 in IV changed", 301 | "flags" : [ 302 | "ModifiedIv" 303 | ], 304 | "key" : "4f710eb6b5e28703becfc3dc52fa8bc1", 305 | "msg" : "a828cbda9b5ff0ae374f84fa01d070a5", 306 | "ct" : "e4a87ef1e7e105894502a227927b836b62726342ffc2043f", 307 | "result" : "invalid" 308 | }, 309 | { 310 | "tcId" : 25, 311 | "comment" : "byte 1 in IV changed", 312 | "flags" : [ 313 | "ModifiedIv" 314 | ], 315 | "key" : "4f710eb6b5e28703becfc3dc52fa8bc1", 316 | "msg" : "a828cbda9b5ff0ae374f84fa01d070a5", 317 | "ct" : "af1b17eb11d09eb728dda965437c06a8480c37b0993beac8", 318 | "result" : "invalid" 319 | }, 320 | { 321 | "tcId" : 26, 322 | "comment" : "byte 2 in IV changed", 323 | "flags" : [ 324 | "ModifiedIv" 325 | ], 326 | "key" : "4f710eb6b5e28703becfc3dc52fa8bc1", 327 | "msg" : "a828cbda9b5ff0ae374f84fa01d070a5", 328 | "ct" : "5e1ff456edf5e0beb10a64b6d32e08ee087de932e3ee5f56", 329 | "result" : "invalid" 330 | }, 331 | { 332 | "tcId" : 27, 333 | "comment" : "byte 3 in IV changed", 334 | "flags" : [ 335 | "ModifiedIv" 336 | ], 337 | "key" : "4f710eb6b5e28703becfc3dc52fa8bc1", 338 | "msg" : "a828cbda9b5ff0ae374f84fa01d070a5", 339 | "ct" : "d477f08e9080d5d7482a98adb7c91362e0b6f50bd16ac2ac", 340 | "result" : "invalid" 341 | }, 342 | { 343 | "tcId" : 28, 344 | "comment" : "byte 4 in IV changed", 345 | "flags" : [ 346 | "ModifiedIv" 347 | ], 348 | "key" : "4f710eb6b5e28703becfc3dc52fa8bc1", 349 | "msg" : "a828cbda9b5ff0ae374f84fa01d070a5", 350 | "ct" : "af6695e34fe22fc684b9eebb26a753182155e4fc94bcc7ab", 351 | "result" : "invalid" 352 | }, 353 | { 354 | "tcId" : 29, 355 | "comment" : "byte 5 in IV changed", 356 | "flags" : [ 357 | "ModifiedIv" 358 | ], 359 | "key" : "4f710eb6b5e28703becfc3dc52fa8bc1", 360 | "msg" : "a828cbda9b5ff0ae374f84fa01d070a5", 361 | "ct" : "ee125d5b4538c10e0f25a6403cb3e5ef15f3d0c1d79c95fb", 362 | "result" : "invalid" 363 | }, 364 | { 365 | "tcId" : 30, 366 | "comment" : "byte 6 in IV changed", 367 | "flags" : [ 368 | "ModifiedIv" 369 | ], 370 | "key" : "4f710eb6b5e28703becfc3dc52fa8bc1", 371 | "msg" : "a828cbda9b5ff0ae374f84fa01d070a5", 372 | "ct" : "21ff3b204c83f97d0b3e757950c928b7a6c34100a3dbec23", 373 | "result" : "invalid" 374 | }, 375 | { 376 | "tcId" : 31, 377 | "comment" : "byte 7 in IV changed", 378 | "flags" : [ 379 | "ModifiedIv" 380 | ], 381 | "key" : "4f710eb6b5e28703becfc3dc52fa8bc1", 382 | "msg" : "a828cbda9b5ff0ae374f84fa01d070a5", 383 | "ct" : "67296d14c252450f49834502715a97cc0be6508c1d792a99", 384 | "result" : "invalid" 385 | }, 386 | { 387 | "tcId" : 32, 388 | "comment" : "IV changed to 0000000000000000", 389 | "flags" : [ 390 | "ModifiedIv" 391 | ], 392 | "key" : "4f710eb6b5e28703becfc3dc52fa8bc1", 393 | "msg" : "a828cbda9b5ff0ae374f84fa01d070a5", 394 | "ct" : "b400665d9544018984b9eb261987150d247fea3b2b4375fe", 395 | "result" : "invalid" 396 | }, 397 | { 398 | "tcId" : 33, 399 | "comment" : "IV changed to RFC 5649 padding", 400 | "flags" : [ 401 | "ModifiedIv" 402 | ], 403 | "key" : "4f710eb6b5e28703becfc3dc52fa8bc1", 404 | "msg" : "a828cbda9b5ff0ae374f84fa01d070a5", 405 | "ct" : "5f70f4d13e0b8b0c921f5b0dbc28ad2ade9ad9e59a5abc47", 406 | "result" : "invalid" 407 | }, 408 | { 409 | "tcId" : 34, 410 | "comment" : "IV changed to 5959595959595959", 411 | "flags" : [ 412 | "ModifiedIv" 413 | ], 414 | "key" : "4f710eb6b5e28703becfc3dc52fa8bc1", 415 | "msg" : "a828cbda9b5ff0ae374f84fa01d070a5", 416 | "ct" : "f422c09d16ce6535a9f410ba76198e5aa4b0be298da9cde5", 417 | "result" : "invalid" 418 | }, 419 | { 420 | "tcId" : 35, 421 | "comment" : "IV changed to ffffffffffffffff", 422 | "flags" : [ 423 | "ModifiedIv" 424 | ], 425 | "key" : "4f710eb6b5e28703becfc3dc52fa8bc1", 426 | "msg" : "a828cbda9b5ff0ae374f84fa01d070a5", 427 | "ct" : "9c8a88de7109ff464725ccdafb6be259d8e7026fb45bc2e1", 428 | "result" : "invalid" 429 | } 430 | ] 431 | } 432 | ] 433 | } 434 | -------------------------------------------------------------------------------- /src/data/siphash_1_3_test.json: -------------------------------------------------------------------------------- 1 | { 2 | "algorithm" : "SipHash-1-3", 3 | "schema" : "mac_test_schema.json", 4 | "generatorVersion" : "0.9", 5 | "numberOfTests" : 40, 6 | "header" : [ 7 | "Test vectors of type MacTest are intended for testing the", 8 | "generation and verification of MACs." 9 | ], 10 | "notes" : { 11 | "Pseudorandom" : { 12 | "bugType" : "FUNCTIONALITY", 13 | "description" : "The test vector contains pseudorandomly generated inputs. The goal of the test vector is to check the correctness of the implementation for various sizes of the input parameters." 14 | } 15 | }, 16 | "testGroups" : [ 17 | { 18 | "type" : "MacTest", 19 | "keySize" : 128, 20 | "tagSize" : 64, 21 | "tests" : [ 22 | { 23 | "tcId" : 1, 24 | "comment" : "empty message", 25 | "flags" : [ 26 | "Pseudorandom" 27 | ], 28 | "key" : "e7ab5e259fe55d624340e495e65a5bf8", 29 | "msg" : "", 30 | "tag" : "4e2113cd24d3fa47", 31 | "result" : "valid" 32 | }, 33 | { 34 | "tcId" : 2, 35 | "comment" : "message of size 1", 36 | "flags" : [ 37 | "Pseudorandom" 38 | ], 39 | "key" : "39ff769700dca7efa13068ad6b850cad", 40 | "msg" : "18", 41 | "tag" : "bfa52eb6953fc488", 42 | "result" : "valid" 43 | }, 44 | { 45 | "tcId" : 3, 46 | "comment" : "message of size 2", 47 | "flags" : [ 48 | "Pseudorandom" 49 | ], 50 | "key" : "791559e5b43a80160111a3de4b3bdc66", 51 | "msg" : "631e", 52 | "tag" : "4b701b2d68b6ba65", 53 | "result" : "valid" 54 | }, 55 | { 56 | "tcId" : 4, 57 | "comment" : "message of size 3", 58 | "flags" : [ 59 | "Pseudorandom" 60 | ], 61 | "key" : "6f81b0c88f7a52f01030135e234f39f9", 62 | "msg" : "bf7a60", 63 | "tag" : "5670ec13eb7d3a06", 64 | "result" : "valid" 65 | }, 66 | { 67 | "tcId" : 5, 68 | "comment" : "message of size 4", 69 | "flags" : [ 70 | "Pseudorandom" 71 | ], 72 | "key" : "24af21282debdb841551c01ed769bd11", 73 | "msg" : "5af8a4ef", 74 | "tag" : "a0ee03e5dfd09b2e", 75 | "result" : "valid" 76 | }, 77 | { 78 | "tcId" : 6, 79 | "comment" : "message of size 5", 80 | "flags" : [ 81 | "Pseudorandom" 82 | ], 83 | "key" : "164c9eaeeaa6ab2c918849b71bb86568", 84 | "msg" : "218fb4190b", 85 | "tag" : "0a3d974b5fd64e2d", 86 | "result" : "valid" 87 | }, 88 | { 89 | "tcId" : 7, 90 | "comment" : "message of size 6", 91 | "flags" : [ 92 | "Pseudorandom" 93 | ], 94 | "key" : "c9c4ef9502baac5b3c5cce6b674257af", 95 | "msg" : "31739dafe6b5", 96 | "tag" : "b6109bd6abaf677c", 97 | "result" : "valid" 98 | }, 99 | { 100 | "tcId" : 8, 101 | "comment" : "message of size 7", 102 | "flags" : [ 103 | "Pseudorandom" 104 | ], 105 | "key" : "b99a81c6cdb81a3c46cec9c25acae4ba", 106 | "msg" : "336f972681ae4e", 107 | "tag" : "31b6b27a731af998", 108 | "result" : "valid" 109 | }, 110 | { 111 | "tcId" : 9, 112 | "comment" : "message of size 8", 113 | "flags" : [ 114 | "Pseudorandom" 115 | ], 116 | "key" : "60d83b209822c0d9b7033dca86444fa1", 117 | "msg" : "313f08031f5cbac1", 118 | "tag" : "29c7fa4f0dac6b85", 119 | "result" : "valid" 120 | }, 121 | { 122 | "tcId" : 10, 123 | "comment" : "message of size 9", 124 | "flags" : [ 125 | "Pseudorandom" 126 | ], 127 | "key" : "38a6b9348d8171f4eccb30a39f8c89f8", 128 | "msg" : "05483d1ecaa94d4517", 129 | "tag" : "2404222ddeb27bf7", 130 | "result" : "valid" 131 | }, 132 | { 133 | "tcId" : 11, 134 | "comment" : "message of size 10", 135 | "flags" : [ 136 | "Pseudorandom" 137 | ], 138 | "key" : "08fe43f39652ccfc0b078b38ee764c47", 139 | "msg" : "909d45d3a8c0f4cdf478", 140 | "tag" : "2ce02032ac163ef8", 141 | "result" : "valid" 142 | }, 143 | { 144 | "tcId" : 12, 145 | "comment" : "message of size 11", 146 | "flags" : [ 147 | "Pseudorandom" 148 | ], 149 | "key" : "e560a68599f285389fd65627a6b868a5", 150 | "msg" : "ccdb1073bdcf88cc6ccd8b", 151 | "tag" : "5891d5661fea9d5b", 152 | "result" : "valid" 153 | }, 154 | { 155 | "tcId" : 13, 156 | "comment" : "message of size 12", 157 | "flags" : [ 158 | "Pseudorandom" 159 | ], 160 | "key" : "375359717d335416d6c775ca9e9fafe3", 161 | "msg" : "4514fe4c2ea3bc7deb357bb9", 162 | "tag" : "4ff3605347da5497", 163 | "result" : "valid" 164 | }, 165 | { 166 | "tcId" : 14, 167 | "comment" : "message of size 13", 168 | "flags" : [ 169 | "Pseudorandom" 170 | ], 171 | "key" : "6be83b26128a43fb268f46122dad822f", 172 | "msg" : "f95f5f9a363f187872e3a0a6e6", 173 | "tag" : "01eba0558d996db5", 174 | "result" : "valid" 175 | }, 176 | { 177 | "tcId" : 15, 178 | "comment" : "message of size 14", 179 | "flags" : [ 180 | "Pseudorandom" 181 | ], 182 | "key" : "7760e343976382fb554cea2f57541a65", 183 | "msg" : "63195f4a709f87bd590aa92785bc", 184 | "tag" : "339e2652f2d84261", 185 | "result" : "valid" 186 | }, 187 | { 188 | "tcId" : 16, 189 | "comment" : "message of size 15", 190 | "flags" : [ 191 | "Pseudorandom" 192 | ], 193 | "key" : "3136256d64252e345d1eb85e9a6830de", 194 | "msg" : "7f91c709a56ac82a8d589c7fe470bc", 195 | "tag" : "add5c384ad902c5e", 196 | "result" : "valid" 197 | }, 198 | { 199 | "tcId" : 17, 200 | "comment" : "message of size 16", 201 | "flags" : [ 202 | "Pseudorandom" 203 | ], 204 | "key" : "e7b9a8e55075013d75ab1903e9f908c9", 205 | "msg" : "1dbd54754bd61f8c21c12a89cc8d249a", 206 | "tag" : "57b99c7338e5a20d", 207 | "result" : "valid" 208 | }, 209 | { 210 | "tcId" : 18, 211 | "comment" : "message of size 17", 212 | "flags" : [ 213 | "Pseudorandom" 214 | ], 215 | "key" : "c6cf618428b01827950262d03e594a22", 216 | "msg" : "421197abce28abfdfaaeaf4768ca115714", 217 | "tag" : "2cb4f4a7562c0c14", 218 | "result" : "valid" 219 | }, 220 | { 221 | "tcId" : 19, 222 | "comment" : "message of size 18", 223 | "flags" : [ 224 | "Pseudorandom" 225 | ], 226 | "key" : "4eb4a980bbda3a4f33b81da3c8453e2f", 227 | "msg" : "127c457dfb9949454bafcc48b59f7a762c02", 228 | "tag" : "42ee10f741fd78e1", 229 | "result" : "valid" 230 | }, 231 | { 232 | "tcId" : 20, 233 | "comment" : "message of size 19", 234 | "flags" : [ 235 | "Pseudorandom" 236 | ], 237 | "key" : "20bdbad57cdab091fb5d3129f2a8007f", 238 | "msg" : "da9abcc47b5e9e685e20009f3a52b2df16f16a", 239 | "tag" : "e9bae385223dae4c", 240 | "result" : "valid" 241 | }, 242 | { 243 | "tcId" : 21, 244 | "comment" : "message of size 20", 245 | "flags" : [ 246 | "Pseudorandom" 247 | ], 248 | "key" : "7d43babbb3c9b3948b742e15fa8f5f9e", 249 | "msg" : "7fd4d1b88620df21190345dd4374cc1db9ae355e", 250 | "tag" : "25b80a5ed2bafa08", 251 | "result" : "valid" 252 | }, 253 | { 254 | "tcId" : 22, 255 | "comment" : "message of size 21", 256 | "flags" : [ 257 | "Pseudorandom" 258 | ], 259 | "key" : "22233d8a6eb04f69819a21101dfb4405", 260 | "msg" : "4635bb2072df00569418eabb622a9024a18fb85fe5", 261 | "tag" : "0fa2f275961f5fe6", 262 | "result" : "valid" 263 | }, 264 | { 265 | "tcId" : 23, 266 | "comment" : "message of size 22", 267 | "flags" : [ 268 | "Pseudorandom" 269 | ], 270 | "key" : "d12a6dc91d2c82a283fb0f8b70bd1421", 271 | "msg" : "131ca64d0b70bc3fc14a0be1067a81246cf0be65d28d", 272 | "tag" : "a9d895fed8d0c150", 273 | "result" : "valid" 274 | }, 275 | { 276 | "tcId" : 24, 277 | "comment" : "message of size 23", 278 | "flags" : [ 279 | "Pseudorandom" 280 | ], 281 | "key" : "8ae19160b02da292582542ea44c5a350", 282 | "msg" : "45f7bad0cc6a1a2b266301cd0d73f1073507600ad236d6", 283 | "tag" : "604860ad215dce7d", 284 | "result" : "valid" 285 | }, 286 | { 287 | "tcId" : 25, 288 | "comment" : "message of size 24", 289 | "flags" : [ 290 | "Pseudorandom" 291 | ], 292 | "key" : "6c2e323b3e2f5d321a326cfc00af3f96", 293 | "msg" : "e008b3b953f8a799d25e632571efe6308ffcfbef6e914e7f", 294 | "tag" : "f0646ce0367f24e7", 295 | "result" : "valid" 296 | }, 297 | { 298 | "tcId" : 26, 299 | "comment" : "message of size 25", 300 | "flags" : [ 301 | "Pseudorandom" 302 | ], 303 | "key" : "2c618ab2c505e778969c4f0b6f2c46de", 304 | "msg" : "646d2ef9bad00c2e0d170435e48c522857ac156059c40841fe", 305 | "tag" : "a23763b3e81adee1", 306 | "result" : "valid" 307 | }, 308 | { 309 | "tcId" : 27, 310 | "comment" : "message of size 26", 311 | "flags" : [ 312 | "Pseudorandom" 313 | ], 314 | "key" : "0c8d0d9d247b12ec944a5405ab475d59", 315 | "msg" : "a43724603213c33ba163776fb78ae1204994df29026ce7a3fb90", 316 | "tag" : "f76d8660eb5c9bbc", 317 | "result" : "valid" 318 | }, 319 | { 320 | "tcId" : 28, 321 | "comment" : "message of size 27", 322 | "flags" : [ 323 | "Pseudorandom" 324 | ], 325 | "key" : "a79cdb6c660cd7b1784691e25ef99b27", 326 | "msg" : "59922d991b79858b937882c3ea4a94af9cc4abff8a9e50972069bb", 327 | "tag" : "9ea191ea2de955c0", 328 | "result" : "valid" 329 | }, 330 | { 331 | "tcId" : 29, 332 | "comment" : "message of size 28", 333 | "flags" : [ 334 | "Pseudorandom" 335 | ], 336 | "key" : "3a396b9539aed0ce205f96914e3fe36f", 337 | "msg" : "1dc6e025954ec66feae6007f1bd469038b3ec5f8dbc17de5065b99ef", 338 | "tag" : "16743aefce272b4b", 339 | "result" : "valid" 340 | }, 341 | { 342 | "tcId" : 30, 343 | "comment" : "message of size 29", 344 | "flags" : [ 345 | "Pseudorandom" 346 | ], 347 | "key" : "81ba6ab86e4059ffddaa269a0b906b08", 348 | "msg" : "05350b55441488d4f63587300ab59a0338b3eab412236ef66991335b7a", 349 | "tag" : "6ca4b47c594eeda2", 350 | "result" : "valid" 351 | }, 352 | { 353 | "tcId" : 31, 354 | "comment" : "message of size 30", 355 | "flags" : [ 356 | "Pseudorandom" 357 | ], 358 | "key" : "f552f7a0f2efa9185e4e1eafbac67c0f", 359 | "msg" : "358deda495269a59b598799afce3b5aae84669bcf5c8299aebad99096bca", 360 | "tag" : "a1d1e24f23e0654d", 361 | "result" : "valid" 362 | }, 363 | { 364 | "tcId" : 32, 365 | "comment" : "message of size 31", 366 | "flags" : [ 367 | "Pseudorandom" 368 | ], 369 | "key" : "4fbe64bbb7ec7bef3d97855dc3572abf", 370 | "msg" : "24ab15969137dd15e89bb513927c5c4b72c2680e22b8a1062bc9f6e6e3946b", 371 | "tag" : "fd3d4591fcffefa9", 372 | "result" : "valid" 373 | }, 374 | { 375 | "tcId" : 33, 376 | "comment" : "message of size 32", 377 | "flags" : [ 378 | "Pseudorandom" 379 | ], 380 | "key" : "fd64738a57136b746fbd4fa787898150", 381 | "msg" : "cc8c537b498b7dc05e50058ac060d459138119a076f5a36fb470902dc7152839", 382 | "tag" : "0930f1e038b1753b", 383 | "result" : "valid" 384 | }, 385 | { 386 | "tcId" : 34, 387 | "comment" : "message of size 47", 388 | "flags" : [ 389 | "Pseudorandom" 390 | ], 391 | "key" : "a691c5d8b6006cb391633397d7e82cd5", 392 | "msg" : "0bdd246e199cd46b799854c2db7670fbb25dde09bc3f4fe74fac7629448a5b3b31e458510ccfe8552edcb540e51866", 393 | "tag" : "d370908df1b1a5c1", 394 | "result" : "valid" 395 | }, 396 | { 397 | "tcId" : 35, 398 | "comment" : "message of size 48", 399 | "flags" : [ 400 | "Pseudorandom" 401 | ], 402 | "key" : "fcddec49fd82ca652102060dc0788afe", 403 | "msg" : "dbda9f58f337da7d031ad9e50e48ad161fde9eaa39cc10551ed8ff1dae160e18594864adc53ff56a4fc19f6dfe59b7c3", 404 | "tag" : "1d181ef3c1140391", 405 | "result" : "valid" 406 | }, 407 | { 408 | "tcId" : 36, 409 | "comment" : "message of size 49", 410 | "flags" : [ 411 | "Pseudorandom" 412 | ], 413 | "key" : "885c1340266f4bc4b86eab570f018cb2", 414 | "msg" : "372a8ab6495798b43b33c0998ec1f8b714298cf820d78dd9b6a6aad1a10002b66c6b8437097edfce06527519c2ba682478", 415 | "tag" : "ca8c064b6786640c", 416 | "result" : "valid" 417 | }, 418 | { 419 | "tcId" : 37, 420 | "comment" : "message of size 112", 421 | "flags" : [ 422 | "Pseudorandom" 423 | ], 424 | "key" : "7bf32df7deb7fc458b4615eba9194b51", 425 | "msg" : "37a14c4007c81b9843b4cce7b916ee477674098e4fd3aa2ea9eab9418d98c063076f50274352e16963b46a0c58631d5fd4928c96faae66ef24bf86c9ac117dbe8f73c5b51a18a6b4306688cb6199d9cb8e44b564f3ef3c4f9e977ca2c2c4c603a228310231a1cf4a30032e1945520f8c", 426 | "tag" : "ca72c8893fd1d68d", 427 | "result" : "valid" 428 | }, 429 | { 430 | "tcId" : 38, 431 | "comment" : "message of size 127", 432 | "flags" : [ 433 | "Pseudorandom" 434 | ], 435 | "key" : "4f9af4aea55dee3986bd307d2dee0fce", 436 | "msg" : "b9b4c59c50f3324f71af4acc6b827f2b057ddf6e66c71f33694b3b3aa113892644dfa3b2516185c3ab7123a95c9cbccee30264e099748a85ee79b4b672ba1fd92c48774f0edbfcd078a47152319c53293adf75787b9fa7e21caa30a3a67d647134171adf122589a47eed56d79a592b009c8266367ff3cf73c23dce7644bafa", 437 | "tag" : "2ea335dfe16a0195", 438 | "result" : "valid" 439 | }, 440 | { 441 | "tcId" : 39, 442 | "comment" : "message of size 128", 443 | "flags" : [ 444 | "Pseudorandom" 445 | ], 446 | "key" : "54723c003cd0bd022b2d23bb1e63a97b", 447 | "msg" : "3791e7d4dfa8e5c053eaf1e418f1f3b79e5958a0a85a6f56e6c193cbbd87d901df8144072fedb6f29558480ad23730c17cf28b026a8da6a45cf244af084e40779ba44d261f5420ecc7e3178f6ab7d64e68b6dff827cde7b536d8cd94970323db5473edc169e888cff3e87ea1af1ae409c795f9543496ce82e8ac534a379e0ea0", 448 | "tag" : "651d914296bb9077", 449 | "result" : "valid" 450 | }, 451 | { 452 | "tcId" : 40, 453 | "comment" : "message of size 255", 454 | "flags" : [ 455 | "Pseudorandom" 456 | ], 457 | "key" : "8176e2511297b5def9952571b272c454", 458 | "msg" : "4c408fd246885cf6a2f5935837a6a2ef9bcf4727b257c03afe8cc9144f5330954a6865e689751451d337331a7ffb7e482636abd2b79693ce931a0e8fbe0926aeb876246f53d13ce123d232e7a607b25764aa9228bf589de2cbfd34b90a9e4fc1deef35c4b02272d4232d457e188f7a4d6a67cc4089ea16967f4af336c12b899e4753bcc54d96b84231883a8a192c2017180d2b633540ba74d02db34eeff21acfdb339bf106390c37a5d0cd771f18f104d3de6bf2f224fcbe502d03378aa742dff533d57fa9af7d84cadfae6f6c9b750f77b6e2a1545b7a8b3950a90ae11d92f9bed32ffa8c2ce3a36c820ba7d1c9a9be7d04bf17c5d7f725734ed16718b964", 459 | "tag" : "c40fd3bd9ec76df1", 460 | "result" : "valid" 461 | } 462 | ] 463 | } 464 | ] 465 | } 466 | -------------------------------------------------------------------------------- /src/data/siphash_2_4_test.json: -------------------------------------------------------------------------------- 1 | { 2 | "algorithm" : "SipHash-2-4", 3 | "schema" : "mac_test_schema.json", 4 | "generatorVersion" : "0.9", 5 | "numberOfTests" : 40, 6 | "header" : [ 7 | "Test vectors of type MacTest are intended for testing the", 8 | "generation and verification of MACs." 9 | ], 10 | "notes" : { 11 | "Pseudorandom" : { 12 | "bugType" : "FUNCTIONALITY", 13 | "description" : "The test vector contains pseudorandomly generated inputs. The goal of the test vector is to check the correctness of the implementation for various sizes of the input parameters." 14 | } 15 | }, 16 | "testGroups" : [ 17 | { 18 | "type" : "MacTest", 19 | "keySize" : 128, 20 | "tagSize" : 64, 21 | "tests" : [ 22 | { 23 | "tcId" : 1, 24 | "comment" : "empty message", 25 | "flags" : [ 26 | "Pseudorandom" 27 | ], 28 | "key" : "e7ab5e259fe55d624340e495e65a5bf8", 29 | "msg" : "", 30 | "tag" : "885d34ee080998a8", 31 | "result" : "valid" 32 | }, 33 | { 34 | "tcId" : 2, 35 | "comment" : "message of size 1", 36 | "flags" : [ 37 | "Pseudorandom" 38 | ], 39 | "key" : "39ff769700dca7efa13068ad6b850cad", 40 | "msg" : "18", 41 | "tag" : "55a5194f9fccbc03", 42 | "result" : "valid" 43 | }, 44 | { 45 | "tcId" : 3, 46 | "comment" : "message of size 2", 47 | "flags" : [ 48 | "Pseudorandom" 49 | ], 50 | "key" : "791559e5b43a80160111a3de4b3bdc66", 51 | "msg" : "631e", 52 | "tag" : "438edf797af64fcd", 53 | "result" : "valid" 54 | }, 55 | { 56 | "tcId" : 4, 57 | "comment" : "message of size 3", 58 | "flags" : [ 59 | "Pseudorandom" 60 | ], 61 | "key" : "6f81b0c88f7a52f01030135e234f39f9", 62 | "msg" : "bf7a60", 63 | "tag" : "74acaa0e623e21e9", 64 | "result" : "valid" 65 | }, 66 | { 67 | "tcId" : 5, 68 | "comment" : "message of size 4", 69 | "flags" : [ 70 | "Pseudorandom" 71 | ], 72 | "key" : "24af21282debdb841551c01ed769bd11", 73 | "msg" : "5af8a4ef", 74 | "tag" : "364c6ecbcecf28ed", 75 | "result" : "valid" 76 | }, 77 | { 78 | "tcId" : 6, 79 | "comment" : "message of size 5", 80 | "flags" : [ 81 | "Pseudorandom" 82 | ], 83 | "key" : "164c9eaeeaa6ab2c918849b71bb86568", 84 | "msg" : "218fb4190b", 85 | "tag" : "ecdead1ea9e47755", 86 | "result" : "valid" 87 | }, 88 | { 89 | "tcId" : 7, 90 | "comment" : "message of size 6", 91 | "flags" : [ 92 | "Pseudorandom" 93 | ], 94 | "key" : "c9c4ef9502baac5b3c5cce6b674257af", 95 | "msg" : "31739dafe6b5", 96 | "tag" : "e16244f08cfd7fee", 97 | "result" : "valid" 98 | }, 99 | { 100 | "tcId" : 8, 101 | "comment" : "message of size 7", 102 | "flags" : [ 103 | "Pseudorandom" 104 | ], 105 | "key" : "b99a81c6cdb81a3c46cec9c25acae4ba", 106 | "msg" : "336f972681ae4e", 107 | "tag" : "31315e9af018983c", 108 | "result" : "valid" 109 | }, 110 | { 111 | "tcId" : 9, 112 | "comment" : "message of size 8", 113 | "flags" : [ 114 | "Pseudorandom" 115 | ], 116 | "key" : "60d83b209822c0d9b7033dca86444fa1", 117 | "msg" : "313f08031f5cbac1", 118 | "tag" : "1a792693b447bcfa", 119 | "result" : "valid" 120 | }, 121 | { 122 | "tcId" : 10, 123 | "comment" : "message of size 9", 124 | "flags" : [ 125 | "Pseudorandom" 126 | ], 127 | "key" : "38a6b9348d8171f4eccb30a39f8c89f8", 128 | "msg" : "05483d1ecaa94d4517", 129 | "tag" : "6533ea02e791e535", 130 | "result" : "valid" 131 | }, 132 | { 133 | "tcId" : 11, 134 | "comment" : "message of size 10", 135 | "flags" : [ 136 | "Pseudorandom" 137 | ], 138 | "key" : "08fe43f39652ccfc0b078b38ee764c47", 139 | "msg" : "909d45d3a8c0f4cdf478", 140 | "tag" : "7939947c565f8e20", 141 | "result" : "valid" 142 | }, 143 | { 144 | "tcId" : 12, 145 | "comment" : "message of size 11", 146 | "flags" : [ 147 | "Pseudorandom" 148 | ], 149 | "key" : "e560a68599f285389fd65627a6b868a5", 150 | "msg" : "ccdb1073bdcf88cc6ccd8b", 151 | "tag" : "3c2d5a24aeca6976", 152 | "result" : "valid" 153 | }, 154 | { 155 | "tcId" : 13, 156 | "comment" : "message of size 12", 157 | "flags" : [ 158 | "Pseudorandom" 159 | ], 160 | "key" : "375359717d335416d6c775ca9e9fafe3", 161 | "msg" : "4514fe4c2ea3bc7deb357bb9", 162 | "tag" : "de85625d793bc9fd", 163 | "result" : "valid" 164 | }, 165 | { 166 | "tcId" : 14, 167 | "comment" : "message of size 13", 168 | "flags" : [ 169 | "Pseudorandom" 170 | ], 171 | "key" : "6be83b26128a43fb268f46122dad822f", 172 | "msg" : "f95f5f9a363f187872e3a0a6e6", 173 | "tag" : "f4f3ff1bec4a7be9", 174 | "result" : "valid" 175 | }, 176 | { 177 | "tcId" : 15, 178 | "comment" : "message of size 14", 179 | "flags" : [ 180 | "Pseudorandom" 181 | ], 182 | "key" : "7760e343976382fb554cea2f57541a65", 183 | "msg" : "63195f4a709f87bd590aa92785bc", 184 | "tag" : "6abe6a200d92bb56", 185 | "result" : "valid" 186 | }, 187 | { 188 | "tcId" : 16, 189 | "comment" : "message of size 15", 190 | "flags" : [ 191 | "Pseudorandom" 192 | ], 193 | "key" : "3136256d64252e345d1eb85e9a6830de", 194 | "msg" : "7f91c709a56ac82a8d589c7fe470bc", 195 | "tag" : "fd367bf27b59b14a", 196 | "result" : "valid" 197 | }, 198 | { 199 | "tcId" : 17, 200 | "comment" : "message of size 16", 201 | "flags" : [ 202 | "Pseudorandom" 203 | ], 204 | "key" : "e7b9a8e55075013d75ab1903e9f908c9", 205 | "msg" : "1dbd54754bd61f8c21c12a89cc8d249a", 206 | "tag" : "616edaebe256543b", 207 | "result" : "valid" 208 | }, 209 | { 210 | "tcId" : 18, 211 | "comment" : "message of size 17", 212 | "flags" : [ 213 | "Pseudorandom" 214 | ], 215 | "key" : "c6cf618428b01827950262d03e594a22", 216 | "msg" : "421197abce28abfdfaaeaf4768ca115714", 217 | "tag" : "a0931dd2ea19ba1f", 218 | "result" : "valid" 219 | }, 220 | { 221 | "tcId" : 19, 222 | "comment" : "message of size 18", 223 | "flags" : [ 224 | "Pseudorandom" 225 | ], 226 | "key" : "4eb4a980bbda3a4f33b81da3c8453e2f", 227 | "msg" : "127c457dfb9949454bafcc48b59f7a762c02", 228 | "tag" : "6d341b8c9dcef121", 229 | "result" : "valid" 230 | }, 231 | { 232 | "tcId" : 20, 233 | "comment" : "message of size 19", 234 | "flags" : [ 235 | "Pseudorandom" 236 | ], 237 | "key" : "20bdbad57cdab091fb5d3129f2a8007f", 238 | "msg" : "da9abcc47b5e9e685e20009f3a52b2df16f16a", 239 | "tag" : "47ce3223e9cc6cf6", 240 | "result" : "valid" 241 | }, 242 | { 243 | "tcId" : 21, 244 | "comment" : "message of size 20", 245 | "flags" : [ 246 | "Pseudorandom" 247 | ], 248 | "key" : "7d43babbb3c9b3948b742e15fa8f5f9e", 249 | "msg" : "7fd4d1b88620df21190345dd4374cc1db9ae355e", 250 | "tag" : "10d3f87f2fff30ca", 251 | "result" : "valid" 252 | }, 253 | { 254 | "tcId" : 22, 255 | "comment" : "message of size 21", 256 | "flags" : [ 257 | "Pseudorandom" 258 | ], 259 | "key" : "22233d8a6eb04f69819a21101dfb4405", 260 | "msg" : "4635bb2072df00569418eabb622a9024a18fb85fe5", 261 | "tag" : "9673eb7195d9837b", 262 | "result" : "valid" 263 | }, 264 | { 265 | "tcId" : 23, 266 | "comment" : "message of size 22", 267 | "flags" : [ 268 | "Pseudorandom" 269 | ], 270 | "key" : "d12a6dc91d2c82a283fb0f8b70bd1421", 271 | "msg" : "131ca64d0b70bc3fc14a0be1067a81246cf0be65d28d", 272 | "tag" : "50d1e7be26f1f254", 273 | "result" : "valid" 274 | }, 275 | { 276 | "tcId" : 24, 277 | "comment" : "message of size 23", 278 | "flags" : [ 279 | "Pseudorandom" 280 | ], 281 | "key" : "8ae19160b02da292582542ea44c5a350", 282 | "msg" : "45f7bad0cc6a1a2b266301cd0d73f1073507600ad236d6", 283 | "tag" : "27ad207a71a6f4e5", 284 | "result" : "valid" 285 | }, 286 | { 287 | "tcId" : 25, 288 | "comment" : "message of size 24", 289 | "flags" : [ 290 | "Pseudorandom" 291 | ], 292 | "key" : "6c2e323b3e2f5d321a326cfc00af3f96", 293 | "msg" : "e008b3b953f8a799d25e632571efe6308ffcfbef6e914e7f", 294 | "tag" : "aec2a310a6f4da2e", 295 | "result" : "valid" 296 | }, 297 | { 298 | "tcId" : 26, 299 | "comment" : "message of size 25", 300 | "flags" : [ 301 | "Pseudorandom" 302 | ], 303 | "key" : "2c618ab2c505e778969c4f0b6f2c46de", 304 | "msg" : "646d2ef9bad00c2e0d170435e48c522857ac156059c40841fe", 305 | "tag" : "db5edbc6aeea2616", 306 | "result" : "valid" 307 | }, 308 | { 309 | "tcId" : 27, 310 | "comment" : "message of size 26", 311 | "flags" : [ 312 | "Pseudorandom" 313 | ], 314 | "key" : "0c8d0d9d247b12ec944a5405ab475d59", 315 | "msg" : "a43724603213c33ba163776fb78ae1204994df29026ce7a3fb90", 316 | "tag" : "96d603cd5b4d2f5c", 317 | "result" : "valid" 318 | }, 319 | { 320 | "tcId" : 28, 321 | "comment" : "message of size 27", 322 | "flags" : [ 323 | "Pseudorandom" 324 | ], 325 | "key" : "a79cdb6c660cd7b1784691e25ef99b27", 326 | "msg" : "59922d991b79858b937882c3ea4a94af9cc4abff8a9e50972069bb", 327 | "tag" : "2ca96022dc681345", 328 | "result" : "valid" 329 | }, 330 | { 331 | "tcId" : 29, 332 | "comment" : "message of size 28", 333 | "flags" : [ 334 | "Pseudorandom" 335 | ], 336 | "key" : "3a396b9539aed0ce205f96914e3fe36f", 337 | "msg" : "1dc6e025954ec66feae6007f1bd469038b3ec5f8dbc17de5065b99ef", 338 | "tag" : "fa9bf0f6b0f84504", 339 | "result" : "valid" 340 | }, 341 | { 342 | "tcId" : 30, 343 | "comment" : "message of size 29", 344 | "flags" : [ 345 | "Pseudorandom" 346 | ], 347 | "key" : "81ba6ab86e4059ffddaa269a0b906b08", 348 | "msg" : "05350b55441488d4f63587300ab59a0338b3eab412236ef66991335b7a", 349 | "tag" : "aa27211372e45ebc", 350 | "result" : "valid" 351 | }, 352 | { 353 | "tcId" : 31, 354 | "comment" : "message of size 30", 355 | "flags" : [ 356 | "Pseudorandom" 357 | ], 358 | "key" : "f552f7a0f2efa9185e4e1eafbac67c0f", 359 | "msg" : "358deda495269a59b598799afce3b5aae84669bcf5c8299aebad99096bca", 360 | "tag" : "1b5a5e9d2d8d3d7d", 361 | "result" : "valid" 362 | }, 363 | { 364 | "tcId" : 32, 365 | "comment" : "message of size 31", 366 | "flags" : [ 367 | "Pseudorandom" 368 | ], 369 | "key" : "4fbe64bbb7ec7bef3d97855dc3572abf", 370 | "msg" : "24ab15969137dd15e89bb513927c5c4b72c2680e22b8a1062bc9f6e6e3946b", 371 | "tag" : "606880c2e710e43e", 372 | "result" : "valid" 373 | }, 374 | { 375 | "tcId" : 33, 376 | "comment" : "message of size 32", 377 | "flags" : [ 378 | "Pseudorandom" 379 | ], 380 | "key" : "fd64738a57136b746fbd4fa787898150", 381 | "msg" : "cc8c537b498b7dc05e50058ac060d459138119a076f5a36fb470902dc7152839", 382 | "tag" : "34705cc15b989c61", 383 | "result" : "valid" 384 | }, 385 | { 386 | "tcId" : 34, 387 | "comment" : "message of size 47", 388 | "flags" : [ 389 | "Pseudorandom" 390 | ], 391 | "key" : "a691c5d8b6006cb391633397d7e82cd5", 392 | "msg" : "0bdd246e199cd46b799854c2db7670fbb25dde09bc3f4fe74fac7629448a5b3b31e458510ccfe8552edcb540e51866", 393 | "tag" : "3232ba486a763968", 394 | "result" : "valid" 395 | }, 396 | { 397 | "tcId" : 35, 398 | "comment" : "message of size 48", 399 | "flags" : [ 400 | "Pseudorandom" 401 | ], 402 | "key" : "fcddec49fd82ca652102060dc0788afe", 403 | "msg" : "dbda9f58f337da7d031ad9e50e48ad161fde9eaa39cc10551ed8ff1dae160e18594864adc53ff56a4fc19f6dfe59b7c3", 404 | "tag" : "fda7f95ac2960085", 405 | "result" : "valid" 406 | }, 407 | { 408 | "tcId" : 36, 409 | "comment" : "message of size 49", 410 | "flags" : [ 411 | "Pseudorandom" 412 | ], 413 | "key" : "885c1340266f4bc4b86eab570f018cb2", 414 | "msg" : "372a8ab6495798b43b33c0998ec1f8b714298cf820d78dd9b6a6aad1a10002b66c6b8437097edfce06527519c2ba682478", 415 | "tag" : "04fef834a87d1b2d", 416 | "result" : "valid" 417 | }, 418 | { 419 | "tcId" : 37, 420 | "comment" : "message of size 112", 421 | "flags" : [ 422 | "Pseudorandom" 423 | ], 424 | "key" : "7bf32df7deb7fc458b4615eba9194b51", 425 | "msg" : "37a14c4007c81b9843b4cce7b916ee477674098e4fd3aa2ea9eab9418d98c063076f50274352e16963b46a0c58631d5fd4928c96faae66ef24bf86c9ac117dbe8f73c5b51a18a6b4306688cb6199d9cb8e44b564f3ef3c4f9e977ca2c2c4c603a228310231a1cf4a30032e1945520f8c", 426 | "tag" : "22da186add89e052", 427 | "result" : "valid" 428 | }, 429 | { 430 | "tcId" : 38, 431 | "comment" : "message of size 127", 432 | "flags" : [ 433 | "Pseudorandom" 434 | ], 435 | "key" : "4f9af4aea55dee3986bd307d2dee0fce", 436 | "msg" : "b9b4c59c50f3324f71af4acc6b827f2b057ddf6e66c71f33694b3b3aa113892644dfa3b2516185c3ab7123a95c9cbccee30264e099748a85ee79b4b672ba1fd92c48774f0edbfcd078a47152319c53293adf75787b9fa7e21caa30a3a67d647134171adf122589a47eed56d79a592b009c8266367ff3cf73c23dce7644bafa", 437 | "tag" : "e96527127726edbf", 438 | "result" : "valid" 439 | }, 440 | { 441 | "tcId" : 39, 442 | "comment" : "message of size 128", 443 | "flags" : [ 444 | "Pseudorandom" 445 | ], 446 | "key" : "54723c003cd0bd022b2d23bb1e63a97b", 447 | "msg" : "3791e7d4dfa8e5c053eaf1e418f1f3b79e5958a0a85a6f56e6c193cbbd87d901df8144072fedb6f29558480ad23730c17cf28b026a8da6a45cf244af084e40779ba44d261f5420ecc7e3178f6ab7d64e68b6dff827cde7b536d8cd94970323db5473edc169e888cff3e87ea1af1ae409c795f9543496ce82e8ac534a379e0ea0", 448 | "tag" : "85dac1d38e6ea28e", 449 | "result" : "valid" 450 | }, 451 | { 452 | "tcId" : 40, 453 | "comment" : "message of size 255", 454 | "flags" : [ 455 | "Pseudorandom" 456 | ], 457 | "key" : "8176e2511297b5def9952571b272c454", 458 | "msg" : "4c408fd246885cf6a2f5935837a6a2ef9bcf4727b257c03afe8cc9144f5330954a6865e689751451d337331a7ffb7e482636abd2b79693ce931a0e8fbe0926aeb876246f53d13ce123d232e7a607b25764aa9228bf589de2cbfd34b90a9e4fc1deef35c4b02272d4232d457e188f7a4d6a67cc4089ea16967f4af336c12b899e4753bcc54d96b84231883a8a192c2017180d2b633540ba74d02db34eeff21acfdb339bf106390c37a5d0cd771f18f104d3de6bf2f224fcbe502d03378aa742dff533d57fa9af7d84cadfae6f6c9b750f77b6e2a1545b7a8b3950a90ae11d92f9bed32ffa8c2ce3a36c820ba7d1c9a9be7d04bf17c5d7f725734ed16718b964", 459 | "tag" : "a0cfd51cecbf80dc", 460 | "result" : "valid" 461 | } 462 | ] 463 | } 464 | ] 465 | } 466 | -------------------------------------------------------------------------------- /src/data/siphash_4_8_test.json: -------------------------------------------------------------------------------- 1 | { 2 | "algorithm" : "SipHash-4-8", 3 | "schema" : "mac_test_schema.json", 4 | "generatorVersion" : "0.9", 5 | "numberOfTests" : 40, 6 | "header" : [ 7 | "Test vectors of type MacTest are intended for testing the", 8 | "generation and verification of MACs." 9 | ], 10 | "notes" : { 11 | "Pseudorandom" : { 12 | "bugType" : "FUNCTIONALITY", 13 | "description" : "The test vector contains pseudorandomly generated inputs. The goal of the test vector is to check the correctness of the implementation for various sizes of the input parameters." 14 | } 15 | }, 16 | "testGroups" : [ 17 | { 18 | "type" : "MacTest", 19 | "keySize" : 128, 20 | "tagSize" : 64, 21 | "tests" : [ 22 | { 23 | "tcId" : 1, 24 | "comment" : "empty message", 25 | "flags" : [ 26 | "Pseudorandom" 27 | ], 28 | "key" : "e7ab5e259fe55d624340e495e65a5bf8", 29 | "msg" : "", 30 | "tag" : "6c1dfa47ef16a260", 31 | "result" : "valid" 32 | }, 33 | { 34 | "tcId" : 2, 35 | "comment" : "message of size 1", 36 | "flags" : [ 37 | "Pseudorandom" 38 | ], 39 | "key" : "39ff769700dca7efa13068ad6b850cad", 40 | "msg" : "18", 41 | "tag" : "dfccff4697ff445b", 42 | "result" : "valid" 43 | }, 44 | { 45 | "tcId" : 3, 46 | "comment" : "message of size 2", 47 | "flags" : [ 48 | "Pseudorandom" 49 | ], 50 | "key" : "791559e5b43a80160111a3de4b3bdc66", 51 | "msg" : "631e", 52 | "tag" : "90540543acb8d224", 53 | "result" : "valid" 54 | }, 55 | { 56 | "tcId" : 4, 57 | "comment" : "message of size 3", 58 | "flags" : [ 59 | "Pseudorandom" 60 | ], 61 | "key" : "6f81b0c88f7a52f01030135e234f39f9", 62 | "msg" : "bf7a60", 63 | "tag" : "8123eb39d2e75ed0", 64 | "result" : "valid" 65 | }, 66 | { 67 | "tcId" : 5, 68 | "comment" : "message of size 4", 69 | "flags" : [ 70 | "Pseudorandom" 71 | ], 72 | "key" : "24af21282debdb841551c01ed769bd11", 73 | "msg" : "5af8a4ef", 74 | "tag" : "1e89c85f2b683e87", 75 | "result" : "valid" 76 | }, 77 | { 78 | "tcId" : 6, 79 | "comment" : "message of size 5", 80 | "flags" : [ 81 | "Pseudorandom" 82 | ], 83 | "key" : "164c9eaeeaa6ab2c918849b71bb86568", 84 | "msg" : "218fb4190b", 85 | "tag" : "816582cd8ec30eec", 86 | "result" : "valid" 87 | }, 88 | { 89 | "tcId" : 7, 90 | "comment" : "message of size 6", 91 | "flags" : [ 92 | "Pseudorandom" 93 | ], 94 | "key" : "c9c4ef9502baac5b3c5cce6b674257af", 95 | "msg" : "31739dafe6b5", 96 | "tag" : "9c4b1e54d99ddfae", 97 | "result" : "valid" 98 | }, 99 | { 100 | "tcId" : 8, 101 | "comment" : "message of size 7", 102 | "flags" : [ 103 | "Pseudorandom" 104 | ], 105 | "key" : "b99a81c6cdb81a3c46cec9c25acae4ba", 106 | "msg" : "336f972681ae4e", 107 | "tag" : "a15354f111078dda", 108 | "result" : "valid" 109 | }, 110 | { 111 | "tcId" : 9, 112 | "comment" : "message of size 8", 113 | "flags" : [ 114 | "Pseudorandom" 115 | ], 116 | "key" : "60d83b209822c0d9b7033dca86444fa1", 117 | "msg" : "313f08031f5cbac1", 118 | "tag" : "e9187dca8e902337", 119 | "result" : "valid" 120 | }, 121 | { 122 | "tcId" : 10, 123 | "comment" : "message of size 9", 124 | "flags" : [ 125 | "Pseudorandom" 126 | ], 127 | "key" : "38a6b9348d8171f4eccb30a39f8c89f8", 128 | "msg" : "05483d1ecaa94d4517", 129 | "tag" : "52581ea86a2444d5", 130 | "result" : "valid" 131 | }, 132 | { 133 | "tcId" : 11, 134 | "comment" : "message of size 10", 135 | "flags" : [ 136 | "Pseudorandom" 137 | ], 138 | "key" : "08fe43f39652ccfc0b078b38ee764c47", 139 | "msg" : "909d45d3a8c0f4cdf478", 140 | "tag" : "5715a8256d044e65", 141 | "result" : "valid" 142 | }, 143 | { 144 | "tcId" : 12, 145 | "comment" : "message of size 11", 146 | "flags" : [ 147 | "Pseudorandom" 148 | ], 149 | "key" : "e560a68599f285389fd65627a6b868a5", 150 | "msg" : "ccdb1073bdcf88cc6ccd8b", 151 | "tag" : "f825d45d5ad55b68", 152 | "result" : "valid" 153 | }, 154 | { 155 | "tcId" : 13, 156 | "comment" : "message of size 12", 157 | "flags" : [ 158 | "Pseudorandom" 159 | ], 160 | "key" : "375359717d335416d6c775ca9e9fafe3", 161 | "msg" : "4514fe4c2ea3bc7deb357bb9", 162 | "tag" : "f0217a273e86249a", 163 | "result" : "valid" 164 | }, 165 | { 166 | "tcId" : 14, 167 | "comment" : "message of size 13", 168 | "flags" : [ 169 | "Pseudorandom" 170 | ], 171 | "key" : "6be83b26128a43fb268f46122dad822f", 172 | "msg" : "f95f5f9a363f187872e3a0a6e6", 173 | "tag" : "aa27f2a87486311d", 174 | "result" : "valid" 175 | }, 176 | { 177 | "tcId" : 15, 178 | "comment" : "message of size 14", 179 | "flags" : [ 180 | "Pseudorandom" 181 | ], 182 | "key" : "7760e343976382fb554cea2f57541a65", 183 | "msg" : "63195f4a709f87bd590aa92785bc", 184 | "tag" : "b4c7076a4d6ceb69", 185 | "result" : "valid" 186 | }, 187 | { 188 | "tcId" : 16, 189 | "comment" : "message of size 15", 190 | "flags" : [ 191 | "Pseudorandom" 192 | ], 193 | "key" : "3136256d64252e345d1eb85e9a6830de", 194 | "msg" : "7f91c709a56ac82a8d589c7fe470bc", 195 | "tag" : "c2753344c452365a", 196 | "result" : "valid" 197 | }, 198 | { 199 | "tcId" : 17, 200 | "comment" : "message of size 16", 201 | "flags" : [ 202 | "Pseudorandom" 203 | ], 204 | "key" : "e7b9a8e55075013d75ab1903e9f908c9", 205 | "msg" : "1dbd54754bd61f8c21c12a89cc8d249a", 206 | "tag" : "93cc3389156195fd", 207 | "result" : "valid" 208 | }, 209 | { 210 | "tcId" : 18, 211 | "comment" : "message of size 17", 212 | "flags" : [ 213 | "Pseudorandom" 214 | ], 215 | "key" : "c6cf618428b01827950262d03e594a22", 216 | "msg" : "421197abce28abfdfaaeaf4768ca115714", 217 | "tag" : "878144d1c076de9a", 218 | "result" : "valid" 219 | }, 220 | { 221 | "tcId" : 19, 222 | "comment" : "message of size 18", 223 | "flags" : [ 224 | "Pseudorandom" 225 | ], 226 | "key" : "4eb4a980bbda3a4f33b81da3c8453e2f", 227 | "msg" : "127c457dfb9949454bafcc48b59f7a762c02", 228 | "tag" : "f623d1f6f5c411b6", 229 | "result" : "valid" 230 | }, 231 | { 232 | "tcId" : 20, 233 | "comment" : "message of size 19", 234 | "flags" : [ 235 | "Pseudorandom" 236 | ], 237 | "key" : "20bdbad57cdab091fb5d3129f2a8007f", 238 | "msg" : "da9abcc47b5e9e685e20009f3a52b2df16f16a", 239 | "tag" : "b1338445d62dd368", 240 | "result" : "valid" 241 | }, 242 | { 243 | "tcId" : 21, 244 | "comment" : "message of size 20", 245 | "flags" : [ 246 | "Pseudorandom" 247 | ], 248 | "key" : "7d43babbb3c9b3948b742e15fa8f5f9e", 249 | "msg" : "7fd4d1b88620df21190345dd4374cc1db9ae355e", 250 | "tag" : "30f7198f5083f47d", 251 | "result" : "valid" 252 | }, 253 | { 254 | "tcId" : 22, 255 | "comment" : "message of size 21", 256 | "flags" : [ 257 | "Pseudorandom" 258 | ], 259 | "key" : "22233d8a6eb04f69819a21101dfb4405", 260 | "msg" : "4635bb2072df00569418eabb622a9024a18fb85fe5", 261 | "tag" : "019ee1c2ba2b44ed", 262 | "result" : "valid" 263 | }, 264 | { 265 | "tcId" : 23, 266 | "comment" : "message of size 22", 267 | "flags" : [ 268 | "Pseudorandom" 269 | ], 270 | "key" : "d12a6dc91d2c82a283fb0f8b70bd1421", 271 | "msg" : "131ca64d0b70bc3fc14a0be1067a81246cf0be65d28d", 272 | "tag" : "128748749dcecbf5", 273 | "result" : "valid" 274 | }, 275 | { 276 | "tcId" : 24, 277 | "comment" : "message of size 23", 278 | "flags" : [ 279 | "Pseudorandom" 280 | ], 281 | "key" : "8ae19160b02da292582542ea44c5a350", 282 | "msg" : "45f7bad0cc6a1a2b266301cd0d73f1073507600ad236d6", 283 | "tag" : "cc862dcd5dfe67aa", 284 | "result" : "valid" 285 | }, 286 | { 287 | "tcId" : 25, 288 | "comment" : "message of size 24", 289 | "flags" : [ 290 | "Pseudorandom" 291 | ], 292 | "key" : "6c2e323b3e2f5d321a326cfc00af3f96", 293 | "msg" : "e008b3b953f8a799d25e632571efe6308ffcfbef6e914e7f", 294 | "tag" : "66d3c39361268b93", 295 | "result" : "valid" 296 | }, 297 | { 298 | "tcId" : 26, 299 | "comment" : "message of size 25", 300 | "flags" : [ 301 | "Pseudorandom" 302 | ], 303 | "key" : "2c618ab2c505e778969c4f0b6f2c46de", 304 | "msg" : "646d2ef9bad00c2e0d170435e48c522857ac156059c40841fe", 305 | "tag" : "e0b379787514f923", 306 | "result" : "valid" 307 | }, 308 | { 309 | "tcId" : 27, 310 | "comment" : "message of size 26", 311 | "flags" : [ 312 | "Pseudorandom" 313 | ], 314 | "key" : "0c8d0d9d247b12ec944a5405ab475d59", 315 | "msg" : "a43724603213c33ba163776fb78ae1204994df29026ce7a3fb90", 316 | "tag" : "9f0ac9580f5aa91f", 317 | "result" : "valid" 318 | }, 319 | { 320 | "tcId" : 28, 321 | "comment" : "message of size 27", 322 | "flags" : [ 323 | "Pseudorandom" 324 | ], 325 | "key" : "a79cdb6c660cd7b1784691e25ef99b27", 326 | "msg" : "59922d991b79858b937882c3ea4a94af9cc4abff8a9e50972069bb", 327 | "tag" : "1129f3a9f2c47e4e", 328 | "result" : "valid" 329 | }, 330 | { 331 | "tcId" : 29, 332 | "comment" : "message of size 28", 333 | "flags" : [ 334 | "Pseudorandom" 335 | ], 336 | "key" : "3a396b9539aed0ce205f96914e3fe36f", 337 | "msg" : "1dc6e025954ec66feae6007f1bd469038b3ec5f8dbc17de5065b99ef", 338 | "tag" : "594b26b237fc60da", 339 | "result" : "valid" 340 | }, 341 | { 342 | "tcId" : 30, 343 | "comment" : "message of size 29", 344 | "flags" : [ 345 | "Pseudorandom" 346 | ], 347 | "key" : "81ba6ab86e4059ffddaa269a0b906b08", 348 | "msg" : "05350b55441488d4f63587300ab59a0338b3eab412236ef66991335b7a", 349 | "tag" : "537cb0a1a98db6d0", 350 | "result" : "valid" 351 | }, 352 | { 353 | "tcId" : 31, 354 | "comment" : "message of size 30", 355 | "flags" : [ 356 | "Pseudorandom" 357 | ], 358 | "key" : "f552f7a0f2efa9185e4e1eafbac67c0f", 359 | "msg" : "358deda495269a59b598799afce3b5aae84669bcf5c8299aebad99096bca", 360 | "tag" : "ede56bab996f53d2", 361 | "result" : "valid" 362 | }, 363 | { 364 | "tcId" : 32, 365 | "comment" : "message of size 31", 366 | "flags" : [ 367 | "Pseudorandom" 368 | ], 369 | "key" : "4fbe64bbb7ec7bef3d97855dc3572abf", 370 | "msg" : "24ab15969137dd15e89bb513927c5c4b72c2680e22b8a1062bc9f6e6e3946b", 371 | "tag" : "1a2bdacf9a543d18", 372 | "result" : "valid" 373 | }, 374 | { 375 | "tcId" : 33, 376 | "comment" : "message of size 32", 377 | "flags" : [ 378 | "Pseudorandom" 379 | ], 380 | "key" : "fd64738a57136b746fbd4fa787898150", 381 | "msg" : "cc8c537b498b7dc05e50058ac060d459138119a076f5a36fb470902dc7152839", 382 | "tag" : "0238e2334c41b697", 383 | "result" : "valid" 384 | }, 385 | { 386 | "tcId" : 34, 387 | "comment" : "message of size 47", 388 | "flags" : [ 389 | "Pseudorandom" 390 | ], 391 | "key" : "a691c5d8b6006cb391633397d7e82cd5", 392 | "msg" : "0bdd246e199cd46b799854c2db7670fbb25dde09bc3f4fe74fac7629448a5b3b31e458510ccfe8552edcb540e51866", 393 | "tag" : "897483d7ad9f9100", 394 | "result" : "valid" 395 | }, 396 | { 397 | "tcId" : 35, 398 | "comment" : "message of size 48", 399 | "flags" : [ 400 | "Pseudorandom" 401 | ], 402 | "key" : "fcddec49fd82ca652102060dc0788afe", 403 | "msg" : "dbda9f58f337da7d031ad9e50e48ad161fde9eaa39cc10551ed8ff1dae160e18594864adc53ff56a4fc19f6dfe59b7c3", 404 | "tag" : "ed84fd5e2ba03cf4", 405 | "result" : "valid" 406 | }, 407 | { 408 | "tcId" : 36, 409 | "comment" : "message of size 49", 410 | "flags" : [ 411 | "Pseudorandom" 412 | ], 413 | "key" : "885c1340266f4bc4b86eab570f018cb2", 414 | "msg" : "372a8ab6495798b43b33c0998ec1f8b714298cf820d78dd9b6a6aad1a10002b66c6b8437097edfce06527519c2ba682478", 415 | "tag" : "158006f0ef5b63d8", 416 | "result" : "valid" 417 | }, 418 | { 419 | "tcId" : 37, 420 | "comment" : "message of size 112", 421 | "flags" : [ 422 | "Pseudorandom" 423 | ], 424 | "key" : "7bf32df7deb7fc458b4615eba9194b51", 425 | "msg" : "37a14c4007c81b9843b4cce7b916ee477674098e4fd3aa2ea9eab9418d98c063076f50274352e16963b46a0c58631d5fd4928c96faae66ef24bf86c9ac117dbe8f73c5b51a18a6b4306688cb6199d9cb8e44b564f3ef3c4f9e977ca2c2c4c603a228310231a1cf4a30032e1945520f8c", 426 | "tag" : "6730f83681fc2fc7", 427 | "result" : "valid" 428 | }, 429 | { 430 | "tcId" : 38, 431 | "comment" : "message of size 127", 432 | "flags" : [ 433 | "Pseudorandom" 434 | ], 435 | "key" : "4f9af4aea55dee3986bd307d2dee0fce", 436 | "msg" : "b9b4c59c50f3324f71af4acc6b827f2b057ddf6e66c71f33694b3b3aa113892644dfa3b2516185c3ab7123a95c9cbccee30264e099748a85ee79b4b672ba1fd92c48774f0edbfcd078a47152319c53293adf75787b9fa7e21caa30a3a67d647134171adf122589a47eed56d79a592b009c8266367ff3cf73c23dce7644bafa", 437 | "tag" : "1a5def0b8955926d", 438 | "result" : "valid" 439 | }, 440 | { 441 | "tcId" : 39, 442 | "comment" : "message of size 128", 443 | "flags" : [ 444 | "Pseudorandom" 445 | ], 446 | "key" : "54723c003cd0bd022b2d23bb1e63a97b", 447 | "msg" : "3791e7d4dfa8e5c053eaf1e418f1f3b79e5958a0a85a6f56e6c193cbbd87d901df8144072fedb6f29558480ad23730c17cf28b026a8da6a45cf244af084e40779ba44d261f5420ecc7e3178f6ab7d64e68b6dff827cde7b536d8cd94970323db5473edc169e888cff3e87ea1af1ae409c795f9543496ce82e8ac534a379e0ea0", 448 | "tag" : "a89bc6cb37945d37", 449 | "result" : "valid" 450 | }, 451 | { 452 | "tcId" : 40, 453 | "comment" : "message of size 255", 454 | "flags" : [ 455 | "Pseudorandom" 456 | ], 457 | "key" : "8176e2511297b5def9952571b272c454", 458 | "msg" : "4c408fd246885cf6a2f5935837a6a2ef9bcf4727b257c03afe8cc9144f5330954a6865e689751451d337331a7ffb7e482636abd2b79693ce931a0e8fbe0926aeb876246f53d13ce123d232e7a607b25764aa9228bf589de2cbfd34b90a9e4fc1deef35c4b02272d4232d457e188f7a4d6a67cc4089ea16967f4af336c12b899e4753bcc54d96b84231883a8a192c2017180d2b633540ba74d02db34eeff21acfdb339bf106390c37a5d0cd771f18f104d3de6bf2f224fcbe502d03378aa742dff533d57fa9af7d84cadfae6f6c9b750f77b6e2a1545b7a8b3950a90ae11d92f9bed32ffa8c2ce3a36c820ba7d1c9a9be7d04bf17c5d7f725734ed16718b964", 459 | "tag" : "774ef02edb7860f2", 460 | "result" : "valid" 461 | } 462 | ] 463 | } 464 | ] 465 | } 466 | -------------------------------------------------------------------------------- /src/data/siphashx_2_4_test.json: -------------------------------------------------------------------------------- 1 | { 2 | "algorithm" : "SipHashX-2-4", 3 | "schema" : "mac_test_schema.json", 4 | "generatorVersion" : "0.9", 5 | "numberOfTests" : 40, 6 | "header" : [ 7 | "Test vectors of type MacTest are intended for testing the", 8 | "generation and verification of MACs." 9 | ], 10 | "notes" : { 11 | "Pseudorandom" : { 12 | "bugType" : "FUNCTIONALITY", 13 | "description" : "The test vector contains pseudorandomly generated inputs. The goal of the test vector is to check the correctness of the implementation for various sizes of the input parameters." 14 | } 15 | }, 16 | "testGroups" : [ 17 | { 18 | "type" : "MacTest", 19 | "keySize" : 128, 20 | "tagSize" : 128, 21 | "tests" : [ 22 | { 23 | "tcId" : 1, 24 | "comment" : "empty message", 25 | "flags" : [ 26 | "Pseudorandom" 27 | ], 28 | "key" : "e34f15c7bd819930fe9d66e0c166e61c", 29 | "msg" : "", 30 | "tag" : "b3d2df1f8506643dc8f803a3ceb67f85", 31 | "result" : "valid" 32 | }, 33 | { 34 | "tcId" : 2, 35 | "comment" : "message of size 1", 36 | "flags" : [ 37 | "Pseudorandom" 38 | ], 39 | "key" : "e1e726677f4893890f8c027f9d8ef80d", 40 | "msg" : "3f", 41 | "tag" : "9ac688c897badab5da5147644d784f5c", 42 | "result" : "valid" 43 | }, 44 | { 45 | "tcId" : 3, 46 | "comment" : "message of size 2", 47 | "flags" : [ 48 | "Pseudorandom" 49 | ], 50 | "key" : "b151f491c4c006d1f28214aa3da9a985", 51 | "msg" : "27d9", 52 | "tag" : "145c909f67e201328433fe5549870600", 53 | "result" : "valid" 54 | }, 55 | { 56 | "tcId" : 4, 57 | "comment" : "message of size 3", 58 | "flags" : [ 59 | "Pseudorandom" 60 | ], 61 | "key" : "c36ff15f72777ee21deec07b63c1a0cd", 62 | "msg" : "50b428", 63 | "tag" : "4b1dcaa912e57a3856efa222c4ad9c3f", 64 | "result" : "valid" 65 | }, 66 | { 67 | "tcId" : 5, 68 | "comment" : "message of size 4", 69 | "flags" : [ 70 | "Pseudorandom" 71 | ], 72 | "key" : "32b9c5c78c3a0689a86052420fa1e8fc", 73 | "msg" : "0b9262ec", 74 | "tag" : "1e6370981c7de37fbada7c6534ecd6b5", 75 | "result" : "valid" 76 | }, 77 | { 78 | "tcId" : 6, 79 | "comment" : "message of size 5", 80 | "flags" : [ 81 | "Pseudorandom" 82 | ], 83 | "key" : "43151bbaef367277ebfc97509d0aa49c", 84 | "msg" : "eaa91273e7", 85 | "tag" : "02297caec766ab940a4cbab0259e641b", 86 | "result" : "valid" 87 | }, 88 | { 89 | "tcId" : 7, 90 | "comment" : "message of size 6", 91 | "flags" : [ 92 | "Pseudorandom" 93 | ], 94 | "key" : "481440298525cc261f8159159aedf62d", 95 | "msg" : "6123c556c5cc", 96 | "tag" : "97bd8df18e79be10d7b79a890c974d65", 97 | "result" : "valid" 98 | }, 99 | { 100 | "tcId" : 8, 101 | "comment" : "message of size 7", 102 | "flags" : [ 103 | "Pseudorandom" 104 | ], 105 | "key" : "9ca26eb88731efbf7f810d5d95e196ac", 106 | "msg" : "7e48f06183aa40", 107 | "tag" : "24a83dbf58b74719bf6e3a4e0f1edea5", 108 | "result" : "valid" 109 | }, 110 | { 111 | "tcId" : 9, 112 | "comment" : "message of size 8", 113 | "flags" : [ 114 | "Pseudorandom" 115 | ], 116 | "key" : "48f0d03e41cc55c4b58f737b5acdea32", 117 | "msg" : "f4a133aa6d5985a0", 118 | "tag" : "55e2158e99bf71c15b1104525980b25e", 119 | "result" : "valid" 120 | }, 121 | { 122 | "tcId" : 10, 123 | "comment" : "message of size 9", 124 | "flags" : [ 125 | "Pseudorandom" 126 | ], 127 | "key" : "1c958849f31996b28939ce513087d1be", 128 | "msg" : "b0d2fee11b8e2f86b7", 129 | "tag" : "63d5e3fe671187cad470085bb0396326", 130 | "result" : "valid" 131 | }, 132 | { 133 | "tcId" : 11, 134 | "comment" : "message of size 10", 135 | "flags" : [ 136 | "Pseudorandom" 137 | ], 138 | "key" : "39de0ebea97c09b2301a90009a423253", 139 | "msg" : "81e5c33b4c620852f044", 140 | "tag" : "3af8ee484438b81641e4bf1681033e46", 141 | "result" : "valid" 142 | }, 143 | { 144 | "tcId" : 12, 145 | "comment" : "message of size 11", 146 | "flags" : [ 147 | "Pseudorandom" 148 | ], 149 | "key" : "91656d8fc0aced60ddb1c4006d0dde53", 150 | "msg" : "7b3e440fe566790064b2ec", 151 | "tag" : "40ce028fe0f2b3f328415ff302a3bdac", 152 | "result" : "valid" 153 | }, 154 | { 155 | "tcId" : 13, 156 | "comment" : "message of size 12", 157 | "flags" : [ 158 | "Pseudorandom" 159 | ], 160 | "key" : "af7d5134720b5386158d51ea126e7cf9", 161 | "msg" : "7cc6fcc925c20f3c83b5567c", 162 | "tag" : "199f559c0ec276745fbd7cdad133c10e", 163 | "result" : "valid" 164 | }, 165 | { 166 | "tcId" : 14, 167 | "comment" : "message of size 13", 168 | "flags" : [ 169 | "Pseudorandom" 170 | ], 171 | "key" : "4ed56753de6f75a032ebabca3ce27971", 172 | "msg" : "0c8c0f5619d9f8da5339281285", 173 | "tag" : "9bd174fb48f818ab05ed85d686638dfa", 174 | "result" : "valid" 175 | }, 176 | { 177 | "tcId" : 15, 178 | "comment" : "message of size 14", 179 | "flags" : [ 180 | "Pseudorandom" 181 | ], 182 | "key" : "beba50c936b696c15e25046dffb23a64", 183 | "msg" : "821ea8532fbabffb6e3d212e9b46", 184 | "tag" : "25af999e7b7fb3524f89337996b02e13", 185 | "result" : "valid" 186 | }, 187 | { 188 | "tcId" : 16, 189 | "comment" : "message of size 15", 190 | "flags" : [ 191 | "Pseudorandom" 192 | ], 193 | "key" : "501d81ebf912ddb87fbe3b7aac1437bc", 194 | "msg" : "2368e3c3636b5e8e94d2081adbf798", 195 | "tag" : "0271af16f7ddd13a3888e0125089fb5d", 196 | "result" : "valid" 197 | }, 198 | { 199 | "tcId" : 17, 200 | "comment" : "message of size 16", 201 | "flags" : [ 202 | "Pseudorandom" 203 | ], 204 | "key" : "e09eaa5a3f5e56d279d5e7a03373f6ea", 205 | "msg" : "ef4eab37181f98423e53e947e7050fd0", 206 | "tag" : "1ad805eeabcfd28ef1e4dfa10f8e831d", 207 | "result" : "valid" 208 | }, 209 | { 210 | "tcId" : 18, 211 | "comment" : "message of size 17", 212 | "flags" : [ 213 | "Pseudorandom" 214 | ], 215 | "key" : "831e664c9e3f0c3094c0b27b9d908eb2", 216 | "msg" : "26603bb76dd0a0180791c4ed4d3b058807", 217 | "tag" : "49c9a57e606871ce65e6c71fefc7598d", 218 | "result" : "valid" 219 | }, 220 | { 221 | "tcId" : 19, 222 | "comment" : "message of size 18", 223 | "flags" : [ 224 | "Pseudorandom" 225 | ], 226 | "key" : "331da8fb99b45206f65a91f9a1d02a97", 227 | "msg" : "090ccdcd3b0987ba8157b330823938d69b91", 228 | "tag" : "9fe4d663ea184b999f1663eb106a336c", 229 | "result" : "valid" 230 | }, 231 | { 232 | "tcId" : 20, 233 | "comment" : "message of size 19", 234 | "flags" : [ 235 | "Pseudorandom" 236 | ], 237 | "key" : "3f88dbfd55b54bd75616196561010780", 238 | "msg" : "bb7c4b15c40e80304e4c93073e8a52f210aa7e", 239 | "tag" : "2b8e41de0d6a8de7fbe210fb8f4a63c4", 240 | "result" : "valid" 241 | }, 242 | { 243 | "tcId" : 21, 244 | "comment" : "message of size 20", 245 | "flags" : [ 246 | "Pseudorandom" 247 | ], 248 | "key" : "cbffc6c8c7f76f46349c32d666f4efb0", 249 | "msg" : "6df067add738195fd55ac2e76b476971b9a0e6d8", 250 | "tag" : "9671e536d26717a47a210c807190683a", 251 | "result" : "valid" 252 | }, 253 | { 254 | "tcId" : 22, 255 | "comment" : "message of size 21", 256 | "flags" : [ 257 | "Pseudorandom" 258 | ], 259 | "key" : "3c159adc1f4274830b2d85fb098d21c3", 260 | "msg" : "f8839383eb53b82df577d90500b47afaf754f2af22", 261 | "tag" : "7b20a54db3c47899b4967454064fc072", 262 | "result" : "valid" 263 | }, 264 | { 265 | "tcId" : 23, 266 | "comment" : "message of size 22", 267 | "flags" : [ 268 | "Pseudorandom" 269 | ], 270 | "key" : "e97b3d4fc1ca5ffb820ff4ec48c4c6f1", 271 | "msg" : "656d93cab8a04f1e3dc296c447e106aadb02a2cceb7e", 272 | "tag" : "3293259a4c5d8e148c1180164d69bf96", 273 | "result" : "valid" 274 | }, 275 | { 276 | "tcId" : 24, 277 | "comment" : "message of size 23", 278 | "flags" : [ 279 | "Pseudorandom" 280 | ], 281 | "key" : "c3b65927d39f018483c4c512f9dea072", 282 | "msg" : "b28280570592b69039af2077f3d695d6c7a0069583c210", 283 | "tag" : "586a8bb285250968bb12550afc844674", 284 | "result" : "valid" 285 | }, 286 | { 287 | "tcId" : 25, 288 | "comment" : "message of size 24", 289 | "flags" : [ 290 | "Pseudorandom" 291 | ], 292 | "key" : "549bd282ee21b4d7c3b1d02e3ee20ef7", 293 | "msg" : "d84bf73c5eecbd38444f1a73556e2fa3253f4c54d6916545", 294 | "tag" : "83152314e910922e03683f4b45f88f5e", 295 | "result" : "valid" 296 | }, 297 | { 298 | "tcId" : 26, 299 | "comment" : "message of size 25", 300 | "flags" : [ 301 | "Pseudorandom" 302 | ], 303 | "key" : "255f9c8dfa4c51a4d09d7a46c4c42c4c", 304 | "msg" : "fb11d2158aead32cb83681dfd769d00bff03714948c4db971a", 305 | "tag" : "692c8440f059ceccdfd778b8b3022f29", 306 | "result" : "valid" 307 | }, 308 | { 309 | "tcId" : 27, 310 | "comment" : "message of size 26", 311 | "flags" : [ 312 | "Pseudorandom" 313 | ], 314 | "key" : "e54cee9997f4f75a23af777de90f8e69", 315 | "msg" : "f4c35a3467a372ecc6dcccd009f1f2f19e00ceac9e900d66e945", 316 | "tag" : "45c88bdb5b1d34c8046ea82769e12cd1", 317 | "result" : "valid" 318 | }, 319 | { 320 | "tcId" : 28, 321 | "comment" : "message of size 27", 322 | "flags" : [ 323 | "Pseudorandom" 324 | ], 325 | "key" : "290cec2a8257a7325e85ca7c898ae0a3", 326 | "msg" : "ebdaea8728ae17e180da79576a26845d9cd22ea1296808340e4658", 327 | "tag" : "43136130e6f171865816a438c8d1aafb", 328 | "result" : "valid" 329 | }, 330 | { 331 | "tcId" : 29, 332 | "comment" : "message of size 28", 333 | "flags" : [ 334 | "Pseudorandom" 335 | ], 336 | "key" : "fdb711790c08cb4a0687ed993f51f5f3", 337 | "msg" : "fc30e3bbc96da7bca287dad813fd93ca2a69dc4bf1b72fe6eb6b6d30", 338 | "tag" : "6e7fb057f16e7be593f0ca43ae25a2b8", 339 | "result" : "valid" 340 | }, 341 | { 342 | "tcId" : 30, 343 | "comment" : "message of size 29", 344 | "flags" : [ 345 | "Pseudorandom" 346 | ], 347 | "key" : "c61ee2e9a1c665a1c74766501cd15ab6", 348 | "msg" : "9081742a3b85d847ac1edc6324f790bf6b37070825df7d0864d73b2101", 349 | "tag" : "976680f4b1e3b27e3f31b08b326ccd6c", 350 | "result" : "valid" 351 | }, 352 | { 353 | "tcId" : 31, 354 | "comment" : "message of size 30", 355 | "flags" : [ 356 | "Pseudorandom" 357 | ], 358 | "key" : "48ab3ad6c6313ae98b974b56e6c9a0d1", 359 | "msg" : "6697237d95cfaaff771279cceab33f8f6adceb0a088694355e67bfbf1a36", 360 | "tag" : "9d0d79f3054497f6b75e2ac910d5849a", 361 | "result" : "valid" 362 | }, 363 | { 364 | "tcId" : 32, 365 | "comment" : "message of size 31", 366 | "flags" : [ 367 | "Pseudorandom" 368 | ], 369 | "key" : "fda6a01194beb462953d7e6c49b32dac", 370 | "msg" : "f60ae3b036abcab78c98fc1d4b67970c0955cb6fe24483f8907fd73319679b", 371 | "tag" : "d00fe25661ddd91ab94d17466ec1c64b", 372 | "result" : "valid" 373 | }, 374 | { 375 | "tcId" : 33, 376 | "comment" : "message of size 32", 377 | "flags" : [ 378 | "Pseudorandom" 379 | ], 380 | "key" : "9bd3902ed0996c869b572272e76f3889", 381 | "msg" : "a7ba19d49ee1ea02f098aa8e30c740d893a4456ccc294040484ed8a00a55f93e", 382 | "tag" : "46133a114a749b6b59094c7ba8e360f6", 383 | "result" : "valid" 384 | }, 385 | { 386 | "tcId" : 34, 387 | "comment" : "message of size 47", 388 | "flags" : [ 389 | "Pseudorandom" 390 | ], 391 | "key" : "6631b2a247ef656ae7a53a98a491a5d0", 392 | "msg" : "2b590ba7a8c1920468423a12ae6885c4fe5555a7743bdbd82c9ed65bf491833526617fa3453c11c630f11ccabf13d8", 393 | "tag" : "45551b1f183997651f58c626f6c96c18", 394 | "result" : "valid" 395 | }, 396 | { 397 | "tcId" : 35, 398 | "comment" : "message of size 48", 399 | "flags" : [ 400 | "Pseudorandom" 401 | ], 402 | "key" : "75ce184447cada672e02290310d224f7", 403 | "msg" : "c774810a31a6421ad8eaafd5c22fa2455e2c167fee4a0b73ff927b2d96c69da1e939407b86b1c19bcfc69c434c3cf8a2", 404 | "tag" : "5c80cbef126f2f47813ad655a57f06fd", 405 | "result" : "valid" 406 | }, 407 | { 408 | "tcId" : 36, 409 | "comment" : "message of size 49", 410 | "flags" : [ 411 | "Pseudorandom" 412 | ], 413 | "key" : "a9fb52baf7f788af4e186a77c3792946", 414 | "msg" : "23f95687d727cee46ccf8af3ab21524472f5298e398ef63e408de732321071959a5768d6b5c9fc751c46eec2dfb7347960", 415 | "tag" : "4690701c87f41297c7edbe971a38bf4a", 416 | "result" : "valid" 417 | }, 418 | { 419 | "tcId" : 37, 420 | "comment" : "message of size 112", 421 | "flags" : [ 422 | "Pseudorandom" 423 | ], 424 | "key" : "38572d60322a518cc5c671b807041048", 425 | "msg" : "fc55c261f91263d802fce8f11c828a3a4aa2da7f380963deb878682357232d3bc264ba53f59513263fc00791debb397cd443052a3a777c87564b76ba43a3bbb81ef25b6765d86e2bb61be1a6846b00234abee196eb8cdc0968121ce848c720da834ec0040b1960c13bd11e853ed9b9b5", 426 | "tag" : "21116d36ac0d012dbe666dd1e73913f9", 427 | "result" : "valid" 428 | }, 429 | { 430 | "tcId" : 38, 431 | "comment" : "message of size 127", 432 | "flags" : [ 433 | "Pseudorandom" 434 | ], 435 | "key" : "13cc10857c207246fdffa908e68fc28a", 436 | "msg" : "24fe75485635957a6f4ca84ae40201d7d0d24ec8fc4b841046dd019d86e226ed8c45b0b416f0821939c00392a2e83a236a4a993cfe5fa1789b854f86c8b81a98823835a54550fe4b5de26c7d3b498c1df7159c8a3f02f94e8b144d854851ac14a5fdc0b1a097f424011afd26e1ac3edbf6c241c74f273a14482693d79f7f32", 437 | "tag" : "82736f99239212a2e917500fcc9035d6", 438 | "result" : "valid" 439 | }, 440 | { 441 | "tcId" : 39, 442 | "comment" : "message of size 128", 443 | "flags" : [ 444 | "Pseudorandom" 445 | ], 446 | "key" : "4bb3e2c2894b90108edc3cde4116355b", 447 | "msg" : "802a78855f7a8cc1fc3c440c759bff5772cc65bfef192c9c213776296da539462a7038301603938baf0fa9764f1f0af135fa46c8a305febf75172c3a701fe9a871687421a6a4cc5f08a24457d40c27c15cd3f26890db62a76555ffe02b80131214e740ffa48246c2cecb7e21a7f7424153b2c22f14ff8528d7114f598e08884b", 448 | "tag" : "9f0e3732fb37b7f768611fbda0011279", 449 | "result" : "valid" 450 | }, 451 | { 452 | "tcId" : 40, 453 | "comment" : "message of size 255", 454 | "flags" : [ 455 | "Pseudorandom" 456 | ], 457 | "key" : "9a69a5129e2cdb7f93d569e19dca6fc6", 458 | "msg" : "988b3fa2a39eea1871e65d2197443e6855b36bdbec8c5d8b678137965a7fa8d155165e3055deb10bb19a4cce79a3cde749f13571517dd04cf1cda8dc864f56c63b36fd86f49359427ad8bf05739be8d9df7de1412ca4090f7eafb276c0be8a3119c57bd6a8b061544c76c2d9b48deaa962d9fab0838d136ad76bd91a4510ad945a430e3ef87f7eca4ad78e699545ae59cd52002e9954ba4d9deda72c519f0dd1b9b9115a1f87aa4cd4a5e4506446e3454278ec142d3389d968be7ef628ae6299c3276946dab978dfc87c91316b29fea2cfe8678110fc787bfc7ddd079e73b96bf2ce7c33995d6d00fe0864a6f0b873f1bfe26db7c60a5846d8ccf26e6595e8", 459 | "tag" : "8eafc466a863ae046e34b36e050e243f", 460 | "result" : "valid" 461 | } 462 | ] 463 | } 464 | ] 465 | } 466 | -------------------------------------------------------------------------------- /src/data/siphashx_4_8_test.json: -------------------------------------------------------------------------------- 1 | { 2 | "algorithm" : "SipHashX-4-8", 3 | "schema" : "mac_test_schema.json", 4 | "generatorVersion" : "0.9", 5 | "numberOfTests" : 40, 6 | "header" : [ 7 | "Test vectors of type MacTest are intended for testing the", 8 | "generation and verification of MACs." 9 | ], 10 | "notes" : { 11 | "Pseudorandom" : { 12 | "bugType" : "FUNCTIONALITY", 13 | "description" : "The test vector contains pseudorandomly generated inputs. The goal of the test vector is to check the correctness of the implementation for various sizes of the input parameters." 14 | } 15 | }, 16 | "testGroups" : [ 17 | { 18 | "type" : "MacTest", 19 | "keySize" : 128, 20 | "tagSize" : 128, 21 | "tests" : [ 22 | { 23 | "tcId" : 1, 24 | "comment" : "empty message", 25 | "flags" : [ 26 | "Pseudorandom" 27 | ], 28 | "key" : "e34f15c7bd819930fe9d66e0c166e61c", 29 | "msg" : "", 30 | "tag" : "aa385bc1d9a1b1d755213066bc5a973b", 31 | "result" : "valid" 32 | }, 33 | { 34 | "tcId" : 2, 35 | "comment" : "message of size 1", 36 | "flags" : [ 37 | "Pseudorandom" 38 | ], 39 | "key" : "e1e726677f4893890f8c027f9d8ef80d", 40 | "msg" : "3f", 41 | "tag" : "4af51130ccdc7b3d147a40b12fdb3378", 42 | "result" : "valid" 43 | }, 44 | { 45 | "tcId" : 3, 46 | "comment" : "message of size 2", 47 | "flags" : [ 48 | "Pseudorandom" 49 | ], 50 | "key" : "b151f491c4c006d1f28214aa3da9a985", 51 | "msg" : "27d9", 52 | "tag" : "a9b931d5d6dbbcf81e6019f9db0ab044", 53 | "result" : "valid" 54 | }, 55 | { 56 | "tcId" : 4, 57 | "comment" : "message of size 3", 58 | "flags" : [ 59 | "Pseudorandom" 60 | ], 61 | "key" : "c36ff15f72777ee21deec07b63c1a0cd", 62 | "msg" : "50b428", 63 | "tag" : "f2c28472fb478da195879e819386eaad", 64 | "result" : "valid" 65 | }, 66 | { 67 | "tcId" : 5, 68 | "comment" : "message of size 4", 69 | "flags" : [ 70 | "Pseudorandom" 71 | ], 72 | "key" : "32b9c5c78c3a0689a86052420fa1e8fc", 73 | "msg" : "0b9262ec", 74 | "tag" : "a9ce50b901fbc33cd159e9e686b9f4ea", 75 | "result" : "valid" 76 | }, 77 | { 78 | "tcId" : 6, 79 | "comment" : "message of size 5", 80 | "flags" : [ 81 | "Pseudorandom" 82 | ], 83 | "key" : "43151bbaef367277ebfc97509d0aa49c", 84 | "msg" : "eaa91273e7", 85 | "tag" : "058da19df0e8c1c4d3f0f3e847a9475b", 86 | "result" : "valid" 87 | }, 88 | { 89 | "tcId" : 7, 90 | "comment" : "message of size 6", 91 | "flags" : [ 92 | "Pseudorandom" 93 | ], 94 | "key" : "481440298525cc261f8159159aedf62d", 95 | "msg" : "6123c556c5cc", 96 | "tag" : "ab5d30c55bd306ae7b7a2ac8fb772076", 97 | "result" : "valid" 98 | }, 99 | { 100 | "tcId" : 8, 101 | "comment" : "message of size 7", 102 | "flags" : [ 103 | "Pseudorandom" 104 | ], 105 | "key" : "9ca26eb88731efbf7f810d5d95e196ac", 106 | "msg" : "7e48f06183aa40", 107 | "tag" : "3a7777be396d12a733fe8d087bd30320", 108 | "result" : "valid" 109 | }, 110 | { 111 | "tcId" : 9, 112 | "comment" : "message of size 8", 113 | "flags" : [ 114 | "Pseudorandom" 115 | ], 116 | "key" : "48f0d03e41cc55c4b58f737b5acdea32", 117 | "msg" : "f4a133aa6d5985a0", 118 | "tag" : "4d1bec7b9dcc5d1a1c87b9f86d3bbfc5", 119 | "result" : "valid" 120 | }, 121 | { 122 | "tcId" : 10, 123 | "comment" : "message of size 9", 124 | "flags" : [ 125 | "Pseudorandom" 126 | ], 127 | "key" : "1c958849f31996b28939ce513087d1be", 128 | "msg" : "b0d2fee11b8e2f86b7", 129 | "tag" : "cc72e213e0adf2050706cbad19df59b5", 130 | "result" : "valid" 131 | }, 132 | { 133 | "tcId" : 11, 134 | "comment" : "message of size 10", 135 | "flags" : [ 136 | "Pseudorandom" 137 | ], 138 | "key" : "39de0ebea97c09b2301a90009a423253", 139 | "msg" : "81e5c33b4c620852f044", 140 | "tag" : "4d7b9dce7a35187ec8c45b705d65e174", 141 | "result" : "valid" 142 | }, 143 | { 144 | "tcId" : 12, 145 | "comment" : "message of size 11", 146 | "flags" : [ 147 | "Pseudorandom" 148 | ], 149 | "key" : "91656d8fc0aced60ddb1c4006d0dde53", 150 | "msg" : "7b3e440fe566790064b2ec", 151 | "tag" : "e9430c51ae4ddc072f22430d5d6e0505", 152 | "result" : "valid" 153 | }, 154 | { 155 | "tcId" : 13, 156 | "comment" : "message of size 12", 157 | "flags" : [ 158 | "Pseudorandom" 159 | ], 160 | "key" : "af7d5134720b5386158d51ea126e7cf9", 161 | "msg" : "7cc6fcc925c20f3c83b5567c", 162 | "tag" : "f99d515f3658e6f0155d62c6688a08b0", 163 | "result" : "valid" 164 | }, 165 | { 166 | "tcId" : 14, 167 | "comment" : "message of size 13", 168 | "flags" : [ 169 | "Pseudorandom" 170 | ], 171 | "key" : "4ed56753de6f75a032ebabca3ce27971", 172 | "msg" : "0c8c0f5619d9f8da5339281285", 173 | "tag" : "eb7da726d338fd40c6d72ee4525178cd", 174 | "result" : "valid" 175 | }, 176 | { 177 | "tcId" : 15, 178 | "comment" : "message of size 14", 179 | "flags" : [ 180 | "Pseudorandom" 181 | ], 182 | "key" : "beba50c936b696c15e25046dffb23a64", 183 | "msg" : "821ea8532fbabffb6e3d212e9b46", 184 | "tag" : "cda584af0e0a4d93375143d895685979", 185 | "result" : "valid" 186 | }, 187 | { 188 | "tcId" : 16, 189 | "comment" : "message of size 15", 190 | "flags" : [ 191 | "Pseudorandom" 192 | ], 193 | "key" : "501d81ebf912ddb87fbe3b7aac1437bc", 194 | "msg" : "2368e3c3636b5e8e94d2081adbf798", 195 | "tag" : "bd35ac3f0fff49752d9d30b1d2b1de7b", 196 | "result" : "valid" 197 | }, 198 | { 199 | "tcId" : 17, 200 | "comment" : "message of size 16", 201 | "flags" : [ 202 | "Pseudorandom" 203 | ], 204 | "key" : "e09eaa5a3f5e56d279d5e7a03373f6ea", 205 | "msg" : "ef4eab37181f98423e53e947e7050fd0", 206 | "tag" : "1d35227f2aeabcc72204084c393e9089", 207 | "result" : "valid" 208 | }, 209 | { 210 | "tcId" : 18, 211 | "comment" : "message of size 17", 212 | "flags" : [ 213 | "Pseudorandom" 214 | ], 215 | "key" : "831e664c9e3f0c3094c0b27b9d908eb2", 216 | "msg" : "26603bb76dd0a0180791c4ed4d3b058807", 217 | "tag" : "4ce0e61f7fd95f9f9e48eb0b48329114", 218 | "result" : "valid" 219 | }, 220 | { 221 | "tcId" : 19, 222 | "comment" : "message of size 18", 223 | "flags" : [ 224 | "Pseudorandom" 225 | ], 226 | "key" : "331da8fb99b45206f65a91f9a1d02a97", 227 | "msg" : "090ccdcd3b0987ba8157b330823938d69b91", 228 | "tag" : "d5c67f168f7ba8bede42e1f25f069860", 229 | "result" : "valid" 230 | }, 231 | { 232 | "tcId" : 20, 233 | "comment" : "message of size 19", 234 | "flags" : [ 235 | "Pseudorandom" 236 | ], 237 | "key" : "3f88dbfd55b54bd75616196561010780", 238 | "msg" : "bb7c4b15c40e80304e4c93073e8a52f210aa7e", 239 | "tag" : "55a0c1976284395c887abc4c4a60bf30", 240 | "result" : "valid" 241 | }, 242 | { 243 | "tcId" : 21, 244 | "comment" : "message of size 20", 245 | "flags" : [ 246 | "Pseudorandom" 247 | ], 248 | "key" : "cbffc6c8c7f76f46349c32d666f4efb0", 249 | "msg" : "6df067add738195fd55ac2e76b476971b9a0e6d8", 250 | "tag" : "ac2523a839208d8bd81e684574a9b9d6", 251 | "result" : "valid" 252 | }, 253 | { 254 | "tcId" : 22, 255 | "comment" : "message of size 21", 256 | "flags" : [ 257 | "Pseudorandom" 258 | ], 259 | "key" : "3c159adc1f4274830b2d85fb098d21c3", 260 | "msg" : "f8839383eb53b82df577d90500b47afaf754f2af22", 261 | "tag" : "c1ad99d3604ac6da6511374486e12c01", 262 | "result" : "valid" 263 | }, 264 | { 265 | "tcId" : 23, 266 | "comment" : "message of size 22", 267 | "flags" : [ 268 | "Pseudorandom" 269 | ], 270 | "key" : "e97b3d4fc1ca5ffb820ff4ec48c4c6f1", 271 | "msg" : "656d93cab8a04f1e3dc296c447e106aadb02a2cceb7e", 272 | "tag" : "d0d50733be1e0dd2eca758aee353475c", 273 | "result" : "valid" 274 | }, 275 | { 276 | "tcId" : 24, 277 | "comment" : "message of size 23", 278 | "flags" : [ 279 | "Pseudorandom" 280 | ], 281 | "key" : "c3b65927d39f018483c4c512f9dea072", 282 | "msg" : "b28280570592b69039af2077f3d695d6c7a0069583c210", 283 | "tag" : "4d5e993dfbb4f08112a05efdfbfbb3e7", 284 | "result" : "valid" 285 | }, 286 | { 287 | "tcId" : 25, 288 | "comment" : "message of size 24", 289 | "flags" : [ 290 | "Pseudorandom" 291 | ], 292 | "key" : "549bd282ee21b4d7c3b1d02e3ee20ef7", 293 | "msg" : "d84bf73c5eecbd38444f1a73556e2fa3253f4c54d6916545", 294 | "tag" : "a8f7647ac7fe4fc7b9d2b436810b6c3c", 295 | "result" : "valid" 296 | }, 297 | { 298 | "tcId" : 26, 299 | "comment" : "message of size 25", 300 | "flags" : [ 301 | "Pseudorandom" 302 | ], 303 | "key" : "255f9c8dfa4c51a4d09d7a46c4c42c4c", 304 | "msg" : "fb11d2158aead32cb83681dfd769d00bff03714948c4db971a", 305 | "tag" : "5afe55108825f8548c6a9b55ff56441c", 306 | "result" : "valid" 307 | }, 308 | { 309 | "tcId" : 27, 310 | "comment" : "message of size 26", 311 | "flags" : [ 312 | "Pseudorandom" 313 | ], 314 | "key" : "e54cee9997f4f75a23af777de90f8e69", 315 | "msg" : "f4c35a3467a372ecc6dcccd009f1f2f19e00ceac9e900d66e945", 316 | "tag" : "18f06d680c7325929bb64289a2de071f", 317 | "result" : "valid" 318 | }, 319 | { 320 | "tcId" : 28, 321 | "comment" : "message of size 27", 322 | "flags" : [ 323 | "Pseudorandom" 324 | ], 325 | "key" : "290cec2a8257a7325e85ca7c898ae0a3", 326 | "msg" : "ebdaea8728ae17e180da79576a26845d9cd22ea1296808340e4658", 327 | "tag" : "e5fee97730d40517e647066538035c87", 328 | "result" : "valid" 329 | }, 330 | { 331 | "tcId" : 29, 332 | "comment" : "message of size 28", 333 | "flags" : [ 334 | "Pseudorandom" 335 | ], 336 | "key" : "fdb711790c08cb4a0687ed993f51f5f3", 337 | "msg" : "fc30e3bbc96da7bca287dad813fd93ca2a69dc4bf1b72fe6eb6b6d30", 338 | "tag" : "6f46c2cd0029d9a5d36404120da1c43d", 339 | "result" : "valid" 340 | }, 341 | { 342 | "tcId" : 30, 343 | "comment" : "message of size 29", 344 | "flags" : [ 345 | "Pseudorandom" 346 | ], 347 | "key" : "c61ee2e9a1c665a1c74766501cd15ab6", 348 | "msg" : "9081742a3b85d847ac1edc6324f790bf6b37070825df7d0864d73b2101", 349 | "tag" : "a8c90306482d18805f295f3350721d82", 350 | "result" : "valid" 351 | }, 352 | { 353 | "tcId" : 31, 354 | "comment" : "message of size 30", 355 | "flags" : [ 356 | "Pseudorandom" 357 | ], 358 | "key" : "48ab3ad6c6313ae98b974b56e6c9a0d1", 359 | "msg" : "6697237d95cfaaff771279cceab33f8f6adceb0a088694355e67bfbf1a36", 360 | "tag" : "c4dc2995980933722fc595e29f219659", 361 | "result" : "valid" 362 | }, 363 | { 364 | "tcId" : 32, 365 | "comment" : "message of size 31", 366 | "flags" : [ 367 | "Pseudorandom" 368 | ], 369 | "key" : "fda6a01194beb462953d7e6c49b32dac", 370 | "msg" : "f60ae3b036abcab78c98fc1d4b67970c0955cb6fe24483f8907fd73319679b", 371 | "tag" : "9e4fcdd0ae9d0d07903cdd4645c3e827", 372 | "result" : "valid" 373 | }, 374 | { 375 | "tcId" : 33, 376 | "comment" : "message of size 32", 377 | "flags" : [ 378 | "Pseudorandom" 379 | ], 380 | "key" : "9bd3902ed0996c869b572272e76f3889", 381 | "msg" : "a7ba19d49ee1ea02f098aa8e30c740d893a4456ccc294040484ed8a00a55f93e", 382 | "tag" : "b2e84e0119a0041d50290c745264d58d", 383 | "result" : "valid" 384 | }, 385 | { 386 | "tcId" : 34, 387 | "comment" : "message of size 47", 388 | "flags" : [ 389 | "Pseudorandom" 390 | ], 391 | "key" : "6631b2a247ef656ae7a53a98a491a5d0", 392 | "msg" : "2b590ba7a8c1920468423a12ae6885c4fe5555a7743bdbd82c9ed65bf491833526617fa3453c11c630f11ccabf13d8", 393 | "tag" : "0e8735ecf3c8391e84ce0223682cca48", 394 | "result" : "valid" 395 | }, 396 | { 397 | "tcId" : 35, 398 | "comment" : "message of size 48", 399 | "flags" : [ 400 | "Pseudorandom" 401 | ], 402 | "key" : "75ce184447cada672e02290310d224f7", 403 | "msg" : "c774810a31a6421ad8eaafd5c22fa2455e2c167fee4a0b73ff927b2d96c69da1e939407b86b1c19bcfc69c434c3cf8a2", 404 | "tag" : "a23910957e15c2fe7a5c9089f23543df", 405 | "result" : "valid" 406 | }, 407 | { 408 | "tcId" : 36, 409 | "comment" : "message of size 49", 410 | "flags" : [ 411 | "Pseudorandom" 412 | ], 413 | "key" : "a9fb52baf7f788af4e186a77c3792946", 414 | "msg" : "23f95687d727cee46ccf8af3ab21524472f5298e398ef63e408de732321071959a5768d6b5c9fc751c46eec2dfb7347960", 415 | "tag" : "0cdcc7a11589c972424593c187c2e4ff", 416 | "result" : "valid" 417 | }, 418 | { 419 | "tcId" : 37, 420 | "comment" : "message of size 112", 421 | "flags" : [ 422 | "Pseudorandom" 423 | ], 424 | "key" : "38572d60322a518cc5c671b807041048", 425 | "msg" : "fc55c261f91263d802fce8f11c828a3a4aa2da7f380963deb878682357232d3bc264ba53f59513263fc00791debb397cd443052a3a777c87564b76ba43a3bbb81ef25b6765d86e2bb61be1a6846b00234abee196eb8cdc0968121ce848c720da834ec0040b1960c13bd11e853ed9b9b5", 426 | "tag" : "47f2ddb3b6b51bcfd9efe4d91273606f", 427 | "result" : "valid" 428 | }, 429 | { 430 | "tcId" : 38, 431 | "comment" : "message of size 127", 432 | "flags" : [ 433 | "Pseudorandom" 434 | ], 435 | "key" : "13cc10857c207246fdffa908e68fc28a", 436 | "msg" : "24fe75485635957a6f4ca84ae40201d7d0d24ec8fc4b841046dd019d86e226ed8c45b0b416f0821939c00392a2e83a236a4a993cfe5fa1789b854f86c8b81a98823835a54550fe4b5de26c7d3b498c1df7159c8a3f02f94e8b144d854851ac14a5fdc0b1a097f424011afd26e1ac3edbf6c241c74f273a14482693d79f7f32", 437 | "tag" : "13676569124934f7cd76041e84d2fe62", 438 | "result" : "valid" 439 | }, 440 | { 441 | "tcId" : 39, 442 | "comment" : "message of size 128", 443 | "flags" : [ 444 | "Pseudorandom" 445 | ], 446 | "key" : "4bb3e2c2894b90108edc3cde4116355b", 447 | "msg" : "802a78855f7a8cc1fc3c440c759bff5772cc65bfef192c9c213776296da539462a7038301603938baf0fa9764f1f0af135fa46c8a305febf75172c3a701fe9a871687421a6a4cc5f08a24457d40c27c15cd3f26890db62a76555ffe02b80131214e740ffa48246c2cecb7e21a7f7424153b2c22f14ff8528d7114f598e08884b", 448 | "tag" : "2e7e36f38ae5c6a5885f27741b6c5586", 449 | "result" : "valid" 450 | }, 451 | { 452 | "tcId" : 40, 453 | "comment" : "message of size 255", 454 | "flags" : [ 455 | "Pseudorandom" 456 | ], 457 | "key" : "9a69a5129e2cdb7f93d569e19dca6fc6", 458 | "msg" : "988b3fa2a39eea1871e65d2197443e6855b36bdbec8c5d8b678137965a7fa8d155165e3055deb10bb19a4cce79a3cde749f13571517dd04cf1cda8dc864f56c63b36fd86f49359427ad8bf05739be8d9df7de1412ca4090f7eafb276c0be8a3119c57bd6a8b061544c76c2d9b48deaa962d9fab0838d136ad76bd91a4510ad945a430e3ef87f7eca4ad78e699545ae59cd52002e9954ba4d9deda72c519f0dd1b9b9115a1f87aa4cd4a5e4506446e3454278ec142d3389d968be7ef628ae6299c3276946dab978dfc87c91316b29fea2cfe8678110fc787bfc7ddd079e73b96bf2ce7c33995d6d00fe0864a6f0b873f1bfe26db7c60a5846d8ccf26e6595e8", 459 | "tag" : "026e219f2626287d7a3bf4ee6ce98470", 460 | "result" : "valid" 461 | } 462 | ] 463 | } 464 | ] 465 | } 466 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | //! # Wycheproof test vectors 2 | //! 3 | //! Wycheproof is a set of cryptographic tests created by a team at Google which 4 | //! checks for common bugs and corner cases in cryptographic code. 5 | //! 6 | //! This crate is a convenient repacking of the Wycheproof JSON-formatted test 7 | //! data with deserialization to easily usable structs. 8 | //! 9 | //! Hex and base64 encoded data is decoded to binary in the `BinaryString` 10 | //! struct which is a light wrapper around `Vec`. 11 | //! 12 | //! Large integers (such as those used in the RSA test data) are decoded as 13 | //! big-endian byte arrays into a `LargeInteger` struct, which is again a light 14 | //! wrapper around `Vec`. Additionally if the `num-bigint` feature is enabled, 15 | //! this type also gains a conversion function to `num_bigint::BigUint`. 16 | //! 17 | //! Each submodule of this crate includes a set of structs: a `TestName` which 18 | //! specifies which individual test is desired, a `TestSet` which is the set of 19 | //! data associated with the `TestName`. Each `TestSet` contains one or more 20 | //! `TestGroups`, which in turn contain some amount of test-specific 21 | //! configuration information along with a list of `Test` which are the actual 22 | //! tests. 23 | //! 24 | //! Each test has an expected result which is either `Valid`, `Invalid`, or 25 | //! `Acceptable`. `Acceptable` just means that the test is technically valid but 26 | //! might still be rejected for various reasons, for instance because the hash 27 | //! function that was used is too weak for proper security. 28 | //! 29 | //! # Examples 30 | //! 31 | //! ``` 32 | //! #[cfg(feature = "aead")] 33 | //! fn print_gcm() { 34 | //! // Print all AES-GCM test vector data 35 | //! let test_set = wycheproof::aead::TestSet::load(wycheproof::aead::TestName::AesGcm).unwrap(); 36 | //! 37 | //! for test_group in test_set.test_groups { 38 | //! println!( 39 | //! "* Group key size:{} tag size:{} nonce size:{}", 40 | //! test_group.key_size, test_group.tag_size, test_group.nonce_size, 41 | //! ); 42 | //! for test in test_group.tests { 43 | //! println!( 44 | //! "Test:{} Key:{} AAD:{} PT:{} CT:{} Tag:{}", 45 | //! test.tc_id, 46 | //! data_encoding::HEXLOWER.encode(&test.key), 47 | //! data_encoding::HEXLOWER.encode(&test.aad), 48 | //! data_encoding::HEXLOWER.encode(&test.pt), 49 | //! data_encoding::HEXLOWER.encode(&test.ct), 50 | //! data_encoding::HEXLOWER.encode(&test.tag) 51 | //! ); 52 | //! } 53 | //! } 54 | //! } 55 | //! ``` 56 | //! 57 | //! ``` 58 | //! // Iterate over all of the AEAD tests 59 | //! #[cfg(feature = "aead")] 60 | //! for aead in wycheproof::aead::TestName::all() { 61 | //! println!("{:?}", aead); 62 | //! } 63 | //! ``` 64 | 65 | #![forbid(unsafe_code)] 66 | 67 | use serde::{de::Error, Deserialize, Deserializer}; 68 | use std::fmt; 69 | 70 | /// The error type 71 | #[derive(Debug)] 72 | pub enum WycheproofError { 73 | /// Named data set was not found 74 | NoDataSet, 75 | /// The JSON parsed but was found to be invalid somehow 76 | InvalidData, 77 | /// The JSON parsing failed 78 | ParsingFailed(Box), 79 | } 80 | 81 | impl std::fmt::Display for WycheproofError { 82 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { 83 | match self { 84 | Self::NoDataSet => write!(f, "No data set matches provided name"), 85 | Self::InvalidData => write!(f, "Data set seems to be invalid"), 86 | Self::ParsingFailed(e) => write!(f, "Parsing JSON failed {}", e), 87 | } 88 | } 89 | } 90 | 91 | impl std::error::Error for WycheproofError {} 92 | 93 | fn vec_from_hex<'de, D: Deserializer<'de>>(deserializer: D) -> Result, D::Error> { 94 | let s: &str = Deserialize::deserialize(deserializer)?; 95 | data_encoding::HEXLOWER 96 | .decode(s.as_bytes()) 97 | .map_err(D::Error::custom) 98 | } 99 | 100 | fn combine_header<'de, D: Deserializer<'de>>(deserializer: D) -> Result { 101 | let h: Vec = Deserialize::deserialize(deserializer)?; 102 | let combined = h.join(" "); 103 | Ok(combined) 104 | } 105 | 106 | macro_rules! define_typeid { 107 | ( $name:ident => $( $tag:expr ),* ) => { 108 | #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq)] 109 | struct $name {} 110 | 111 | impl<'de> Deserialize<'de> for $name { 112 | fn deserialize>(deserializer: D) -> Result { 113 | let s: &str = Deserialize::deserialize(deserializer)?; 114 | 115 | match s { 116 | $( 117 | $tag => Ok(Self {}), 118 | )* 119 | unknown => Err(D::Error::custom(format!("unexpected type {} for {}", unknown, stringify!($name)))), 120 | } 121 | } 122 | } 123 | } 124 | } 125 | 126 | macro_rules! define_test_group_type_id { 127 | ( $( $json_str:expr => $enum_elem:ident ),* $(,)?) => { 128 | #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 129 | #[allow(non_camel_case_types)] 130 | pub enum TestGroupTypeId { 131 | $( 132 | #[serde(rename = $json_str)] 133 | $enum_elem, 134 | )* 135 | } 136 | } 137 | } 138 | 139 | macro_rules! define_algorithm_map { 140 | ( $( $json_str:expr => $enum_elem:ident ),* $(,)?) => { 141 | #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 142 | #[allow(non_camel_case_types)] 143 | pub enum Algorithm { 144 | $( 145 | #[serde(rename = $json_str)] 146 | $enum_elem, 147 | )* 148 | } 149 | } 150 | } 151 | 152 | macro_rules! define_test_set_names { 153 | ( $( $enum_name:ident => $test_name:expr ),* $(,)?) => { 154 | #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 155 | #[allow(non_camel_case_types)] 156 | pub enum TestName { 157 | $( 158 | $enum_name, 159 | )* 160 | } 161 | 162 | impl TestName { 163 | #[inline(never)] 164 | pub fn json_data(&self) -> &'static str { 165 | match self { 166 | $( 167 | Self::$enum_name => include_str!(concat!("data/", $test_name, "_test.json")), 168 | )* 169 | } 170 | } 171 | 172 | pub fn all() -> Vec { 173 | vec![ 174 | $( 175 | Self::$enum_name, 176 | )* 177 | ] 178 | } 179 | } 180 | 181 | impl std::str::FromStr for TestName { 182 | type Err = WycheproofError; 183 | 184 | fn from_str(s: &str) -> Result { 185 | match s { 186 | $( 187 | $test_name => Ok(Self::$enum_name), 188 | )* 189 | _ => Err(WycheproofError::NoDataSet), 190 | } 191 | } 192 | } 193 | } 194 | } 195 | 196 | #[derive(Debug, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 197 | #[serde(rename_all = "SCREAMING_SNAKE_CASE")] 198 | pub enum BugType { 199 | AuthBypass, 200 | Basic, 201 | BerEncoding, 202 | CanOfWorms, 203 | Confidentiality, 204 | Defined, 205 | EdgeCase, 206 | Functionality, 207 | KnownBug, 208 | Legacy, 209 | Malleability, 210 | MissingStep, 211 | ModifiedParameter, 212 | SignatureMalleability, 213 | Unknown, 214 | WeakParams, 215 | WrongPrimitive, 216 | } 217 | 218 | #[derive(Debug, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 219 | pub struct CVE(pub String); 220 | 221 | #[derive(Debug, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 222 | pub struct URL(pub String); 223 | 224 | #[derive(Debug, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 225 | #[serde(deny_unknown_fields)] 226 | pub struct TestFlagInfo { 227 | #[serde(rename = "bugType")] 228 | pub bug_type: BugType, 229 | pub description: Option, 230 | pub effect: Option, 231 | pub cves: Option>, 232 | pub links: Option>, 233 | } 234 | 235 | macro_rules! define_test_flags { 236 | ( $( $($json_name:literal =>)? $flag:ident ),* $(,)?) => { 237 | #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 238 | pub enum TestFlag { 239 | $( 240 | $(#[serde(rename = $json_name)])? 241 | $flag, 242 | )* 243 | } 244 | } 245 | } 246 | 247 | macro_rules! define_test_group { 248 | ( $( $($json_name:literal =>)? $field_name:ident: $type:ty $(| $deser_fn:expr)? ),* $(,)?) => { 249 | #[derive(Debug, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 250 | #[serde(deny_unknown_fields)] 251 | pub struct TestGroup { 252 | $( 253 | $(#[serde(deserialize_with = $deser_fn)])? 254 | $(#[serde(rename = $json_name)])? 255 | pub $field_name: $type, 256 | )* 257 | #[serde(rename = "type")] 258 | pub test_type: TestGroupTypeId, 259 | pub tests: Vec, 260 | } 261 | } 262 | } 263 | 264 | macro_rules! define_test { 265 | ( $( $($json_name:literal =>)? $field_name:ident: $type:ty ),* $(,)?) => { 266 | #[derive(Debug, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 267 | #[serde(deny_unknown_fields)] 268 | pub struct Test { 269 | #[serde(rename = "tcId")] 270 | pub tc_id: usize, 271 | pub comment: String, 272 | $( 273 | $(#[serde(rename = $json_name)])? 274 | pub $field_name: $type, 275 | )* 276 | pub result: TestResult, 277 | #[serde(default)] 278 | pub flags: Vec, 279 | } 280 | } 281 | } 282 | 283 | macro_rules! define_test_set { 284 | ( $schema_type:expr, $( $schema_name:expr ),* ) => { 285 | 286 | #[derive(Debug, Clone, Hash, Eq, PartialEq)] 287 | struct TestSchema { 288 | pub schema: String, 289 | } 290 | 291 | impl<'de> Deserialize<'de> for TestSchema { 292 | fn deserialize>(deserializer: D) -> Result { 293 | let s: &str = Deserialize::deserialize(deserializer)?; 294 | 295 | match s { 296 | $( 297 | $schema_name => Ok(Self { schema: s.to_string() }), 298 | )* 299 | unknown => Err(D::Error::custom(format!("unknown {} schema {}", $schema_type, unknown))), 300 | } 301 | } 302 | } 303 | 304 | #[doc = "A group of "] 305 | #[doc = $schema_type] 306 | #[doc = " tests."] 307 | #[derive(Debug, Clone, Eq, PartialEq, serde_derive::Deserialize)] 308 | #[serde(deny_unknown_fields)] 309 | pub struct TestSet { 310 | pub algorithm: Algorithm, 311 | #[serde(rename = "generatorVersion")] 312 | pub generator_version: Option, 313 | #[serde(rename = "numberOfTests")] 314 | pub number_of_tests: usize, 315 | #[serde(deserialize_with = "combine_header")] 316 | pub header: String, 317 | pub notes: std::collections::HashMap, 318 | schema: TestSchema, 319 | #[serde(rename = "testGroups")] 320 | pub test_groups: Vec, 321 | } 322 | 323 | impl TestSet { 324 | fn check(obj: Self) -> Result { 325 | let actual_number_of_tests: usize = 326 | obj.test_groups.iter().map(|tg| tg.tests.len()).sum(); 327 | if obj.number_of_tests != actual_number_of_tests { 328 | return Err(WycheproofError::InvalidData); 329 | } 330 | Ok(obj) 331 | } 332 | 333 | pub fn load(test: TestName) -> Result { 334 | match serde_json::from_str(test.json_data()) { 335 | Ok(set) => Self::check(set), 336 | Err(e) => Err(WycheproofError::ParsingFailed(Box::new(e))), 337 | } 338 | } 339 | } 340 | }; 341 | } 342 | 343 | /// The expected result of a Wycheproof test 344 | #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 345 | pub enum TestResult { 346 | /// The test is expected to pass 347 | #[serde(rename = "valid")] 348 | Valid, 349 | /// The test is expected to fail 350 | #[serde(rename = "invalid")] 351 | Invalid, 352 | /// The test is allowed to pass but may reasonably fail for policy reasons 353 | /// (eg for a valid signature when the hash function used is too weak) 354 | #[serde(rename = "acceptable")] 355 | Acceptable, 356 | } 357 | 358 | impl TestResult { 359 | /// Return true if this test *must* fail 360 | pub fn must_fail(&self) -> bool { 361 | match self { 362 | Self::Valid => false, 363 | Self::Acceptable => false, 364 | Self::Invalid => true, 365 | } 366 | } 367 | } 368 | 369 | /// Prime order elliptic curves 370 | #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 371 | pub enum EllipticCurve { 372 | #[serde(rename = "secp160r1")] 373 | Secp160r1, 374 | #[serde(rename = "secp160r2")] 375 | Secp160r2, 376 | #[serde(rename = "secp160k1")] 377 | Secp160k1, 378 | #[serde(rename = "secp192r1")] 379 | Secp192r1, 380 | #[serde(rename = "secp192k1")] 381 | Secp192k1, 382 | #[serde(rename = "secp224r1")] 383 | Secp224r1, 384 | #[serde(rename = "secp256r1", alias = "P-256")] 385 | Secp256r1, 386 | #[serde(rename = "secp384r1", alias = "P-384")] 387 | Secp384r1, 388 | #[serde(rename = "secp521r1", alias = "P-521")] 389 | Secp521r1, 390 | 391 | #[serde(rename = "secp224k1")] 392 | Secp224k1, 393 | #[serde(rename = "secp256k1", alias = "P-256K")] 394 | Secp256k1, 395 | 396 | #[serde(rename = "brainpoolP224r1")] 397 | Brainpool224r1, 398 | #[serde(rename = "brainpoolP256r1")] 399 | Brainpool256r1, 400 | #[serde(rename = "brainpoolP320r1")] 401 | Brainpool320r1, 402 | #[serde(rename = "brainpoolP384r1")] 403 | Brainpool384r1, 404 | #[serde(rename = "brainpoolP512r1")] 405 | Brainpool512r1, 406 | 407 | #[serde(rename = "brainpoolP224t1")] 408 | Brainpool224t1, 409 | #[serde(rename = "brainpoolP256t1")] 410 | Brainpool256t1, 411 | #[serde(rename = "brainpoolP320t1")] 412 | Brainpool320t1, 413 | #[serde(rename = "brainpoolP384t1")] 414 | Brainpool384t1, 415 | #[serde(rename = "brainpoolP512t1")] 416 | Brainpool512t1, 417 | } 418 | 419 | /// Hash Function identifiers 420 | #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 421 | pub enum HashFunction { 422 | #[serde(rename = "SHA-1")] 423 | Sha1, 424 | 425 | #[serde(rename = "SHA-224")] 426 | Sha2_224, 427 | #[serde(rename = "SHA-256")] 428 | Sha2_256, 429 | #[serde(rename = "SHA-384")] 430 | Sha2_384, 431 | #[serde(rename = "SHA-512")] 432 | Sha2_512, 433 | 434 | #[serde(rename = "SHA-512/224")] 435 | Sha2_512_224, 436 | 437 | #[serde(rename = "SHA-512/256")] 438 | Sha2_512_256, 439 | 440 | #[serde(rename = "SHA3-224")] 441 | Sha3_224, 442 | #[serde(rename = "SHA3-256")] 443 | Sha3_256, 444 | #[serde(rename = "SHA3-384")] 445 | Sha3_384, 446 | #[serde(rename = "SHA3-512")] 447 | Sha3_512, 448 | 449 | #[serde(rename = "SHAKE128")] 450 | Shake128, 451 | 452 | #[serde(rename = "SHAKE256")] 453 | Shake256, 454 | } 455 | 456 | /// MGF identifiers 457 | #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 458 | pub enum Mgf { 459 | #[serde(rename = "MGF1")] 460 | Mgf1, 461 | #[serde(rename = "SHAKE128")] 462 | Shake128, 463 | #[serde(rename = "SHAKE256")] 464 | Shake256, 465 | } 466 | 467 | /// Edwards curves 468 | #[cfg(feature = "eddsa")] 469 | #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 470 | pub enum EdwardsCurve { 471 | #[serde(alias = "edwards25519")] 472 | Ed25519, 473 | #[serde(alias = "edwards448")] 474 | Ed448, 475 | } 476 | 477 | /// Montgomery curves 478 | #[cfg(feature = "xdh")] 479 | #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 480 | pub enum MontgomeryCurve { 481 | #[serde(alias = "curve25519")] 482 | X25519, 483 | #[serde(alias = "curve448")] 484 | X448, 485 | } 486 | 487 | #[derive(Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 488 | #[serde(transparent)] 489 | pub struct ByteString { 490 | #[serde(deserialize_with = "vec_from_hex")] 491 | value: Vec, 492 | } 493 | 494 | #[derive(Debug, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 495 | pub struct Source { 496 | name: String, 497 | version: String, 498 | } 499 | 500 | impl ByteString { 501 | pub fn len(&self) -> usize { 502 | self.value.len() 503 | } 504 | 505 | pub fn is_empty(&self) -> bool { 506 | self.value.is_empty() 507 | } 508 | } 509 | 510 | impl fmt::Debug for ByteString { 511 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 512 | write!(f, "\"{}\"", data_encoding::HEXLOWER.encode(&self.value)) 513 | } 514 | } 515 | 516 | impl std::ops::Deref for ByteString { 517 | type Target = Vec; 518 | 519 | fn deref(&self) -> &Self::Target { 520 | &self.value 521 | } 522 | } 523 | 524 | impl AsRef<[u8]> for ByteString { 525 | fn as_ref(&self) -> &[u8] { 526 | &self.value 527 | } 528 | } 529 | 530 | #[derive(Debug, Clone, Hash, Eq, PartialEq, serde_derive::Deserialize)] 531 | #[serde(transparent)] 532 | pub struct LargeInteger { 533 | #[serde(deserialize_with = "vec_from_hex")] 534 | value: Vec, 535 | } 536 | 537 | impl std::ops::Deref for LargeInteger { 538 | type Target = Vec; 539 | 540 | fn deref(&self) -> &Self::Target { 541 | &self.value 542 | } 543 | } 544 | 545 | impl AsRef<[u8]> for LargeInteger { 546 | fn as_ref(&self) -> &[u8] { 547 | &self.value 548 | } 549 | } 550 | 551 | impl LargeInteger { 552 | fn new(value: Vec) -> Self { 553 | Self { value } 554 | } 555 | 556 | #[cfg(feature = "num-bigint")] 557 | pub fn as_num_bigint(&self) -> num_bigint::BigUint { 558 | num_bigint::BigUint::from_bytes_be(&self.value) 559 | } 560 | } 561 | 562 | mod test_keys; 563 | #[allow(unused_imports)] 564 | pub use test_keys::*; 565 | 566 | #[cfg(feature = "aead")] 567 | pub mod aead; 568 | 569 | #[cfg(feature = "cipher")] 570 | pub mod cipher; 571 | 572 | #[cfg(feature = "dsa")] 573 | pub mod dsa; 574 | 575 | #[cfg(feature = "ec")] 576 | pub mod ec_curve; 577 | 578 | #[cfg(feature = "ecdh")] 579 | pub mod ecdh; 580 | 581 | #[cfg(feature = "ecdsa")] 582 | pub mod ecdsa; 583 | 584 | #[cfg(feature = "eddsa")] 585 | pub mod eddsa; 586 | 587 | #[cfg(feature = "fpe")] 588 | pub mod fpe_list; 589 | 590 | #[cfg(feature = "fpe")] 591 | pub mod fpe_str; 592 | 593 | #[cfg(feature = "hkdf")] 594 | pub mod hkdf; 595 | 596 | #[cfg(feature = "keywrap")] 597 | pub mod keywrap; 598 | 599 | #[cfg(feature = "mac")] 600 | pub mod mac; 601 | 602 | #[cfg(feature = "mac")] 603 | pub mod mac_with_nonce; 604 | 605 | #[cfg(feature = "primality")] 606 | pub mod primality; 607 | 608 | #[cfg(feature = "rsa_enc")] 609 | pub mod rsa_oaep; 610 | 611 | #[cfg(feature = "rsa_enc")] 612 | pub mod rsa_pkcs1_decrypt; 613 | 614 | #[cfg(feature = "rsa_sig")] 615 | pub mod rsa_pkcs1_verify; 616 | 617 | #[cfg(feature = "rsa_sig")] 618 | pub mod rsa_pss_verify; 619 | 620 | #[cfg(feature = "xdh")] 621 | pub mod xdh; 622 | 623 | #[cfg(feature = "mldsa_sign")] 624 | pub mod mldsa_sign; 625 | 626 | #[cfg(feature = "mldsa_verify")] 627 | pub mod mldsa_verify; 628 | -------------------------------------------------------------------------------- /src/data/ec_prime_order_curves_test.json: -------------------------------------------------------------------------------- 1 | { 2 | "algorithm" : "EcCurveTest", 3 | "schema" : "ec_curve_test_schema.json", 4 | "generatorVersion" : "0.9rc5", 5 | "numberOfTests" : 26, 6 | "header" : [ 7 | "Test vectors of type EcCurveTest are for checking curve parameters." 8 | ], 9 | "notes" : { 10 | }, 11 | "testGroups" : [ 12 | { 13 | "type" : "EcCurveTest", 14 | "tests" : [ 15 | { 16 | "tcId" : 1, 17 | "comment" : "", 18 | "flags" : [], 19 | "name" : "secp224r1", 20 | "oid" : "1.3.132.0.33", 21 | "ref" : "ANSI X9.62", 22 | "p" : "00ffffffffffffffffffffffffffffffff000000000000000000000001", 23 | "n" : "00ffffffffffffffffffffffffffff16a2e0b8f03e13dd29455c5c2a3d", 24 | "a" : "00fffffffffffffffffffffffffffffffefffffffffffffffffffffffe", 25 | "b" : "00b4050a850c04b3abf54132565044b0b7d7bfd8ba270b39432355ffb4", 26 | "gx" : "00b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21", 27 | "gy" : "00bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34", 28 | "h" : 1, 29 | "result" : "valid" 30 | }, 31 | { 32 | "tcId" : 2, 33 | "comment" : "", 34 | "flags" : [], 35 | "name" : "secp256r1", 36 | "oid" : "1.2.840.10045.3.1.7", 37 | "ref" : "ANSI X9.62", 38 | "p" : "00ffffffff00000001000000000000000000000000ffffffffffffffffffffffff", 39 | "n" : "00ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551", 40 | "a" : "00ffffffff00000001000000000000000000000000fffffffffffffffffffffffc", 41 | "b" : "5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b", 42 | "gx" : "6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296", 43 | "gy" : "4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5", 44 | "h" : 1, 45 | "result" : "valid" 46 | }, 47 | { 48 | "tcId" : 3, 49 | "comment" : "", 50 | "flags" : [], 51 | "name" : "secp384r1", 52 | "oid" : "1.3.132.0.34", 53 | "ref" : "ANSI X9.62", 54 | "p" : "00fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff", 55 | "n" : "00ffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973", 56 | "a" : "00fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc", 57 | "b" : "00b3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef", 58 | "gx" : "00aa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7", 59 | "gy" : "3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f", 60 | "h" : 1, 61 | "result" : "valid" 62 | }, 63 | { 64 | "tcId" : 4, 65 | "comment" : "", 66 | "flags" : [], 67 | "name" : "secp521r1", 68 | "oid" : "1.3.132.0.35", 69 | "ref" : "ANSI X9.62", 70 | "p" : "01ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 71 | "n" : "01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409", 72 | "a" : "01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc", 73 | "b" : "51953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00", 74 | "gx" : "00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66", 75 | "gy" : "011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650", 76 | "h" : 1, 77 | "result" : "valid" 78 | }, 79 | { 80 | "tcId" : 5, 81 | "comment" : "", 82 | "flags" : [], 83 | "name" : "secp256k1", 84 | "oid" : "1.3.132.0.10", 85 | "ref" : "https://www.secg.org/sec2-v2.pdf", 86 | "p" : "00fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", 87 | "n" : "00fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", 88 | "a" : "00", 89 | "b" : "07", 90 | "gx" : "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", 91 | "gy" : "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8", 92 | "h" : 1, 93 | "result" : "valid" 94 | }, 95 | { 96 | "tcId" : 6, 97 | "comment" : "", 98 | "flags" : [], 99 | "name" : "secp224k1", 100 | "oid" : "1.3.132.0.32", 101 | "ref" : "ANSI X9.62", 102 | "p" : "00fffffffffffffffffffffffffffffffffffffffffffffffeffffe56d", 103 | "n" : "010000000000000000000000000001dce8d2ec6184caf0a971769fb1f7", 104 | "a" : "00", 105 | "b" : "05", 106 | "gx" : "00a1455b334df099df30fc28a169a467e9e47075a90f7e650eb6b7a45c", 107 | "gy" : "7e089fed7fba344282cafbd6f7e319f7c0b0bd59e2ca4bdb556d61a5", 108 | "h" : 1, 109 | "result" : "valid" 110 | }, 111 | { 112 | "tcId" : 7, 113 | "comment" : "", 114 | "flags" : [], 115 | "name" : "brainpoolP224r1", 116 | "oid" : "1.3.36.3.3.2.8.1.1.5", 117 | "ref" : "RFC 5639", 118 | "p" : "00d7c134aa264366862a18302575d1d787b09f075797da89f57ec8c0ff", 119 | "n" : "00d7c134aa264366862a18302575d0fb98d116bc4b6ddebca3a5a7939f", 120 | "a" : "68a5e62ca9ce6c1c299803a6c1530b514e182ad8b0042a59cad29f43", 121 | "b" : "2580f63ccfe44138870713b1a92369e33e2135d266dbb372386c400b", 122 | "gx" : "0d9029ad2c7e5cf4340823b2a87dc68c9e4ce3174c1e6efdee12c07d", 123 | "gy" : "58aa56f772c0726f24c6b89e4ecdac24354b9e99caa3f6d3761402cd", 124 | "h" : 1, 125 | "result" : "valid" 126 | }, 127 | { 128 | "tcId" : 8, 129 | "comment" : "", 130 | "flags" : [], 131 | "name" : "brainpoolP256r1", 132 | "oid" : "1.3.36.3.3.2.8.1.1.7", 133 | "ref" : "RFC 5639", 134 | "p" : "00a9fb57dba1eea9bc3e660a909d838d726e3bf623d52620282013481d1f6e5377", 135 | "n" : "00a9fb57dba1eea9bc3e660a909d838d718c397aa3b561a6f7901e0e82974856a7", 136 | "a" : "7d5a0975fc2c3057eef67530417affe7fb8055c126dc5c6ce94a4b44f330b5d9", 137 | "b" : "26dc5c6ce94a4b44f330b5d9bbd77cbf958416295cf7e1ce6bccdc18ff8c07b6", 138 | "gx" : "008bd2aeb9cb7e57cb2c4b482ffc81b7afb9de27e1e3bd23c23a4453bd9ace3262", 139 | "gy" : "547ef835c3dac4fd97f8461a14611dc9c27745132ded8e545c1d54c72f046997", 140 | "h" : 1, 141 | "result" : "valid" 142 | }, 143 | { 144 | "tcId" : 9, 145 | "comment" : "", 146 | "flags" : [], 147 | "name" : "brainpoolP320r1", 148 | "oid" : "1.3.36.3.3.2.8.1.1.9", 149 | "ref" : "RFC 5639", 150 | "p" : "00d35e472036bc4fb7e13c785ed201e065f98fcfa6f6f40def4f92b9ec7893ec28fcd412b1f1b32e27", 151 | "n" : "00d35e472036bc4fb7e13c785ed201e065f98fcfa5b68f12a32d482ec7ee8658e98691555b44c59311", 152 | "a" : "3ee30b568fbab0f883ccebd46d3f3bb8a2a73513f5eb79da66190eb085ffa9f492f375a97d860eb4", 153 | "b" : "520883949dfdbc42d3ad198640688a6fe13f41349554b49acc31dccd884539816f5eb4ac8fb1f1a6", 154 | "gx" : "43bd7e9afb53d8b85289bcc48ee5bfe6f20137d10a087eb6e7871e2a10a599c710af8d0d39e20611", 155 | "gy" : "14fdd05545ec1cc8ab4093247f77275e0743ffed117182eaa9c77877aaac6ac7d35245d1692e8ee1", 156 | "h" : 1, 157 | "result" : "valid" 158 | }, 159 | { 160 | "tcId" : 10, 161 | "comment" : "", 162 | "flags" : [], 163 | "name" : "brainpoolP384r1", 164 | "oid" : "1.3.36.3.3.2.8.1.1.11", 165 | "ref" : "RFC 5639", 166 | "p" : "008cb91e82a3386d280f5d6f7e50e641df152f7109ed5456b412b1da197fb71123acd3a729901d1a71874700133107ec53", 167 | "n" : "008cb91e82a3386d280f5d6f7e50e641df152f7109ed5456b31f166e6cac0425a7cf3ab6af6b7fc3103b883202e9046565", 168 | "a" : "7bc382c63d8c150c3c72080ace05afa0c2bea28e4fb22787139165efba91f90f8aa5814a503ad4eb04a8c7dd22ce2826", 169 | "b" : "04a8c7dd22ce28268b39b55416f0447c2fb77de107dcd2a62e880ea53eeb62d57cb4390295dbc9943ab78696fa504c11", 170 | "gx" : "1d1c64f068cf45ffa2a63a81b7c13f6b8847a3e77ef14fe3db7fcafe0cbd10e8e826e03436d646aaef87b2e247d4af1e", 171 | "gy" : "008abe1d7520f9c2a45cb1eb8e95cfd55262b70b29feec5864e19c054ff99129280e4646217791811142820341263c5315", 172 | "h" : 1, 173 | "result" : "valid" 174 | }, 175 | { 176 | "tcId" : 11, 177 | "comment" : "", 178 | "flags" : [], 179 | "name" : "brainpoolP512r1", 180 | "oid" : "1.3.36.3.3.2.8.1.1.13", 181 | "ref" : "RFC 5639", 182 | "p" : "00aadd9db8dbe9c48b3fd4e6ae33c9fc07cb308db3b3c9d20ed6639cca703308717d4d9b009bc66842aecda12ae6a380e62881ff2f2d82c68528aa6056583a48f3", 183 | "n" : "00aadd9db8dbe9c48b3fd4e6ae33c9fc07cb308db3b3c9d20ed6639cca70330870553e5c414ca92619418661197fac10471db1d381085ddaddb58796829ca90069", 184 | "a" : "7830a3318b603b89e2327145ac234cc594cbdd8d3df91610a83441caea9863bc2ded5d5aa8253aa10a2ef1c98b9ac8b57f1117a72bf2c7b9e7c1ac4d77fc94ca", 185 | "b" : "3df91610a83441caea9863bc2ded5d5aa8253aa10a2ef1c98b9ac8b57f1117a72bf2c7b9e7c1ac4d77fc94cadc083e67984050b75ebae5dd2809bd638016f723", 186 | "gx" : "0081aee4bdd82ed9645a21322e9c4c6a9385ed9f70b5d916c1b43b62eef4d0098eff3b1f78e2d0d48d50d1687b93b97d5f7c6d5047406a5e688b352209bcb9f822", 187 | "gy" : "7dde385d566332ecc0eabfa9cf7822fdf209f70024a57b1aa000c55b881f8111b2dcde494a5f485e5bca4bd88a2763aed1ca2b2fa8f0540678cd1e0f3ad80892", 188 | "h" : 1, 189 | "result" : "valid" 190 | }, 191 | { 192 | "tcId" : 12, 193 | "comment" : "", 194 | "flags" : [], 195 | "name" : "brainpoolP224t1", 196 | "oid" : "1.3.36.3.3.2.8.1.1.6", 197 | "ref" : "RFC 5639", 198 | "p" : "00d7c134aa264366862a18302575d1d787b09f075797da89f57ec8c0ff", 199 | "n" : "00d7c134aa264366862a18302575d0fb98d116bc4b6ddebca3a5a7939f", 200 | "a" : "00d7c134aa264366862a18302575d1d787b09f075797da89f57ec8c0fc", 201 | "b" : "4b337d934104cd7bef271bf60ced1ed20da14c08b3bb64f18a60888d", 202 | "gx" : "6ab1e344ce25ff3896424e7ffe14762ecb49f8928ac0c76029b4d580", 203 | "gy" : "0374e9f5143e568cd23f3f4d7c0d4b1e41c8cc0d1c6abd5f1a46db4c", 204 | "h" : 1, 205 | "result" : "valid" 206 | }, 207 | { 208 | "tcId" : 13, 209 | "comment" : "", 210 | "flags" : [], 211 | "name" : "brainpoolP256t1", 212 | "oid" : "1.3.36.3.3.2.8.1.1.8", 213 | "ref" : "RFC 5639", 214 | "p" : "00a9fb57dba1eea9bc3e660a909d838d726e3bf623d52620282013481d1f6e5377", 215 | "n" : "00a9fb57dba1eea9bc3e660a909d838d718c397aa3b561a6f7901e0e82974856a7", 216 | "a" : "00a9fb57dba1eea9bc3e660a909d838d726e3bf623d52620282013481d1f6e5374", 217 | "b" : "662c61c430d84ea4fe66a7733d0b76b7bf93ebc4af2f49256ae58101fee92b04", 218 | "gx" : "00a3e8eb3cc1cfe7b7732213b23a656149afa142c47aafbc2b79a191562e1305f4", 219 | "gy" : "2d996c823439c56d7f7b22e14644417e69bcb6de39d027001dabe8f35b25c9be", 220 | "h" : 1, 221 | "result" : "valid" 222 | }, 223 | { 224 | "tcId" : 14, 225 | "comment" : "", 226 | "flags" : [], 227 | "name" : "brainpoolP320t1", 228 | "oid" : "1.3.36.3.3.2.8.1.1.10", 229 | "ref" : "RFC 5639", 230 | "p" : "00d35e472036bc4fb7e13c785ed201e065f98fcfa6f6f40def4f92b9ec7893ec28fcd412b1f1b32e27", 231 | "n" : "00d35e472036bc4fb7e13c785ed201e065f98fcfa5b68f12a32d482ec7ee8658e98691555b44c59311", 232 | "a" : "00d35e472036bc4fb7e13c785ed201e065f98fcfa6f6f40def4f92b9ec7893ec28fcd412b1f1b32e24", 233 | "b" : "00a7f561e038eb1ed560b3d147db782013064c19f27ed27c6780aaf77fb8a547ceb5b4fef422340353", 234 | "gx" : "00925be9fb01afc6fb4d3e7d4990010f813408ab106c4f09cb7ee07868cc136fff3357f624a21bed52", 235 | "gy" : "63ba3a7a27483ebf6671dbef7abb30ebee084e58a0b077ad42a5a0989d1ee71b1b9bc0455fb0d2c3", 236 | "h" : 1, 237 | "result" : "valid" 238 | }, 239 | { 240 | "tcId" : 15, 241 | "comment" : "", 242 | "flags" : [], 243 | "name" : "brainpoolP384t1", 244 | "oid" : "1.3.36.3.3.2.8.1.1.12", 245 | "ref" : "RFC 5639", 246 | "p" : "008cb91e82a3386d280f5d6f7e50e641df152f7109ed5456b412b1da197fb71123acd3a729901d1a71874700133107ec53", 247 | "n" : "008cb91e82a3386d280f5d6f7e50e641df152f7109ed5456b31f166e6cac0425a7cf3ab6af6b7fc3103b883202e9046565", 248 | "a" : "008cb91e82a3386d280f5d6f7e50e641df152f7109ed5456b412b1da197fb71123acd3a729901d1a71874700133107ec50", 249 | "b" : "7f519eada7bda81bd826dba647910f8c4b9346ed8ccdc64e4b1abd11756dce1d2074aa263b88805ced70355a33b471ee", 250 | "gx" : "18de98b02db9a306f2afcd7235f72a819b80ab12ebd653172476fecd462aabffc4ff191b946a5f54d8d0aa2f418808cc", 251 | "gy" : "25ab056962d30651a114afd2755ad336747f93475b7a1fca3b88f2b6a208ccfe469408584dc2b2912675bf5b9e582928", 252 | "h" : 1, 253 | "result" : "valid" 254 | }, 255 | { 256 | "tcId" : 16, 257 | "comment" : "", 258 | "flags" : [], 259 | "name" : "brainpoolP512t1", 260 | "oid" : "1.3.36.3.3.2.8.1.1.14", 261 | "ref" : "RFC 5639", 262 | "p" : "00aadd9db8dbe9c48b3fd4e6ae33c9fc07cb308db3b3c9d20ed6639cca703308717d4d9b009bc66842aecda12ae6a380e62881ff2f2d82c68528aa6056583a48f3", 263 | "n" : "00aadd9db8dbe9c48b3fd4e6ae33c9fc07cb308db3b3c9d20ed6639cca70330870553e5c414ca92619418661197fac10471db1d381085ddaddb58796829ca90069", 264 | "a" : "00aadd9db8dbe9c48b3fd4e6ae33c9fc07cb308db3b3c9d20ed6639cca703308717d4d9b009bc66842aecda12ae6a380e62881ff2f2d82c68528aa6056583a48f0", 265 | "b" : "7cbbbcf9441cfab76e1890e46884eae321f70c0bcb4981527897504bec3e36a62bcdfa2304976540f6450085f2dae145c22553b465763689180ea2571867423e", 266 | "gx" : "640ece5c12788717b9c1ba06cbc2a6feba85842458c56dde9db1758d39c0313d82ba51735cdb3ea499aa77a7d6943a64f7a3f25fe26f06b51baa2696fa9035da", 267 | "gy" : "5b534bd595f5af0fa2c892376c84ace1bb4e3019b71634c01131159cae03cee9d9932184beef216bd71df2dadf86a627306ecff96dbb8bace198b61e00f8b332", 268 | "h" : 1, 269 | "result" : "valid" 270 | }, 271 | { 272 | "tcId" : 17, 273 | "comment" : "", 274 | "flags" : [], 275 | "name" : "FRP256v1", 276 | "oid" : "1.2.250.1.223.101.256.1", 277 | "ref" : "https://www.legifrance.gouv.fr/jorf/id/JORFTEXT000024668816", 278 | "p" : "00f1fd178c0b3ad58f10126de8ce42435b3961adbcabc8ca6de8fcf353d86e9c03", 279 | "n" : "00f1fd178c0b3ad58f10126de8ce42435b53dc67e140d2bf941ffdd459c6d655e1", 280 | "a" : "00f1fd178c0b3ad58f10126de8ce42435b3961adbcabc8ca6de8fcf353d86e9c00", 281 | "b" : "00ee353fca5428a9300d4aba754a44c00fdfec0c9ae4b1a1803075ed967b7bb73f", 282 | "gx" : "00b6b3d4c356c139eb31183d4749d423958c27d2dcaf98b70164c97a2dd98f5cff", 283 | "gy" : "6142e0f7c8b204911f9271f0f3ecef8c2701c307e8e4c9e183115a1554062cfb", 284 | "h" : 1, 285 | "result" : "valid" 286 | }, 287 | { 288 | "tcId" : 18, 289 | "comment" : "", 290 | "flags" : [], 291 | "name" : "secp192k1", 292 | "oid" : "1.3.132.0.31", 293 | "ref" : "ANSI X9.62", 294 | "p" : "00fffffffffffffffffffffffffffffffffffffffeffffee37", 295 | "n" : "00fffffffffffffffffffffffe26f2fc170f69466a74defd8d", 296 | "a" : "00", 297 | "b" : "03", 298 | "gx" : "00db4ff10ec057e9ae26b07d0280b7f4341da5d1b1eae06c7d", 299 | "gy" : "009b2f2f6d9c5628a7844163d015be86344082aa88d95e2f9d", 300 | "h" : 1, 301 | "result" : "valid" 302 | }, 303 | { 304 | "tcId" : 19, 305 | "comment" : "", 306 | "flags" : [], 307 | "name" : "secp192r1", 308 | "oid" : "1.2.840.10045.3.1.1", 309 | "ref" : "ANSI X9.62", 310 | "p" : "00fffffffffffffffffffffffffffffffeffffffffffffffff", 311 | "n" : "00ffffffffffffffffffffffff99def836146bc9b1b4d22831", 312 | "a" : "00fffffffffffffffffffffffffffffffefffffffffffffffc", 313 | "b" : "64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 314 | "gx" : "188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012", 315 | "gy" : "07192b95ffc8da78631011ed6b24cdd573f977a11e794811", 316 | "h" : 1, 317 | "result" : "valid" 318 | }, 319 | { 320 | "tcId" : 20, 321 | "comment" : "", 322 | "flags" : [], 323 | "name" : "secp160k1", 324 | "oid" : "1.3.132.0.9", 325 | "ref" : "https://www.secg.org/SEC2-Ver-1.0.pdf", 326 | "p" : "00fffffffffffffffffffffffffffffffeffffac73", 327 | "n" : "0100000000000000000001b8fa16dfab9aca16b6b3", 328 | "a" : "00", 329 | "b" : "07", 330 | "gx" : "3b4c382ce37aa192a4019e763036f4f5dd4d7ebb", 331 | "gy" : "00938cf935318fdced6bc28286531733c3f03c4fee", 332 | "h" : 1, 333 | "result" : "valid" 334 | }, 335 | { 336 | "tcId" : 21, 337 | "comment" : "", 338 | "flags" : [], 339 | "name" : "secp160r1", 340 | "oid" : "1.3.132.0.8", 341 | "ref" : "https://www.secg.org/SEC2-Ver-1.0.pdf", 342 | "p" : "00ffffffffffffffffffffffffffffffff7fffffff", 343 | "n" : "0100000000000000000001f4c8f927aed3ca752257", 344 | "a" : "00ffffffffffffffffffffffffffffffff7ffffffc", 345 | "b" : "1c97befc54bd7a8b65acf89f81d4d4adc565fa45", 346 | "gx" : "4a96b5688ef573284664698968c38bb913cbfc82", 347 | "gy" : "23a628553168947d59dcc912042351377ac5fb32", 348 | "h" : 1, 349 | "result" : "valid" 350 | }, 351 | { 352 | "tcId" : 22, 353 | "comment" : "", 354 | "flags" : [], 355 | "name" : "secp160r2", 356 | "oid" : "1.3.132.0.30", 357 | "ref" : "https://www.secg.org/SEC2-Ver-1.0.pdf", 358 | "p" : "00fffffffffffffffffffffffffffffffeffffac73", 359 | "n" : "0100000000000000000000351ee786a818f3a1a16b", 360 | "a" : "00fffffffffffffffffffffffffffffffeffffac70", 361 | "b" : "00b4e134d3fb59eb8bab57274904664d5af50388ba", 362 | "gx" : "52dcb034293a117e1f4ff11b30f7199d3144ce6d", 363 | "gy" : "00feaffef2e331f296e071fa0df9982cfea7d43f2e", 364 | "h" : 1, 365 | "result" : "valid" 366 | }, 367 | { 368 | "tcId" : 23, 369 | "comment" : "", 370 | "flags" : [], 371 | "name" : "brainpoolP160r1", 372 | "oid" : "1.3.36.3.3.2.8.1.1.1", 373 | "ref" : "RFC 5639", 374 | "p" : "00e95e4a5f737059dc60dfc7ad95b3d8139515620f", 375 | "n" : "00e95e4a5f737059dc60df5991d45029409e60fc09", 376 | "a" : "340e7be2a280eb74e2be61bada745d97e8f7c300", 377 | "b" : "1e589a8595423412134faa2dbdec95c8d8675e58", 378 | "gx" : "00bed5af16ea3f6a4f62938c4631eb5af7bdbcdbc3", 379 | "gy" : "1667cb477a1a8ec338f94741669c976316da6321", 380 | "h" : 1, 381 | "result" : "valid" 382 | }, 383 | { 384 | "tcId" : 24, 385 | "comment" : "", 386 | "flags" : [], 387 | "name" : "brainpoolP160t1", 388 | "oid" : "1.3.36.3.3.2.8.1.1.2", 389 | "ref" : "RFC 5639", 390 | "p" : "00e95e4a5f737059dc60dfc7ad95b3d8139515620f", 391 | "n" : "00e95e4a5f737059dc60df5991d45029409e60fc09", 392 | "a" : "00e95e4a5f737059dc60dfc7ad95b3d8139515620c", 393 | "b" : "7a556b6dae535b7b51ed2c4d7daa7a0b5c55f380", 394 | "gx" : "00b199b13b9b34efc1397e64baeb05acc265ff2378", 395 | "gy" : "00add6718b7c7c1961f0991b842443772152c9e0ad", 396 | "h" : 1, 397 | "result" : "valid" 398 | }, 399 | { 400 | "tcId" : 25, 401 | "comment" : "", 402 | "flags" : [], 403 | "name" : "brainpoolP192r1", 404 | "oid" : "1.3.36.3.3.2.8.1.1.3", 405 | "ref" : "RFC 5639", 406 | "p" : "00c302f41d932a36cda7a3463093d18db78fce476de1a86297", 407 | "n" : "00c302f41d932a36cda7a3462f9e9e916b5be8f1029ac4acc1", 408 | "a" : "6a91174076b1e0e19c39c031fe8685c1cae040e5c69a28ef", 409 | "b" : "469a28ef7c28cca3dc721d044f4496bcca7ef4146fbf25c9", 410 | "gx" : "00c0a0647eaab6a48753b033c56cb0f0900a2f5c4853375fd6", 411 | "gy" : "14b690866abd5bb88b5f4828c1490002e6773fa2fa299b8f", 412 | "h" : 1, 413 | "result" : "valid" 414 | }, 415 | { 416 | "tcId" : 26, 417 | "comment" : "", 418 | "flags" : [], 419 | "name" : "brainpoolP192t1", 420 | "oid" : "1.3.36.3.3.2.8.1.1.4", 421 | "ref" : "RFC 5639", 422 | "p" : "00c302f41d932a36cda7a3463093d18db78fce476de1a86297", 423 | "n" : "00c302f41d932a36cda7a3462f9e9e916b5be8f1029ac4acc1", 424 | "a" : "00c302f41d932a36cda7a3463093d18db78fce476de1a86294", 425 | "b" : "13d56ffaec78681e68f9deb43b35bec2fb68542e27897b79", 426 | "gx" : "3ae9e58c82f63c30282e1fe7bbf43fa72c446af6f4618129", 427 | "gy" : "097e2c5667c2223a902ab5ca449d0084b7e5b3de7ccc01c9", 428 | "h" : 1, 429 | "result" : "valid" 430 | } 431 | ] 432 | } 433 | ] 434 | } 435 | --------------------------------------------------------------------------------