CryptoDataHub 0.12.6__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.
Files changed (70) hide show
  1. CryptoDataHub-0.12.6.dist-info/LICENSE.txt +373 -0
  2. CryptoDataHub-0.12.6.dist-info/METADATA +119 -0
  3. CryptoDataHub-0.12.6.dist-info/RECORD +70 -0
  4. CryptoDataHub-0.12.6.dist-info/WHEEL +5 -0
  5. CryptoDataHub-0.12.6.dist-info/top_level.txt +1 -0
  6. cryptodatahub/__init__.py +0 -0
  7. cryptodatahub/__setup__.py +10 -0
  8. cryptodatahub/common/__init__.py +0 -0
  9. cryptodatahub/common/algorithm.py +164 -0
  10. cryptodatahub/common/attack-named.json +74 -0
  11. cryptodatahub/common/attack-type.json +58 -0
  12. cryptodatahub/common/authentication.json +113 -0
  13. cryptodatahub/common/block-cipher-mode.json +75 -0
  14. cryptodatahub/common/block-cipher.json +474 -0
  15. cryptodatahub/common/certificate-transparency-log.json +2394 -0
  16. cryptodatahub/common/client.json +20 -0
  17. cryptodatahub/common/dhparam-well-known.json +1975 -0
  18. cryptodatahub/common/ecparam-well-known.json +1868 -0
  19. cryptodatahub/common/entity.json +269 -0
  20. cryptodatahub/common/entity.py +110 -0
  21. cryptodatahub/common/exception.py +28 -0
  22. cryptodatahub/common/grade.py +200 -0
  23. cryptodatahub/common/hash.json +273 -0
  24. cryptodatahub/common/key-exchange.json +140 -0
  25. cryptodatahub/common/key.py +571 -0
  26. cryptodatahub/common/mac.json +404 -0
  27. cryptodatahub/common/named-group.json +902 -0
  28. cryptodatahub/common/parameter.py +149 -0
  29. cryptodatahub/common/root-certificate.json +19240 -0
  30. cryptodatahub/common/server.json +56 -0
  31. cryptodatahub/common/signature.json +233 -0
  32. cryptodatahub/common/standard.json +57 -0
  33. cryptodatahub/common/stores.py +323 -0
  34. cryptodatahub/common/types.py +524 -0
  35. cryptodatahub/common/utils.py +112 -0
  36. cryptodatahub/common/vulnerability.json +2 -0
  37. cryptodatahub/dnsrec/__init__.py +0 -0
  38. cryptodatahub/dnsrec/algorithm.json +114 -0
  39. cryptodatahub/dnsrec/algorithm.py +87 -0
  40. cryptodatahub/dnsrec/digest-type.json +26 -0
  41. cryptodatahub/dnsrec/rr-type.json +805 -0
  42. cryptodatahub/ssh/__init__.py +0 -0
  43. cryptodatahub/ssh/algorithm.py +194 -0
  44. cryptodatahub/ssh/compression-algorithm.json +24 -0
  45. cryptodatahub/ssh/elliptic-curve-identifier.json +50 -0
  46. cryptodatahub/ssh/encryption-algorithm.json +587 -0
  47. cryptodatahub/ssh/host-key-algorithm.json +482 -0
  48. cryptodatahub/ssh/kex-algorithm.json +709 -0
  49. cryptodatahub/ssh/mac-algorithm.json +566 -0
  50. cryptodatahub/tls/__init__.py +0 -0
  51. cryptodatahub/tls/algorithm.py +324 -0
  52. cryptodatahub/tls/certificate-compression-algorithm.json +14 -0
  53. cryptodatahub/tls/cipher-kind.json +171 -0
  54. cryptodatahub/tls/cipher-suite-extension.json +10 -0
  55. cryptodatahub/tls/cipher-suite.json +5098 -0
  56. cryptodatahub/tls/client.json +4757 -0
  57. cryptodatahub/tls/client.py +220 -0
  58. cryptodatahub/tls/compression-method.json +20 -0
  59. cryptodatahub/tls/ec-point-format.json +20 -0
  60. cryptodatahub/tls/extension-type.json +282 -0
  61. cryptodatahub/tls/grease-one-byte.json +34 -0
  62. cryptodatahub/tls/grease-two-byte.json +66 -0
  63. cryptodatahub/tls/hash-and-signature-algorithm.json +266 -0
  64. cryptodatahub/tls/named-curve.json +292 -0
  65. cryptodatahub/tls/next-protocol-name.json +20 -0
  66. cryptodatahub/tls/protocol-name.json +71 -0
  67. cryptodatahub/tls/psk-key-exchange-mode.json +10 -0
  68. cryptodatahub/tls/token-binding-paramater.json +14 -0
  69. cryptodatahub/tls/version.json +154 -0
  70. cryptodatahub/tls/version.py +17 -0
