CryptoDataHub 0.11.1__py3-none-any.whl → 0.12.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of CryptoDataHub might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: CryptoDataHub
3
- Version: 0.11.1
3
+ Version: 0.12.1
4
4
  Summary: Repository of cryptography-related data
5
5
  Author: Szilárd Pfeiffer
6
6
  Author-email: coroner@pfeifferszilard.hu
@@ -1,12 +1,12 @@
1
1
  cryptodatahub/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- cryptodatahub/__setup__.py,sha256=CyYEad_mWnGgqCpgRPW_Ri3T0f0iiu-Jec5uK-V65PY,341
2
+ cryptodatahub/__setup__.py,sha256=iEJc5wk-z3-oPZ3sy50Md7HDSA9xFl61dxycd3msR8g,341
3
3
  cryptodatahub/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- cryptodatahub/common/algorithm.py,sha256=ddP9GjrIoEmeCI5o4QWnKo4aXtQO4pTWIUvkkr4IrFU,5128
4
+ cryptodatahub/common/algorithm.py,sha256=HVAgvtJOTPZNIQxgojYe6UPKBX1Pcds17FqeQCspULE,5141
5
5
  cryptodatahub/common/attack-named.json,sha256=2LsTtaJO_c3rkixCIHyPrx_Lm8tsHsl2pNCP9WZdshk,1968
6
6
  cryptodatahub/common/attack-type.json,sha256=_yGL43QSrScyTbn1vOTqTdJYHcbO8vv16A0oaOOClsQ,1364
7
- cryptodatahub/common/authentication.json,sha256=BIT1avovyADkYaNAV-deMQ8eu1-YLxPwOWTyagQxGV0,2692
8
- cryptodatahub/common/block-cipher-mode.json,sha256=POynUEy23YiEoeV3612IgU21yTaCWFig6-qeF025qBI,1914
9
- cryptodatahub/common/block-cipher.json,sha256=7VqQkPGAYj_cMgH_osiDf4slEyobH0E-Nu-_sKekmQs,10994
7
+ cryptodatahub/common/authentication.json,sha256=CSwgoPLslmN2ll2hKNpkWoUgC5YMIT_Gg6U0_pkXzH0,2873
8
+ cryptodatahub/common/block-cipher-mode.json,sha256=ebTbLuZutec4AY7F9IMpEZpxgVXOdzOON4QQp0u7jjE,1762
9
+ cryptodatahub/common/block-cipher.json,sha256=15J6EJd8zS4CJhDOuPfTsE8473blSOJBSAk6-dyEfag,11325
10
10
  cryptodatahub/common/certificate-transparency-log.json,sha256=0Lg80NnztHj-0bRL1ViRAbmFT53-_srGsdNQpA5k-j0,71716
11
11
  cryptodatahub/common/client.json,sha256=HARcKLMHtw3GSNlC50H6ZmqriENEXG6hesD10j3Coz0,418
12
12
  cryptodatahub/common/dhparam-well-known.json,sha256=Zk3jnTT1XDnyOxEUU9h2TCPzTDzApRCBMR8EKWo5ylA,109441
@@ -14,19 +14,19 @@ cryptodatahub/common/entity.json,sha256=fJ-NnKvbW_3OKM8a1tNUzl7WaZKOMYtGrj7WetXO
14
14
  cryptodatahub/common/entity.py,sha256=MAUJS9D7hFyXGis0dzzfjj71h7Uo_0eC_tYXS-q5mso,3256
15
15
  cryptodatahub/common/exception.py,sha256=cXA0YOoQdIExdF9dGeneOiF3khCmwaBtsDZ8fQ-bzGM,854
16
16
  cryptodatahub/common/grade.py,sha256=Q7nuWUX1ON_n5vEiYyLfwn09S_TMdm3uUZPLkLtNU40,5326
