diff options
author | Aviv Palivoda <palaviv@gmail.com> | 2017-03-06 04:24:55 +0200 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2017-03-05 22:24:55 -0400 |
commit | e44efb634fb1db024fcd6e110eacbf59abbc4782 (patch) | |
tree | c651a6852af687260bda8e9feda88f6b64a6b036 /vectors/cryptography_vectors/asymmetric/DH | |
parent | 3bab4e5e356409920e17e2a0aad1eec4f2135e6a (diff) | |
download | cryptography-e44efb634fb1db024fcd6e110eacbf59abbc4782.tar.gz cryptography-e44efb634fb1db024fcd6e110eacbf59abbc4782.tar.bz2 cryptography-e44efb634fb1db024fcd6e110eacbf59abbc4782.zip |
DH subgroup order (q) (#3369)
* Support DH q (subgroup order)
* Change RFC5114.txt to NIST format
* Add tests for DH q
* Update docs for DH q
* Fix pep8
* Improve test covergae for DH q
* Create _dh_params_dup that copy q if DHparams_dup don't
On OpenSSL < 1.0.2 DHparams_dup don't copy q. _dh_params_dup
call DHparams_dup and if the version is smaller than 1.0.2
copy q manually
* Copy q manually on libressl
* Add to test vectors serialized RFC5114 2048 bit DH parameters with 224 bit subgroup
* Support serialization of DH with q
* Add tests for serialization of DH with q
* Support DH serialization with q only if Cryptography_HAS_EVP_PKEY_DHX is true
* Raise exception when trying to serialize DH X9.42 when not supported
* raise unsupported key type when deserilizing DH X9.42 if not supported
* pep8 fixes
* Fix test_serialization
* Add dhx_serialization_supported method to DHBacked
* document q in dh_parameters_supported
* Rename dhx_serialization_supported to dh_x942_serialization_supported
Diffstat (limited to 'vectors/cryptography_vectors/asymmetric/DH')
-rw-r--r-- | vectors/cryptography_vectors/asymmetric/DH/RFC5114.txt | 3 | ||||
-rw-r--r-- | vectors/cryptography_vectors/asymmetric/DH/dhkey_rfc5114_2.der | bin | 0 -> 609 bytes | |||
-rw-r--r-- | vectors/cryptography_vectors/asymmetric/DH/dhkey_rfc5114_2.pem | 15 | ||||
-rw-r--r-- | vectors/cryptography_vectors/asymmetric/DH/dhkey_rfc5114_2.txt | 7 | ||||
-rw-r--r-- | vectors/cryptography_vectors/asymmetric/DH/dhp_rfc5114_2.der | bin | 0 -> 526 bytes | |||
-rw-r--r-- | vectors/cryptography_vectors/asymmetric/DH/dhp_rfc5114_2.pem | 14 | ||||
-rw-r--r-- | vectors/cryptography_vectors/asymmetric/DH/dhpub_rfc5114_2.der | bin | 0 -> 840 bytes | |||
-rw-r--r-- | vectors/cryptography_vectors/asymmetric/DH/dhpub_rfc5114_2.pem | 20 |
8 files changed, 59 insertions, 0 deletions
diff --git a/vectors/cryptography_vectors/asymmetric/DH/RFC5114.txt b/vectors/cryptography_vectors/asymmetric/DH/RFC5114.txt index bb8e238f..08e9c129 100644 --- a/vectors/cryptography_vectors/asymmetric/DH/RFC5114.txt +++ b/vectors/cryptography_vectors/asymmetric/DH/RFC5114.txt @@ -1,4 +1,5 @@ [A.1. 1024-bit MODP Group with 160-bit Prime Order Subgroup] +COUNT=0 P = B10B8F96A080E01DDE92DE5EAE5D54EC52C99FBCFB06A3C69A6A9DCA52D23B616073E28675A23D189838EF1E2EE652C013ECB4AEA906112324975C3CD49B83BFACCBDD7D90C4BD7098488E9C219A73724EFFD6FAE5644738FAA31A4FF55BCCC0A151AF5F0DC8B4BD45BF37DF365C1A65E68CFDA76D4DA708DF1FB2BC2E4A4371 Q = F518AA8781A8DF278ABA4E7D64B7CB9D49462353 G = A4D1CBD5C3FD34126765A442EFB99905F8104DD258AC507FD6406CFF14266D31266FEA1E5C41564B777E690F5504F213160217B4B01B886A5E91547F9E2749F4D7FBD7D3B9A92EE1909D0D2263F80A76A6A24C087A091F531DBF0A0169B6A28AD662A4D18E73AFA32D779D5918D08BC8858F4DCEF97C2A24855E6EEB22B3B2E5 @@ -14,6 +15,7 @@ Z = 5C804F454D30D9C4DF85271F93528C91DF6B48AB5F80B3B59CAAC1B28F8ACBA9CD3E39F3CB61 Result = P (0 - Correct) [A.2.2048-bitMODPGroupwith224-bitPrimeOrderSubgroup] +COUNT=1 P = AD107E1E9123A9D0D660FAA79559C51FA20D64E5683B9FD1B54B1597B61D0A75E6FA141DF95A56DBAF9A3C407BA1DF15EB3D688A309C180E1DE6B85A1274A0A66D3F8152AD6AC2129037C9EDEFDA4DF8D91E8FEF55B7394B7AD5B7D0B6C12207C9F98D11ED34DBF6C6BA0B2C8BBC27BE6A00E0A0B9C49708B3BF8A317091883681286130BC8985DB1602E714415D9330278273C7DE31EFDC7310F7121FD5A07415987D9ADC0A486DCDF93ACC44328387315D75E198C641A480CD86A1B9E587E8BE60E69CC928B2B9C52172E413042E9B23F10B0E16E79763C9B53DCF4BA80A29E3FB73C16B8E75B97EF363E2FFA31F71CF9DE5384E71B81C0AC4DFFE0C10E64F Q = 801C0D34C58D93FE997177101F80535A4738CEBCBF389A99B36371EB G = AC4032EF4F2D9AE39DF30B5C8FFDAC506CDEBE7B89998CAF74866A08CFE4FFE3A6824A4E10B9A6F0DD921F01A70C4AFAAB739D7700C29F52C57DB17C620A8652BE5E9001A8D66AD7C17669101999024AF4D027275AC1348BB8A762D0521BC98AE247150422EA1ED409939D54DA7460CDB5F6C6B250717CBEF180EB34118E98D119529A45D6F834566E3025E316A330EFBB77A86F0C1AB15B051AE3D428C8F8ACB70A8137150B8EEB10E183EDD19963DDD9E263E4770589EF6AA21E7F5F2FF381B539CCE3409D13CD566AFBB48D6C019181E1BCFE94B30269EDFE72FE9B6AA4BD7B5A0F1C71CFFF4C19C418E1F6EC017981BC087F2A7065B384B890D3191F2BFA @@ -29,6 +31,7 @@ Z = 34D9BDDC1B42176C313FEA034C21034D074A6313BB4ECDB3703FFF424567A46BDF75530EDE0A Result = P (0 - Correct) [A.3. 2048-bit MODP Group with 256-bit Prime Order Subgroup] +COUNT=2 P = 87A8E61DB4B6663CFFBBD19C651959998CEEF608660DD0F25D2CEED4435E3B00E00DF8F1D61957D4FAF7DF4561B2AA3016C3D91134096FAA3BF4296D830E9A7C209E0C6497517ABD5A8A9D306BCF67ED91F9E6725B4758C022E0B1EF4275BF7B6C5BFC11D45F9088B941F54EB1E59BB8BC39A0BF12307F5C4FDB70C581B23F76B63ACAE1CAA6B7902D52526735488A0EF13C6D9A51BFA4AB3AD8347796524D8EF6A167B5A41825D967E144E5140564251CCACB83E6B486F6B3CA3F7971506026C0B857F689962856DED4010ABD0BE621C3A3960A54E710C375F26375D7014103A4B54330C198AF126116D2276E11715F693877FAD7EF09CADB094AE91E1A1597 Q = 8CF83642A709A097B447997640129DA299B1A47D1EB3750BA308B0FE64F5FBD3 G = 3FB32C9B73134D0B2E77506660EDBD484CA7B18F21EF205407F4793A1A0BA12510DBC15077BE463FFF4FED4AAC0BB555BE3A6C1B0C6B47B1BC3773BF7E8C6F62901228F8C28CBB18A55AE31341000A650196F931C77A57F2DDF463E5E9EC144B777DE62AAAB8A8628AC376D282D6ED3864E67982428EBC831D14348F6F2F9193B5045AF2767164E1DFC967C1FB3F2E55A4BD1BFFE83B9C80D052B985D182EA0ADB2A3B7313D3FE14C8484B1E052588B9B7D2BBD2DF016199ECD06E1557CD0915B3353BBB64E0EC377FD028370DF92B52C7891428CDC67EB6184B523D1DB246C32F63078490F00EF8D647D148D47954515E2327CFEF98C582664B4C0F6CC41659 diff --git a/vectors/cryptography_vectors/asymmetric/DH/dhkey_rfc5114_2.der b/vectors/cryptography_vectors/asymmetric/DH/dhkey_rfc5114_2.der Binary files differnew file mode 100644 index 00000000..4db7c957 --- /dev/null +++ b/vectors/cryptography_vectors/asymmetric/DH/dhkey_rfc5114_2.der diff --git a/vectors/cryptography_vectors/asymmetric/DH/dhkey_rfc5114_2.pem b/vectors/cryptography_vectors/asymmetric/DH/dhkey_rfc5114_2.pem new file mode 100644 index 00000000..3356432b --- /dev/null +++ b/vectors/cryptography_vectors/asymmetric/DH/dhkey_rfc5114_2.pem @@ -0,0 +1,15 @@ +-----BEGIN PRIVATE KEY----- +MIICXQIBADCCAjYGByqGSM4+AgEwggIpAoIBAQCtEH4ekSOp0NZg+qeVWcUfog1k +5Wg7n9G1SxWXth0Kdeb6FB35Wlbbr5o8QHuh3xXrPWiKMJwYDh3muFoSdKCmbT+B +Uq1qwhKQN8nt79pN+Nkej+9VtzlLetW30LbBIgfJ+Y0R7TTb9sa6CyyLvCe+agDg +oLnElwizv4oxcJGINoEoYTC8iYXbFgLnFEFdkzAngnPH3jHv3HMQ9xIf1aB0FZh9 +mtwKSG3N+TrMRDKDhzFddeGYxkGkgM2Gobnlh+i+YOacySiyucUhcuQTBC6bI/EL +Dhbnl2PJtT3PS6gKKeP7c8FrjnW5fvNj4v+jH3HPneU4TnG4HArE3/4MEOZPAoIB +AQCsQDLvTy2a453zC1yP/axQbN6+e4mZjK90hmoIz+T/46aCSk4Quabw3ZIfAacM +Svqrc513AMKfUsV9sXxiCoZSvl6QAajWatfBdmkQGZkCSvTQJydawTSLuKdi0FIb +yYriRxUEIuoe1AmTnVTadGDNtfbGslBxfL7xgOs0EY6Y0RlSmkXW+DRWbjAl4xaj +MO+7d6hvDBqxWwUa49QoyPistwqBNxULjusQ4YPt0Zlj3dniY+R3BYnvaqIef18v +84G1OczjQJ0TzVZq+7SNbAGRgeG8/pSzAmnt/nL+m2qkvXtaDxxxz/9MGcQY4fbs +AXmBvAh/KnBls4S4kNMZHyv6Ah0AgBwNNMWNk/6ZcXcQH4BTWkc4zry/OJqZs2Nx +6wQeAhxEYPzCd3Q1ssq2dHEOtoeo6KO1ZVs6WS2LFf3x +-----END PRIVATE KEY----- diff --git a/vectors/cryptography_vectors/asymmetric/DH/dhkey_rfc5114_2.txt b/vectors/cryptography_vectors/asymmetric/DH/dhkey_rfc5114_2.txt new file mode 100644 index 00000000..e1999899 --- /dev/null +++ b/vectors/cryptography_vectors/asymmetric/DH/dhkey_rfc5114_2.txt @@ -0,0 +1,7 @@ + +COUNT = 0 +P = AD107E1E9123A9D0D660FAA79559C51FA20D64E5683B9FD1B54B1597B61D0A75E6FA141DF95A56DBAF9A3C407BA1DF15EB3D688A309C180E1DE6B85A1274A0A66D3F8152AD6AC2129037C9EDEFDA4DF8D91E8FEF55B7394B7AD5B7D0B6C12207C9F98D11ED34DBF6C6BA0B2C8BBC27BE6A00E0A0B9C49708B3BF8A317091883681286130BC8985DB1602E714415D9330278273C7DE31EFDC7310F7121FD5A07415987D9ADC0A486DCDF93ACC44328387315D75E198C641A480CD86A1B9E587E8BE60E69CC928B2B9C52172E413042E9B23F10B0E16E79763C9B53DCF4BA80A29E3FB73C16B8E75B97EF363E2FFA31F71CF9DE5384E71B81C0AC4DFFE0C10E64F +G = AC4032EF4F2D9AE39DF30B5C8FFDAC506CDEBE7B89998CAF74866A08CFE4FFE3A6824A4E10B9A6F0DD921F01A70C4AFAAB739D7700C29F52C57DB17C620A8652BE5E9001A8D66AD7C17669101999024AF4D027275AC1348BB8A762D0521BC98AE247150422EA1ED409939D54DA7460CDB5F6C6B250717CBEF180EB34118E98D119529A45D6F834566E3025E316A330EFBB77A86F0C1AB15B051AE3D428C8F8ACB70A8137150B8EEB10E183EDD19963DDD9E263E4770589EF6AA21E7F5F2FF381B539CCE3409D13CD566AFBB48D6C019181E1BCFE94B30269EDFE72FE9B6AA4BD7B5A0F1C71CFFF4C19C418E1F6EC017981BC087F2A7065B384B890D3191F2BFA +Q = 801C0D34C58D93FE997177101F80535A4738CEBCBF389A99B36371EB +Y = 0082c165bb576243ecf46d58c3d1501616955fca0320fa95ea11d2e6c1b9cf217676720dc1c08c85bf20c4d232b60a29a1e51c7b773bc645014587c525c86151b30d75486ec7b6c98efb5f74955b83116d01d0af1232af89213c2de574369d701aba9357300b920d3d8b98252d46c46952c16a5f33554b38317809c7b9add4701f5c158c1b7035e9fe39366ececb90d2896b78c523c4a577287ef5ba7a2663ed58aa20b5ec66e30f316610dfaa38583e495ab6af771c284387e660edbef4edb872e2e80e1d244ee95622e76d028e61c1e887c2aa792717362139f4dd26eafd49b2366eeb2350b01fe1b56022a2809e379559c37b375ba01c4eaacc14fd1b247837 +X = 4460fcc2777435b2cab674710eb687a8e8a3b5655b3a592d8b15fdf1 diff --git a/vectors/cryptography_vectors/asymmetric/DH/dhp_rfc5114_2.der b/vectors/cryptography_vectors/asymmetric/DH/dhp_rfc5114_2.der Binary files differnew file mode 100644 index 00000000..666eb9a0 --- /dev/null +++ b/vectors/cryptography_vectors/asymmetric/DH/dhp_rfc5114_2.der diff --git a/vectors/cryptography_vectors/asymmetric/DH/dhp_rfc5114_2.pem b/vectors/cryptography_vectors/asymmetric/DH/dhp_rfc5114_2.pem new file mode 100644 index 00000000..8887cb17 --- /dev/null +++ b/vectors/cryptography_vectors/asymmetric/DH/dhp_rfc5114_2.pem @@ -0,0 +1,14 @@ +-----BEGIN X9.42 DH PARAMETERS----- +MIICKQKCAQEArRB+HpEjqdDWYPqnlVnFH6INZOVoO5/RtUsVl7YdCnXm+hQd+VpW +26+aPEB7od8V6z1oijCcGA4d5rhaEnSgpm0/gVKtasISkDfJ7e/aTfjZHo/vVbc5 +S3rVt9C2wSIHyfmNEe002/bGugssi7wnvmoA4KC5xJcIs7+KMXCRiDaBKGEwvImF +2xYC5xRBXZMwJ4Jzx94x79xzEPcSH9WgdBWYfZrcCkhtzfk6zEQyg4cxXXXhmMZB +pIDNhqG55YfovmDmnMkosrnFIXLkEwQumyPxCw4W55djybU9z0uoCinj+3PBa451 +uX7zY+L/ox9xz53lOE5xuBwKxN/+DBDmTwKCAQEArEAy708tmuOd8wtcj/2sUGze +vnuJmYyvdIZqCM/k/+OmgkpOELmm8N2SHwGnDEr6q3OddwDCn1LFfbF8YgqGUr5e +kAGo1mrXwXZpEBmZAkr00CcnWsE0i7inYtBSG8mK4kcVBCLqHtQJk51U2nRgzbX2 +xrJQcXy+8YDrNBGOmNEZUppF1vg0Vm4wJeMWozDvu3eobwwasVsFGuPUKMj4rLcK +gTcVC47rEOGD7dGZY93Z4mPkdwWJ72qiHn9fL/OBtTnM40CdE81Wavu0jWwBkYHh +vP6UswJp7f5y/ptqpL17Wg8ccc//TBnEGOH27AF5gbwIfypwZbOEuJDTGR8r+gId +AIAcDTTFjZP+mXF3EB+AU1pHOM68vziambNjces= +-----END X9.42 DH PARAMETERS----- diff --git a/vectors/cryptography_vectors/asymmetric/DH/dhpub_rfc5114_2.der b/vectors/cryptography_vectors/asymmetric/DH/dhpub_rfc5114_2.der Binary files differnew file mode 100644 index 00000000..ba8aec90 --- /dev/null +++ b/vectors/cryptography_vectors/asymmetric/DH/dhpub_rfc5114_2.der diff --git a/vectors/cryptography_vectors/asymmetric/DH/dhpub_rfc5114_2.pem b/vectors/cryptography_vectors/asymmetric/DH/dhpub_rfc5114_2.pem new file mode 100644 index 00000000..94a7170a --- /dev/null +++ b/vectors/cryptography_vectors/asymmetric/DH/dhpub_rfc5114_2.pem @@ -0,0 +1,20 @@ +-----BEGIN PUBLIC KEY----- +MIIDRDCCAjYGByqGSM4+AgEwggIpAoIBAQCtEH4ekSOp0NZg+qeVWcUfog1k5Wg7 +n9G1SxWXth0Kdeb6FB35Wlbbr5o8QHuh3xXrPWiKMJwYDh3muFoSdKCmbT+BUq1q +whKQN8nt79pN+Nkej+9VtzlLetW30LbBIgfJ+Y0R7TTb9sa6CyyLvCe+agDgoLnE +lwizv4oxcJGINoEoYTC8iYXbFgLnFEFdkzAngnPH3jHv3HMQ9xIf1aB0FZh9mtwK +SG3N+TrMRDKDhzFddeGYxkGkgM2Gobnlh+i+YOacySiyucUhcuQTBC6bI/ELDhbn +l2PJtT3PS6gKKeP7c8FrjnW5fvNj4v+jH3HPneU4TnG4HArE3/4MEOZPAoIBAQCs +QDLvTy2a453zC1yP/axQbN6+e4mZjK90hmoIz+T/46aCSk4Quabw3ZIfAacMSvqr +c513AMKfUsV9sXxiCoZSvl6QAajWatfBdmkQGZkCSvTQJydawTSLuKdi0FIbyYri +RxUEIuoe1AmTnVTadGDNtfbGslBxfL7xgOs0EY6Y0RlSmkXW+DRWbjAl4xajMO+7 +d6hvDBqxWwUa49QoyPistwqBNxULjusQ4YPt0Zlj3dniY+R3BYnvaqIef18v84G1 +OczjQJ0TzVZq+7SNbAGRgeG8/pSzAmnt/nL+m2qkvXtaDxxxz/9MGcQY4fbsAXmB +vAh/KnBls4S4kNMZHyv6Ah0AgBwNNMWNk/6ZcXcQH4BTWkc4zry/OJqZs2Nx6wOC +AQYAAoIBAQCCwWW7V2JD7PRtWMPRUBYWlV/KAyD6leoR0ubBuc8hdnZyDcHAjIW/ +IMTSMrYKKaHlHHt3O8ZFAUWHxSXIYVGzDXVIbse2yY77X3SVW4MRbQHQrxIyr4kh +PC3ldDadcBq6k1cwC5INPYuYJS1GxGlSwWpfM1VLODF4Cce5rdRwH1wVjBtwNen+ +OTZuzsuQ0olreMUjxKV3KH71unomY+1YqiC17GbjDzFmEN+qOFg+SVq2r3ccKEOH +5mDtvvTtuHLi6A4dJE7pViLnbQKOYcHoh8KqeScXNiE59N0m6v1JsjZu6yNQsB/h +tWAiooCeN5VZw3s3W6AcTqrMFP0bJHg3 +-----END PUBLIC KEY----- |