File without changes
@@ -0,0 +1,194 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ import abc
4
+ import enum
5
+ import attr
6
+
7
+ import six
8
+
9
+ from cryptodatahub.common.algorithm import (
10
+ BlockCipher,
11
+ BlockCipherMode,
12
+ Hash,
13
+ KeyExchange,
14
+ MAC,
15
+ MACMode,
16
+ NamedGroup,
17
+ Signature,
18
+ )
19
+ from cryptodatahub.common.grade import GradeableComplex, GradeableVulnerabilities
20
+ from cryptodatahub.common.key import PublicKeySize
21
+ from cryptodatahub.common.parameter import DHParamWellKnown
22
+ from cryptodatahub.common.types import (
23
+ CryptoDataEnumCodedBase,
24
+ CryptoDataParamsEnumString,
25
+ convert_enum,
26
+ convert_variadic,
27
+ )
28
+
29
+
30
+ @attr.s(frozen=True)
31
+ class SshAlgorithmParams(CryptoDataParamsEnumString, GradeableComplex):
32
+ @property
33
+ @abc.abstractmethod
34
+ def _gradeable_algorithms(self):
35
+ raise NotImplementedError()
36
+
37
+ def __attrs_post_init__(self):
38
+ gradeables = []
39
+ for algorithm in self._gradeable_algorithms:
40
+ if isinstance(algorithm, six.string_types):
41
+ gradeable = getattr(self, algorithm)
42
+ if gradeable is not None:
43
+ gradeable = gradeable.value
44
+ else:
45
+ gradeable = algorithm
46
+
47
+ if gradeable is not None:
48
+ gradeables.append(gradeable)
49
+
50
+ object.__setattr__(self, 'gradeables', gradeables)
51
+
52
+ attr.validate(self)
53
+
54
+
55
+ @attr.s(frozen=True)
56
+ class EncryptionAlgorithmParams(SshAlgorithmParams):
57
+ cipher = attr.ib(
58
+ converter=convert_enum(BlockCipher),
59
+ validator=attr.validators.optional(attr.validators.instance_of(BlockCipher))
60
+ )
61
+ mode = attr.ib(
62
+ converter=convert_enum(BlockCipherMode),
63
+ validator=attr.validators.optional(attr.validators.instance_of(BlockCipherMode))
64
+ )
65
+
66
+ @property
67
+ def _gradeable_algorithms(self):
68
+ return ('cipher', 'mode')
69
+
70
+
71
+ @attr.s(frozen=True)
72
+ class MacAlgorithmParams(SshAlgorithmParams):
73
+ truncated_size = attr.ib(validator=attr.validators.optional(attr.validators.instance_of(int)))
74
+ mac = attr.ib(
75
+ converter=convert_enum(MAC),
76
+ validator=attr.validators.optional(attr.validators.instance_of(MAC))
77
+ )
78
+ mode = attr.ib(
79
+ converter=convert_enum(MACMode),
80
+ validator=attr.validators.optional(attr.validators.instance_of(MACMode))
81
+ )
82
+
83
+ @property
84
+ def size(self):
85
+ if self.truncated_size is not None:
86
+ return self.truncated_size
87
+
88
+ return self.mac.value.digest_size
89
+
90
+ @property
91
+ def _gradeable_algorithms(self):
92
+ return ('mac', 'mode')
93
+
94
+
95
+ @attr.s(frozen=True)
96
+ class KexAlgorithmParams(SshAlgorithmParams):
97
+ kex = attr.ib(
98
+ converter=convert_enum(KeyExchange),
99
+ validator=attr.validators.optional(attr.validators.instance_of(KeyExchange))
100
+ )
101
+ key_parameter = attr.ib(
102
+ converter=convert_variadic((convert_enum(NamedGroup), convert_enum(DHParamWellKnown))),
103
+ validator=attr.validators.optional(
104
+ attr.validators.instance_of((NamedGroup, DHParamWellKnown, six.string_types))
105
+ )
106
+ )
107
+ exchange_hash = attr.ib(
108
+ converter=convert_enum(Hash),
109
+ validator=attr.validators.optional(attr.validators.instance_of(Hash))
110
+ )
111
+ key_size = attr.ib(validator=attr.validators.optional(attr.validators.instance_of(int)))
112
+
113
+ def __attrs_post_init__(self):
114
+ super(KexAlgorithmParams, self).__attrs_post_init__()
115
+
116
+ if self.key_size is not None:
117
+ gradeables = PublicKeySize(self.kex, self.key_size).gradeables
118
+ if gradeables is None:
119
+ self.gradeables.append(gradeables)
120
+ else:
121
+ self.gradeables.extend(gradeables)
122
+
123
+ attr.validate(self)
124
+
125
+ @property
126
+ def _gradeable_algorithms(self):
127
+ gradeables = ['kex', 'exchange_hash']
128
+
129
+ if isinstance(self.key_parameter, DHParamWellKnown):
130
+ gradeables.append(self.key_parameter.value)
131
+
132
+ return gradeables
133
+
134
+
135
+ class SshHostKeyType(enum.Enum):
136
+ HOST_KEY = 'host key'
137
+ HOST_CERTIFICATE = 'host certificate'
138
+ PGP_KEY = 'PGP key'
139
+ SECURE_KEY = 'secure key'
140
+ SECURE_CERTIFICATE = 'secure certificate'
141
+ SPKI_KEY = 'SPKI key'
142
+ X509_CERTIFICATE = 'X.509 certificate'
143
+ X509_CERTIFICATE_CHAIN = 'X.509 certificate chain'
144
+
145
+
146
+ @attr.s(frozen=True)
147
+ class HostKeyAlgorithmParams(SshAlgorithmParams):
148
+ key_type = attr.ib(
149
+ converter=convert_enum(SshHostKeyType),
150
+ validator=attr.validators.instance_of(SshHostKeyType)
151
+ )
152
+ signature = attr.ib(
153
+ converter=convert_enum(Signature),
154
+ validator=attr.validators.optional(attr.validators.instance_of(Signature))
155
+ )
156
+
157
+ @property
158
+ def _gradeable_algorithms(self):
159
+ return ('signature',)
160
+
161
+
162
+ @attr.s(frozen=True)
163
+ class CompressionAlgorithmParams(CryptoDataParamsEnumString, GradeableVulnerabilities):
164
+ @classmethod
165
+ def get_gradeable_name(cls):
166
+ return 'compression'
167
+
168
+
169
+ @attr.s(frozen=True)
170
+ class EllipticCurveIdentifierParams(CryptoDataParamsEnumString):
171
+ named_group = attr.ib(
172
+ converter=convert_enum(NamedGroup),
173
+ validator=attr.validators.instance_of(NamedGroup)
174
+ )
175
+
176
+
177
+ SshEncryptionAlgorithm = CryptoDataEnumCodedBase(
178
+ 'SshEncryptionAlgorithm', CryptoDataEnumCodedBase.get_json_records(EncryptionAlgorithmParams)
179
+ )
180
+ SshMacAlgorithm = CryptoDataEnumCodedBase(
181
+ 'SshMacAlgorithm', CryptoDataEnumCodedBase.get_json_records(MacAlgorithmParams)
182
+ )
183
+ SshKexAlgorithm = CryptoDataEnumCodedBase(
184
+ 'SshKexAlgorithm', CryptoDataEnumCodedBase.get_json_records(KexAlgorithmParams)
185
+ )
186
+ SshHostKeyAlgorithm = CryptoDataEnumCodedBase(
187
+ 'SshHostKeyAlgorithm', CryptoDataEnumCodedBase.get_json_records(HostKeyAlgorithmParams)
188
+ )
189
+ SshCompressionAlgorithm = CryptoDataEnumCodedBase(
190
+ 'SshCompressionAlgorithm', CryptoDataEnumCodedBase.get_json_records(CompressionAlgorithmParams)
191
+ )
192
+ SshEllipticCurveIdentifier = CryptoDataEnumCodedBase(
193
+ 'SshEllipticCurveIdentifier', CryptoDataEnumCodedBase.get_json_records(EllipticCurveIdentifierParams)
194
+ )
@@ -0,0 +1,24 @@
1
+ {
2
+ "ZLIB_OPENSSH_COM": {
3
+ "code": "zlib@openssh.com",
4
+ "vulnerabilities": []
5
+ },
6
+ "ZLIB": {
7
+ "code": "zlib",
8
+ "vulnerabilities": [
9
+ {
10
+ "attack_type": "COLLISION",
11
+ "grade": "WEAK",
12
+ "named": "CRIME"
13
+ }
14
+ ]
15
+ },
16
+ "LZ4_SENSORSDATA_CN": {
17
+ "code": "lz4@sensorsdata.cn",
18
+ "vulnerabilities": []
19
+ },
20
+ "NONE": {
21
+ "code": "none",
22
+ "vulnerabilities": []
23
+ }
24
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "SECP256R1": {
3
+ "code": "nistp256",
4
+ "named_group": "PRIME256V1"
5
+ },
6
+ "SECP384R1": {
7
+ "code": "nistp384",
8
+ "named_group": "SECP384R1"
9
+ },
10
+ "SECP521R1": {
11
+ "code": "nistp521",
12
+ "named_group": "SECP521R1"
13
+ },
14
+ "SECT163K1": {
15
+ "code": "1.3.132.0.1",
16
+ "named_group": "SECT163K1"
17
+ },
18
+ "SECP192R1": {
19
+ "code": "1.2.840.10045.3.1.1",
20
+ "named_group": "PRIME192V1"
21
+ },
22
+ "SECP224R1": {
23
+ "code": "1.3.132.0.33",
24
+ "named_group": "SECP224R1"
25
+ },
26
+ "SECT233K1": {
27
+ "code": "1.3.132.0.26",
28
+ "named_group": "SECT233K1"
29
+ },
30
+ "SECT233R1": {
31
+ "code": "1.3.132.0.27",
32
+ "named_group": "SECT233R1"
33
+ },
34
+ "SECT283K1": {
35
+ "code": "1.3.132.0.16",
36
+ "named_group": "SECT283K1"
37
+ },
38
+ "SECT409K1": {
39
+ "code": "1.3.132.0.36",
40
+ "named_group": "SECT409K1"
41
+ },
42
+ "SECT409R1": {
43
+ "code": "1.3.132.0.37",
44
+ "named_group": "SECT409R1"
45
+ },
46
+ "SECT571K1": {
47
+ "code": "1.3.132.0.38",
48
+ "named_group": "SECT571K1"
49
+ }
50
+ }