17
- cryptodatahub/common/hash.json,sha256=fhxjM1hReGlHn3s7ywFGUPAzHNFrOPcHCrzUiV1kFc0,6244
18
- cryptodatahub/common/key-exchange.json,sha256=wMzNEXEBh9fDxt8B-lhBnXivCIb0_Rb3_nLF9vUq3QQ,3583
19
- cryptodatahub/common/key.py,sha256=EK_fVJ6IXOzm0O416MiuT4zfWDiC1cLBvCH-pMpOukE,20364
20
- cryptodatahub/common/mac.json,sha256=0P8peHS7x_Ji8-zrI78mqLlVYKdtNjb25Nx98_y1np8,9208
17
+ cryptodatahub/common/hash.json,sha256=sCcuyUxusTia-aceCuVxBdte_u4v2_swbpRvu0XNjto,7173
18
+ cryptodatahub/common/key-exchange.json,sha256=pukNOs6Bx8dkO2dYVr2_qdvodvz4i8-aSHmZusAS-PA,3581
19
+ cryptodatahub/common/key.py,sha256=9K-CrJpb7Ioyy_vPwvnliPxhRV7AMeO-25WcWaNy29g,20229
20
+ cryptodatahub/common/mac.json,sha256=L0hL8Etu_g91nxAA5GJ1wt5avZtVDgE5RvVXrVD1Xfw,10632
21
21
  cryptodatahub/common/named-group.json,sha256=f37_pX3vEFub1v_j0RrSVHxDcgGYuPJItruR9u1L3Uk,21721
22
- cryptodatahub/common/parameter.py,sha256=YkipNthMdhH7ptMLhHt2rHy4jmP3aHOk6QXR7VE4Uns,2763
22
+ cryptodatahub/common/parameter.py,sha256=c3wJxjLPsbLbFgxYVXJ_JfiYImpQ87HLgC1G9h3IJbk,2776
23
23
  cryptodatahub/common/root-certificate.json,sha256=nZd0vzxgFgW2T3UT2Vd_z6RN57TNOVB6rI4eNjLEReg,1061722
24
24
  cryptodatahub/common/server.json,sha256=rxmCmZ86OCHb_q6-KL2p3zFXcgivifZoUIDXlSgOsto,1080
25
- cryptodatahub/common/signature.json,sha256=uY0CkO0_j_RYhd3cKMUcoQytj7RmOSHzNANtWF_c5jU,6718
25
+ cryptodatahub/common/signature.json,sha256=YY51O_29wVG1LfQnnq8bERTiytc6v7B3UsqKCq_DoAA,6876
26
26
  cryptodatahub/common/standard.json,sha256=w0c3pbu3Bxk9pK65a3_7Gsc7pXA7PzxNSIGD6Na4kWk,720
27
- cryptodatahub/common/stores.py,sha256=jXof7EP0JMRS4bhVGS83BQEF9UU9atQnOX6XjcHGz5w,10391
27
+ cryptodatahub/common/stores.py,sha256=tdD9b3GW4CB55whbBlqmpvv70PsdibkCM2tVO95gX0g,10545
28
28
  cryptodatahub/common/types.py,sha256=BtFg4hupSfUZydzCQROV40j53ZPL12MqkQsFOa9zWuQ,13946
29
- cryptodatahub/common/utils.py,sha256=SXDNw8VKgvkX5g6S3sJimn89zcXjU2MbTGsZcy6G_Fc,892
29
+ cryptodatahub/common/utils.py,sha256=xjlQRBwDRzjH7q0Qr5djhK2EIG_YNMv35mkrHXbECCw,3114
30
30
  cryptodatahub/common/vulnerability.json,sha256=2RQXb9UL1_VlcAAGoxqpe3nTrRfO4gyOX_IGHVy3SBc,4
31
31
  cryptodatahub/dnsrec/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
32
  cryptodatahub/dnsrec/algorithm.json,sha256=Ejk6xbxcLjURQvFpofM6rxKKjfKknj4x_6X4mWaIiFw,3025
@@ -34,21 +34,21 @@ cryptodatahub/dnsrec/algorithm.py,sha256=rdKc4ib7xCA4yPqc9645rmTGPfJuucN3mvmp4aj
34
34
  cryptodatahub/dnsrec/digest-type.json,sha256=U1iUv3Q5TLidAoDozPWVP5HnyTdTwU8MVdcHKdtoTs4,529
35
35
  cryptodatahub/dnsrec/rr-type.json,sha256=DxcOyRQHHSgHUgL7K2mxSbAmvl96VdorClEiz1lG4t8,17912
36
36
  cryptodatahub/ssh/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
- cryptodatahub/ssh/algorithm.py,sha256=dPwVe9J040i91oeTbV7E0r194OqtqbvWo-3XiTqVsPk,5938
38
- cryptodatahub/ssh/compression-algorithm.json,sha256=OZTMRnYetpcabzmvkkQOrrCrU02mvOk-adiBW4Km_j4,399
37
+ cryptodatahub/ssh/algorithm.py,sha256=Jvguv_6_IbvogpmQlMDu7CjPCaPVws2_bdjG5g43NHA,5945
38
+ cryptodatahub/ssh/compression-algorithm.json,sha256=yOmr96mjPvZrmzhV9kL6eo7Jf4lvv04DJ1mUeKzuQVw,502
39
39
  cryptodatahub/ssh/elliptic-curve-identifier.json,sha256=r_hRJdog7DllJjwB7I7ScEIHNWvlxXwfaTawDkt_FzM,1115
40
- cryptodatahub/ssh/encryption-algorithm.json,sha256=CXZ-62GldH3ObHpGft8WN3uW1F21SvFUWikLH7QGYCk,8506
41
- cryptodatahub/ssh/host-key-algorithm.json,sha256=7NzcHA8NtRxHUmX1-mtmQIL3EkgxueIv-rqi0hABU2M,10697
42
- cryptodatahub/ssh/kex-algorithm.json,sha256=VBI5dUf7eahs15UqSdBm4lrphK_ln_dYbbkqA4n8vHg,12637
43
- cryptodatahub/ssh/mac-algorithm.json,sha256=t5rBPOdVPplssq8GLiLE0xrat0HwXqYbJ66aVqXo344,11882
40
+ cryptodatahub/ssh/encryption-algorithm.json,sha256=TprZV9pSLfFzonU0_hHWkobHXTqeJIF1rQq2Kf-y0tE,13718
41
+ cryptodatahub/ssh/host-key-algorithm.json,sha256=t8GNvmL8tmuBFNC7Y7RS4DL0megr3VFg5iAqvVQMweo,15474
42
+ cryptodatahub/ssh/kex-algorithm.json,sha256=NZ8SFjVcRJ0g9S7_r3NT5XtoBp8CgDHLyjacvl8b-EA,21872
43
+ cryptodatahub/ssh/mac-algorithm.json,sha256=6tiN9gfnK1P-SPebXSjap0Ahn_i6oVq6Zj1Oa7F0miE,15470
44
44
  cryptodatahub/tls/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
- cryptodatahub/tls/algorithm.py,sha256=0nkklNGWvtsuRMSOhA09MBC8rn1_pXW-ML8i8_xvkrU,9410
45
+ cryptodatahub/tls/algorithm.py,sha256=_ftSriQW8EQSjAthcahC8Ra4Ymzu-LXdezrW6QrGSS4,9430
46
46
  cryptodatahub/tls/certificate-compression-algorithm.json,sha256=32se6aJWmzPQzwbaLv3ftwKnltUc37xadto8SRrDndk,224
47
- cryptodatahub/tls/cipher-kind.json,sha256=3KohtbuOQjnyHn7rHNwk7jxgirplvu_DUd_SZ1aLSdg,5488
47
+ cryptodatahub/tls/cipher-kind.json,sha256=Dj1dIrsCseG87N7i9RmioGMV_1mvtifWAgFMcgTbrjQ,5490
48
48
  cryptodatahub/tls/cipher-suite-extension.json,sha256=EZO5gDsONRt-TlvZjI8CRicy4YBeBjEOk9E1HknQ-d8,189
49
49
  cryptodatahub/tls/cipher-suite.json,sha256=NK9pP6kTAmubtAIJU-rMUCMRzGSdGiEnyKcG5BJbp-k,175449
50
50
  cryptodatahub/tls/client.json,sha256=TwTOy_790iRJTLiLiu99r7PBe4dHjU3hDoXtd2bL658,139669
51
- cryptodatahub/tls/client.py,sha256=x0Q3gYX_Wc6jns3YbE42ASvzfYR9A8vslcdojMRPUdM,7997
51
+ cryptodatahub/tls/client.py,sha256=m0-klm_XpEAqCDZoasCOO82XKc74BTXdOgM5qOXg5hM,8062
52
52
  cryptodatahub/tls/compression-method.json,sha256=YV4tPN6V8puhZLCdVoBCezq7T1gzw-luRJhJeCog5mo,411
53
53
  cryptodatahub/tls/ec-point-format.json,sha256=bPsbdb_GktNQZBpRlD5Fj9OWQ-dLyNS7A-OwgbPWtLw,473
54
54
  cryptodatahub/tls/extension-type.json,sha256=UYrn4yoMb70Ph-x5A9Ap7Bs_ccVm-fhFVnfTsiMw0OE,7060
@@ -62,8 +62,8 @@ cryptodatahub/tls/psk-key-exchange-mode.json,sha256=niv5NXm2e4yIQW3kTzXDhmSi-HsL
62
62
  cryptodatahub/tls/token-binding-paramater.json,sha256=OtlzCxg-J9xZjGtTMGsK9sPMiGz9mfNYYmKx8GIQDgE,239
63
63
  cryptodatahub/tls/version.json,sha256=7iSBtC50HfZ1xJ05laYZmFOn4xCvU2hKZRf0Ce1N-Bg,3296
64
64
  cryptodatahub/tls/version.py,sha256=k5DBZJGK9cqSCeCWBfLC-CSyMk7m6p0Q-ZgpfN2TiuE,411
65
- CryptoDataHub-0.11.1.dist-info/LICENSE.txt,sha256=-rPda9qyJvHAhjCx3ZF-Efy07F4eAg4sFvg6ChOGPoU,16726
66
- CryptoDataHub-0.11.1.dist-info/METADATA,sha256=E4Ym_8j_cOcukX-w7tT2uX3Y2dwlkAqJxWexL7aWEQU,3946
67
- CryptoDataHub-0.11.1.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
68
- CryptoDataHub-0.11.1.dist-info/top_level.txt,sha256=1pwZYk77PJ6OfV8Bpvn3CSoT7o34ZtT7Dk2DbH_rUSU,14
69
- CryptoDataHub-0.11.1.dist-info/RECORD,,
65
+ CryptoDataHub-0.12.1.dist-info/LICENSE.txt,sha256=-rPda9qyJvHAhjCx3ZF-Efy07F4eAg4sFvg6ChOGPoU,16726
66
+ CryptoDataHub-0.12.1.dist-info/METADATA,sha256=dhw73_wrbCLhdqim9sEa0hKH01R6J85Q01wOrQezm28,3946
67
+ CryptoDataHub-0.12.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
68
+ CryptoDataHub-0.12.1.dist-info/top_level.txt,sha256=1pwZYk77PJ6OfV8Bpvn3CSoT7o34ZtT7Dk2DbH_rUSU,14
69
+ CryptoDataHub-0.12.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.3)
2
+ Generator: bdist_wheel (0.42.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  __title__ = 'CryptoDataHub'
4
4
  __technical_name__ = __title__.lower()
5
- __version__ = '0.11.1'
5
+ __version__ = '0.12.1'
6
6
  __description__ = 'Repository of cryptography-related data'
7
7
  __author__ = 'Szilárd Pfeiffer'
8
8
  __author_email__ = 'coroner@pfeifferszilard.hu'
@@ -115,7 +115,7 @@ class MACParams(CryptoDataParamsOIDOptional, GradeableVulnerabilities):
115
115
  MAC = CryptoDataEnumOIDBase('MAC', CryptoDataEnumOIDBase.get_json_records(MACParams))
116
116
 
117
117
 
118
- @attr.s
118
+ @attr.s(frozen=True)
119
119
  class MACModeParams(CryptoDataParamsEnumString, GradeableVulnerabilities):
120
120
  name = attr.ib(validator=attr.validators.instance_of(six.string_types))
121
121
 
@@ -102,5 +102,12 @@
102
102
  "oid": null,
103
103
  "vulnerabilities": [],
104
104
  "anonymous": false
105
+ },
106
+ "XMSS": {
107
+ "name": "XMSS",
108
+ "long_name": "eXtended Merkle Signature Scheme",
109
+ "oid": null,
110
+ "vulnerabilities": [],
111
+ "anonymous": false
105
112
  }
106
113
  }
@@ -33,13 +33,7 @@
33
33
  "CTR": {
34
34
  "name": "CTR",
35
35
  "long_name": "counter",
36
- "vulnerabilities": [
37
- {
38
- "attack_type": "REUSED_KEY_ATTACK",
39
- "grade": "WEAK",
40
- "named": null
41
- }
42
- ]
36
+ "vulnerabilities": []
43
37
  },
44
38
  "ECB": {
45
39
  "name": "ECB",
@@ -85,7 +85,7 @@
85
85
  }
86
86
  ],
87
87
  "key_size": 192,
88
- "block_size": 192
88
+ "block_size": 128
89
89
  },
90
90
  "TWOFISH256": {
91
91
  "name": "Twofish-256",
@@ -98,7 +98,7 @@
98
98
  }
99
99
  ],
100
100
  "key_size": 256,
101
- "block_size": 256
101
+ "block_size": 128
102
102
  },
103
103
  "CAMELLIA_128": {
104
104
  "name": "Camellia-128",
@@ -107,6 +107,13 @@
107
107
  "key_size": 128,
108
108
  "block_size": 128
109
109
  },
110
+ "CAMELLIA_192": {
111
+ "name": "Camellia-192",
112
+ "long_name": null,
113
+ "vulnerabilities": null,
114
+ "key_size": 192,
115
+ "block_size": 128
116
+ },
110
117
  "CAMELLIA_256": {
111
118
  "name": "Camellia-256",
112
119
  "long_name": null,
@@ -431,6 +438,13 @@
431
438
  "key_size": 256,
432
439
  "block_size": 128
433
440
  },
441
+ "SM4": {
442
+ "name": "SM4",
443
+ "long_name": "ShangMi 4",
444
+ "vulnerabilities": [],
445
+ "key_size": 128,
446
+ "block_size": 128
447
+ },
434
448
  "TRIPLE_DES": {
435
449
  "name": "3DES",
436
450
  "long_name": "Triple DES",
@@ -45,7 +45,7 @@
45
45
  "named": null
46
46
  }
47
47
  ],
48
- "digest_size": 64
48
+ "digest_size": 128
49
49
  },
50
50
  "RIPEMD128": {
51
51
  "name": "RIPEMD-128",
@@ -99,6 +99,19 @@
99
99
  ],
100
100
  "digest_size": 160
101
101
  },
102
+ "SHA1_96": {
103
+ "name": "SHA-1/96",
104
+ "long_name": "Secure Hash Algorithm 1 (96)",
105
+ "oid": null,
106
+ "vulnerabilities": [
107
+ {
108
+ "attack_type": "COLLISION",
109
+ "grade": "WEAK",
110
+ "named": null
111
+ }
112
+ ],
113
+ "digest_size": 96
114
+ },
102
115
  "SHA2_224": {
103
116
  "name": "SHA-224",
104
117
  "long_name": "Secure Hash Algorithm 2 (224)",
@@ -183,6 +196,13 @@
183
196
  "vulnerabilities": null,
184
197
  "digest_size": 256
185
198
  },
199
+ "SM3": {
200
+ "name": "SM3",
201
+ "long_name": "ShangMi 3",
202
+ "oid": "1.2.156.10197.1.401",
203
+ "vulnerabilities": null,
204
+ "digest_size": 256
205
+ },
186
206
  "TIGER_128": {
187
207
  "name": "Tiger/128",
188
208
  "long_name": null,
@@ -194,7 +214,13 @@
194
214
  "name": "Tiger/128(96)",
195
215
  "long_name": null,
196
216
  "oid": null,
197
- "vulnerabilities": null,
217
+ "vulnerabilities": [
218
+ {
219
+ "attack_type": "COLLISION",
220
+ "grade": "WEAK",
221
+ "named": null
222
+ }
223
+ ],
198
224
  "digest_size": 96
199
225
  },
200
226
  "TIGER_160": {
@@ -208,7 +234,13 @@
208
234
  "name": "Tiger/160(96)",
209
235
  "long_name": null,
210
236
  "oid": null,
211
- "vulnerabilities": null,
237
+ "vulnerabilities": [
238
+ {
239
+ "attack_type": "COLLISION",
240
+ "grade": "WEAK",
241
+ "named": null
242
+ }
243
+ ],
212
244
  "digest_size": 96
213
245
  },
214
246
  "TIGER_192": {
@@ -222,7 +254,13 @@
222
254
  "name": "Tiger/192(96)",
223
255
  "long_name": null,
224
256
  "oid": null,
225
- "vulnerabilities": null,
257
+ "vulnerabilities": [
258
+ {
259
+ "attack_type": "COLLISION",
260
+ "grade": "WEAK",
261
+ "named": null
262
+ }
263
+ ],
226
264
  "digest_size": 96
227
265
  },
228
266
  "WHIRLPOOL": {
@@ -128,7 +128,7 @@
128
128
  "HYBRID_PQS": {
129
129
  "name": "hybrid post-quantum safe",
130
130
  "long_name": null,
131
- "vulnerabilities": null,
131
+ "vulnerabilities": [],
132
132
  "forward_secret": true
133
133
  },
134
134
  "SRP": {
@@ -1,7 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  import abc
4
- import hashlib
5
4
  import base64
6
5
  import collections
7
6
  import datetime
@@ -26,7 +25,7 @@ from cryptodatahub.common.grade import (
26
25
  Vulnerability,
27
26
  )
28
27
  from cryptodatahub.common.types import _ConverterBase
29
- from cryptodatahub.common.utils import bytes_to_hex_string
28
+ from cryptodatahub.common.utils import bytes_to_hex_string, hash_bytes
30
29
 
31
30
  from cryptodatahub.tls.algorithm import TlsExtensionType
32
31
 
@@ -38,7 +37,7 @@ class _PublicKeySizeGradeable(GradeableVulnerabilities):
38
37
  return 'public key size'
39
38
 
40
39
 
41
- @attr.s
40
+ @attr.s(frozen=True)
42
41
  class PublicKeySize(GradeableComplex):
43
42
  _FINITE_FIELD_TYPES = [Authentication.RSA, Authentication.DSS, KeyExchange.ADH, KeyExchange.DH, KeyExchange.DHE]
44
43
  _ELLIPTIC_CURVE_TYPES = [Authentication.ECDSA, Authentication.EDDSA, KeyExchange.ECDH, KeyExchange.ECDHE]
@@ -79,6 +78,8 @@ class PublicKeySize(GradeableComplex):
79
78
  Vulnerability(attack_type=AttackType.DOS_ATTACK, grade=Grade.WEAK, named=AttackNamed.DHEAT_ATTACK)
80
79
  )
81
80
  gradeables = [_PublicKeySizeGradeable(gradeables)]
81
+ elif self.key_type == KeyExchange.HYBRID_PQS:
82
+ gradeables = []
82
83
  else:
83
84
  gradeables = None
84
85
 
@@ -109,12 +110,12 @@ def convert_public_key_size(key_exchange):
109
110
  return _PublicKeySizeConverter(key_exchange)
110
111
 
111
112
 
112
- @attr.s
113
+ @attr.s(frozen=True)
113
114
  class PublicKeyParamBase(object):
114
115
  pass
115
116
 
116
117
 
117
- @attr.s
118
+ @attr.s(frozen=True)
118
119
  class PublicKeyParamsDsa(PublicKeyParamBase):
119
120
  prime = attr.ib(validator=attr.validators.instance_of(six.integer_types))
120
121
  generator = attr.ib(validator=attr.validators.instance_of(six.integer_types))
@@ -122,7 +123,7 @@ class PublicKeyParamsDsa(PublicKeyParamBase):
122
123
  public_key_value = attr.ib(validator=attr.validators.instance_of(six.integer_types))
123
124
 
124
125
 
125
- @attr.s
126
+ @attr.s(frozen=True)
126
127
  class PublicKeyParamsEcdsa(PublicKeyParamBase):
127
128
  named_group = attr.ib(validator=attr.validators.instance_of(NamedGroup))
128
129
  point_x = attr.ib(validator=attr.validators.instance_of(six.integer_types))
@@ -142,26 +143,20 @@ class PublicKeyParamsEcdsa(PublicKeyParamBase):
142
143
  return bytes(asn1crypto.keys.ECPointBitString.from_coords(self.point_x, self.point_y))
143
144
 
144
145
 
145
- @attr.s
146
+ @attr.s(frozen=True)
146
147
  class PublicKeyParamsEddsa(PublicKeyParamBase):
147
148
  curve_type = attr.ib(validator=attr.validators.instance_of(NamedGroup))
148
149
  key_data = attr.ib(validator=attr.validators.instance_of((bytes, bytearray)))
149
150
 
150
151
 
151
- @attr.s
152
+ @attr.s(frozen=True)
152
153
  class PublicKeyParamsRsa(PublicKeyParamBase):
153
154
  modulus = attr.ib(validator=attr.validators.instance_of(six.integer_types))
154
155
  public_exponent = attr.ib(validator=attr.validators.instance_of(six.integer_types))
155
156
 
156
157
 
157
- @attr.s(eq=False)
158
+ @attr.s(eq=False, frozen=True)
158
159
  class PublicKey(object):
159
- _HASHLIB_FUNCS = {
160
- Hash.MD5: hashlib.md5,
161
- Hash.SHA1: hashlib.sha1,
162
- Hash.SHA2_256: hashlib.sha256
163
- }
164
-
165
160
  _public_key = attr.ib(validator=attr.validators.instance_of(asn1crypto.keys.PublicKeyInfo))
166
161
 
167
162
  @classmethod
@@ -317,17 +312,11 @@ class PublicKey(object):
317
312
  def key_bytes(self):
318
313
  return PublicKey.der.fget(self)
319
314
 
320
- @classmethod
321
- def get_digest(cls, hash_type, key_bytes):
322
- try:
323
- hashlib_funcs = cls._HASHLIB_FUNCS[hash_type]
324
- except KeyError as e:
325
- six.raise_from(NotImplementedError(hash_type), e)
326
-
327
- return hashlib_funcs(key_bytes).digest()
315
+ def get_digest(self, hash_type):
316
+ return hash_bytes(hash_type, self.der)
328
317
 
329
318
  def fingerprint(self, hash_type):
330
- return bytes_to_hex_string(self.get_digest(hash_type, self.der), ':')
319
+ return bytes_to_hex_string(self.get_digest(hash_type), ':')
331
320
 
332
321
  @property
333
322
  def fingerprints(self):
@@ -374,7 +363,7 @@ class PublicKeySigned(PublicKey):
374
363
  raise NotImplementedError()
375
364
 
376
365
 
377
- @attr.s(eq=False, init=False)
366
+ @attr.s(eq=False, init=False, frozen=True)
378
367
  class PublicKeyX509Base(PublicKeySigned): # pylint: disable=too-many-public-methods
379
368
  _EV_OIDS_BY_CA = {
380
369
  'A-Trust': ('1.2.40.0.17.1.22', ),
@@ -435,7 +424,7 @@ class PublicKeyX509Base(PublicKeySigned): # pylint: disable=too-many-public-met
435
424
  def __init__(self, certificate):
436
425
  super(PublicKeySigned, self).__init__(certificate.public_key)
437
426
 
438
- self._certificate = certificate
427
+ object.__setattr__(self, '_certificate', certificate)
439
428
 
440
429
  @classmethod
441
430
  def _get_type_name(cls):
@@ -472,7 +461,7 @@ class PublicKeyX509Base(PublicKeySigned): # pylint: disable=too-many-public-met
472
461
 
473
462
  @property
474
463
  def public_key_pin(self):
475
- return base64.b64encode(self.get_digest(Hash.SHA2_256, self.key_bytes)).decode('ascii')
464
+ return base64.b64encode(hash_bytes(Hash.SHA2_256, self.key_bytes)).decode('ascii')
476
465
 
477
466
  def _has_any_policy_value(self, oid_values):
478
467
  if self._certificate.certificate_policies_value is None:
@@ -31,6 +31,54 @@
31
31
  "digest_size": 256,
32
32
  "hash_algorithm": null
33
33
  },
34
+ "CBCMAC_3DES": {
35
+ "name": "CBC-MAC 3DES",
36
+ "long_name": null,
37
+ "oid": null,
38
+ "vulnerabilities": null,
39
+ "digest_size": 64,
40
+ "hash_algorithm": null
41
+ },
42
+ "CBCMAC_AES": {
43
+ "name": "CBC-MAC AES",
44
+ "long_name": null,
45
+ "oid": null,
46
+ "vulnerabilities": null,
47
+ "digest_size": 128,
48
+ "hash_algorithm": null
49
+ },
50
+ "CBCMAC_BLOWFISH": {
51
+ "name": "CBC-MAC Blowfish",
52
+ "long_name": null,
53
+ "oid": null,
54
+ "vulnerabilities": null,
55
+ "digest_size": 64,
56
+ "hash_algorithm": null
57
+ },
58
+ "CBCMAC_DES": {
59
+ "name": "CBC-MAC DES",
60
+ "long_name": null,
61
+ "oid": null,
62
+ "vulnerabilities": null,
63
+ "digest_size": 64,
64
+ "hash_algorithm": null
65
+ },
66
+ "CBCMAC_RIJNDAEL": {
67
+ "name": "CBC-MAC Rijndael",
68
+ "long_name": null,
69
+ "oid": null,
70
+ "vulnerabilities": null,
71
+ "digest_size": 128,
72
+ "hash_algorithm": null
73
+ },
74
+ "CBCMAC_TWOFISH": {
75
+ "name": "CBC-MAC Twofish",
76
+ "long_name": null,
77
+ "oid": null,
78
+ "vulnerabilities": null,
79
+ "digest_size": 128,
80
+ "hash_algorithm": null
81
+ },
34
82
  "CRYPTICORE": {
35
83
  "name": "CryptiCore",
36
84
  "long_name": "CryptiCore (Badger)",
@@ -239,6 +287,14 @@
239
287
  "digest_size": null,
240
288
  "hash_algorithm": "SHA3_512"
241
289
  },
290
+ "SM3": {
291
+ "name": "SM3",
292
+ "long_name": "ShangMi 3",
293
+ "oid": "1.2.156.10197.1.401.2",
294
+ "vulnerabilities": [],
295
+ "digest_size": null,
296
+ "hash_algorithm": "SM3"
297
+ },
242
298
  "TIGER_128": {
243
299
  "name": "Tiger/128",
244
300
  "long_name": null,
@@ -48,7 +48,7 @@ class DHParameterNumbers(object):
48
48
  return self.p == other.p and self.g == other.g and (self.q is None or self.q == other.q)
49
49
 
50
50
 
51
- @attr.s(eq=False)
51
+ @attr.s(eq=False, frozen=True)
52
52
  class DHParamWellKnownParams(CryptoDataParamsBase, GradeableVulnerabilities):
53
53
  parameter_numbers = attr.ib(
54
54
  converter=convert_dict_to_object(DHParameterNumbers),
@@ -222,5 +222,12 @@
222
222
  "oid": null,
223
223
  "key_type": "EDDSA",
224
224
  "hash_algorithm": "SHAKE_256"
225
+ },
226
+ "XMSS": {
227
+ "name": "XMSS",
228
+ "long_name": null,
229
+ "oid": null,
230
+ "key_type": "XMSS",
231
+ "hash_algorithm": "SHA2_256"
225
232
  }
226
233
  }
@@ -41,7 +41,7 @@ CertificateTransparencyLogStateType = enum.Enum(
41
41
  )
42
42
 
43
43
 
44
- @attr.s
44
+ @attr.s(frozen=True)
45
45
  class CertificateTransparencyLogState(CryptoDataParamsBase):
46
46
  state_type = attr.ib(
47
47
  converter=convert_enum(CertificateTransparencyLogStateType),
@@ -53,7 +53,7 @@ class CertificateTransparencyLogState(CryptoDataParamsBase):
53
53
  )
54
54
 
55
55
 
56
- @attr.s
56
+ @attr.s(frozen=True)
57
57
  class CertificateTransparencyLogTemporalInterval(CryptoDataParamsBase):
58
58
  start_inclusive = attr.ib(
59
59
  converter=convert_datetime(),
@@ -65,7 +65,7 @@ class CertificateTransparencyLogTemporalInterval(CryptoDataParamsBase):
65
65
  )
66
66
 
67
67
 
68
- @attr.s
68
+ @attr.s(frozen=True)
69
69
  class CertificateTransparencyLogParamsBase(CryptoDataParamsBase):
70
70
  log_id = attr.ib(
71
71
  converter=convert_base64_data(),
@@ -75,7 +75,8 @@ class CertificateTransparencyLogParamsBase(CryptoDataParamsBase):
75
75
 
76
76
 
77
77
  class CertificateTransparencyLogUnknown(CertificateTransparencyLogParamsBase):
78
- pass
78
+ def __str__(self):
79
+ return str(self.log_id)
79
80
 
80
81
 
81
82
  @attr.s(frozen=True)
@@ -131,6 +132,11 @@ class CertificateTransparencyLogParams( # pylint: disable=too-many-instance-att
131
132
  if self.mmd < 1:
132
133
  raise ValueError(self.mmd)
133
134
 
135
+ def __str__(self):
136
+ return '{} ({})'.format(
137
+ self.description, self.log_id
138
+ )
139
+
134
140
  @classmethod
135
141
  def description_to_enum_item_name(cls, description):
136
142
  name = name_to_enum_item_name(description)
@@ -208,7 +214,7 @@ def convert_root_certificate_params():
208
214
  return _RootCertificateParamCertificateConverter()
209
215
 
210
216
 
211
- @attr.s
217
+ @attr.s(frozen=True)
212
218
  class RootCertificateTrustStoreConstraint(CryptoDataParamsBase):
213
219
  owner = attr.ib(
214
220
  converter=convert_enum(Entity),
@@ -221,7 +227,7 @@ class RootCertificateTrustStoreConstraint(CryptoDataParamsBase):
221
227
  )
222
228
 
223
229
 
224
- @attr.s
230
+ @attr.s(frozen=True)
225
231
  class RootCertificateParams(CryptoDataParamsFetchedBase):
226
232
  certificate = attr.ib(
227
233
  converter=convert_root_certificate_params(),
@@ -281,9 +287,7 @@ class RootCertificateBase(CryptoDataEnumBase):
281
287
  def get_item_by_sha2_256_fingerprint(cls, fingerprint_value):
282
288
  if not hasattr(cls, '_ITEMS_BY_SHA2_256_HASH'):
283
289
  cls._ITEMS_BY_SHA2_256_HASH = {
284
- bytes_to_hex_string(
285
- item.value.certificate.get_digest(Hash.SHA2_256, item.value.certificate.der)
286
- ): item
290
+ bytes_to_hex_string(item.value.certificate.get_digest(Hash.SHA2_256)): item
287
291
  for item in cls
288
292
  }
289
293