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.
- CryptoDataHub-0.12.6.dist-info/LICENSE.txt +373 -0
- CryptoDataHub-0.12.6.dist-info/METADATA +119 -0
- CryptoDataHub-0.12.6.dist-info/RECORD +70 -0
- CryptoDataHub-0.12.6.dist-info/WHEEL +5 -0
- CryptoDataHub-0.12.6.dist-info/top_level.txt +1 -0
- cryptodatahub/__init__.py +0 -0
- cryptodatahub/__setup__.py +10 -0
- cryptodatahub/common/__init__.py +0 -0
- cryptodatahub/common/algorithm.py +164 -0
- cryptodatahub/common/attack-named.json +74 -0
- cryptodatahub/common/attack-type.json +58 -0
- cryptodatahub/common/authentication.json +113 -0
- cryptodatahub/common/block-cipher-mode.json +75 -0
- cryptodatahub/common/block-cipher.json +474 -0
- cryptodatahub/common/certificate-transparency-log.json +2394 -0
- cryptodatahub/common/client.json +20 -0
- cryptodatahub/common/dhparam-well-known.json +1975 -0
- cryptodatahub/common/ecparam-well-known.json +1868 -0
- cryptodatahub/common/entity.json +269 -0
- cryptodatahub/common/entity.py +110 -0
- cryptodatahub/common/exception.py +28 -0
- cryptodatahub/common/grade.py +200 -0
- cryptodatahub/common/hash.json +273 -0
- cryptodatahub/common/key-exchange.json +140 -0
- cryptodatahub/common/key.py +571 -0
- cryptodatahub/common/mac.json +404 -0
- cryptodatahub/common/named-group.json +902 -0
- cryptodatahub/common/parameter.py +149 -0
- cryptodatahub/common/root-certificate.json +19240 -0
- cryptodatahub/common/server.json +56 -0
- cryptodatahub/common/signature.json +233 -0
- cryptodatahub/common/standard.json +57 -0
- cryptodatahub/common/stores.py +323 -0
- cryptodatahub/common/types.py +524 -0
- cryptodatahub/common/utils.py +112 -0
- cryptodatahub/common/vulnerability.json +2 -0
- cryptodatahub/dnsrec/__init__.py +0 -0
- cryptodatahub/dnsrec/algorithm.json +114 -0
- cryptodatahub/dnsrec/algorithm.py +87 -0
- cryptodatahub/dnsrec/digest-type.json +26 -0
- cryptodatahub/dnsrec/rr-type.json +805 -0
- cryptodatahub/ssh/__init__.py +0 -0
- cryptodatahub/ssh/algorithm.py +194 -0
- cryptodatahub/ssh/compression-algorithm.json +24 -0
- cryptodatahub/ssh/elliptic-curve-identifier.json +50 -0
- cryptodatahub/ssh/encryption-algorithm.json +587 -0
- cryptodatahub/ssh/host-key-algorithm.json +482 -0
- cryptodatahub/ssh/kex-algorithm.json +709 -0
- cryptodatahub/ssh/mac-algorithm.json +566 -0
- cryptodatahub/tls/__init__.py +0 -0
- cryptodatahub/tls/algorithm.py +324 -0
- cryptodatahub/tls/certificate-compression-algorithm.json +14 -0
- cryptodatahub/tls/cipher-kind.json +171 -0
- cryptodatahub/tls/cipher-suite-extension.json +10 -0
- cryptodatahub/tls/cipher-suite.json +5098 -0
- cryptodatahub/tls/client.json +4757 -0
- cryptodatahub/tls/client.py +220 -0
- cryptodatahub/tls/compression-method.json +20 -0
- cryptodatahub/tls/ec-point-format.json +20 -0
- cryptodatahub/tls/extension-type.json +282 -0
- cryptodatahub/tls/grease-one-byte.json +34 -0
- cryptodatahub/tls/grease-two-byte.json +66 -0
- cryptodatahub/tls/hash-and-signature-algorithm.json +266 -0
- cryptodatahub/tls/named-curve.json +292 -0
- cryptodatahub/tls/next-protocol-name.json +20 -0
- cryptodatahub/tls/protocol-name.json +71 -0
- cryptodatahub/tls/psk-key-exchange-mode.json +10 -0
- cryptodatahub/tls/token-binding-paramater.json +14 -0
- cryptodatahub/tls/version.json +154 -0
- cryptodatahub/tls/version.py +17 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
import six
|
|
4
|
+
import attr
|
|
5
|
+
|
|
6
|
+
from cryptodatahub.common.entity import Entity, Server
|
|
7
|
+
from cryptodatahub.common.exception import InvalidValue
|
|
8
|
+
from cryptodatahub.common.grade import GradeableVulnerabilities
|
|
9
|
+
from cryptodatahub.common.types import (
|
|
10
|
+
CryptoDataEnumBase,
|
|
11
|
+
CryptoDataParamsBase,
|
|
12
|
+
CryptoDataParamsNamed,
|
|
13
|
+
convert_big_enum,
|
|
14
|
+
convert_dict_to_object,
|
|
15
|
+
convert_enum,
|
|
16
|
+
convert_iterable,
|
|
17
|
+
convert_variadic,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@attr.s(frozen=True)
|
|
22
|
+
class StandardParams(CryptoDataParamsNamed):
|
|
23
|
+
publisher = attr.ib(
|
|
24
|
+
converter=convert_enum(Entity),
|
|
25
|
+
validator=attr.validators.instance_of(Entity),
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
Standard = CryptoDataEnumBase('Standard', CryptoDataEnumBase.get_json_records(StandardParams))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@attr.s(eq=False, frozen=True)
|
|
33
|
+
class DHParameterNumbers(object):
|
|
34
|
+
p = attr.ib( # pylint: disable=invalid-name
|
|
35
|
+
converter=convert_big_enum(),
|
|
36
|
+
validator=attr.validators.instance_of(six.integer_types),
|
|
37
|
+
metadata={'human_readable_name': 'p'},
|
|
38
|
+
)
|
|
39
|
+
g = attr.ib( # pylint: disable=invalid-name
|
|
40
|
+
converter=convert_big_enum(),
|
|
41
|
+
validator=attr.validators.instance_of(six.integer_types),
|
|
42
|
+
metadata={'human_readable_name': 'g'},
|
|
43
|
+
)
|
|
44
|
+
q = attr.ib( # pylint: disable=invalid-name
|
|
45
|
+
default=None,
|
|
46
|
+
converter=convert_big_enum(),
|
|
47
|
+
validator=attr.validators.optional(attr.validators.instance_of(six.integer_types)),
|
|
48
|
+
metadata={'human_readable_name': 'q'},
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
def __eq__(self, other):
|
|
52
|
+
return self.p == other.p and self.g == other.g and (self.q is None or self.q == other.q)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@attr.s(eq=False, frozen=True)
|
|
56
|
+
class DHParamWellKnownParams(CryptoDataParamsBase, GradeableVulnerabilities):
|
|
57
|
+
parameter_numbers = attr.ib(
|
|
58
|
+
converter=convert_dict_to_object(DHParameterNumbers),
|
|
59
|
+
validator=attr.validators.instance_of(DHParameterNumbers)
|
|
60
|
+
)
|
|
61
|
+
name = attr.ib(validator=attr.validators.instance_of(six.string_types))
|
|
62
|
+
source = attr.ib(
|
|
63
|
+
converter=convert_variadic((convert_enum(Entity), convert_enum(Server))),
|
|
64
|
+
validator=attr.validators.instance_of((Entity, Server))
|
|
65
|
+
)
|
|
66
|
+
standards = attr.ib(
|
|
67
|
+
converter=convert_iterable(convert_enum(Standard)),
|
|
68
|
+
validator=attr.validators.deep_iterable(attr.validators.instance_of(Standard))
|
|
69
|
+
)
|
|
70
|
+
key_size = attr.ib(validator=attr.validators.instance_of(six.integer_types))
|
|
71
|
+
safe_prime = attr.ib(default=True, validator=attr.validators.instance_of(bool))
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def get_gradeable_name(cls):
|
|
75
|
+
return 'DH parameter'
|
|
76
|
+
|
|
77
|
+
def __str__(self):
|
|
78
|
+
if self.standards:
|
|
79
|
+
return '{} ({})'.format(self.name, ', '.join(map(lambda standard: standard.value.name, self.standards)))
|
|
80
|
+
|
|
81
|
+
return '{}-bit {} {} DH parameter'.format(self.key_size, self.source.value.name, self.name)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class DHParamWellKnownBase(CryptoDataEnumBase):
|
|
85
|
+
@classmethod
|
|
86
|
+
def from_parameter_numbers(cls, parameter_numbers):
|
|
87
|
+
return cls._from_attr('parameter_numbers', parameter_numbers)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
DHParamWellKnown = DHParamWellKnownBase(
|
|
91
|
+
'DHParamWellKnown', DHParamWellKnownBase.get_json_records(DHParamWellKnownParams)
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@attr.s
|
|
96
|
+
class ECParameterNumbers(object):
|
|
97
|
+
a = attr.ib( # pylint: disable=invalid-name
|
|
98
|
+
converter=convert_big_enum(),
|
|
99
|
+
validator=attr.validators.instance_of(six.integer_types),
|
|
100
|
+
metadata={'human_readable_name': 'a'},
|
|
101
|
+
)
|
|
102
|
+
b = attr.ib( # pylint: disable=invalid-name
|
|
103
|
+
converter=convert_big_enum(),
|
|
104
|
+
validator=attr.validators.instance_of(six.integer_types),
|
|
105
|
+
metadata={'human_readable_name': 'b'},
|
|
106
|
+
)
|
|
107
|
+
x = attr.ib( # pylint: disable=invalid-name
|
|
108
|
+
converter=convert_big_enum(),
|
|
109
|
+
validator=attr.validators.instance_of(six.integer_types),
|
|
110
|
+
metadata={'human_readable_name': 'x'},
|
|
111
|
+
)
|
|
112
|
+
y = attr.ib( # pylint: disable=invalid-name
|
|
113
|
+
converter=convert_big_enum(),
|
|
114
|
+
validator=attr.validators.instance_of(six.integer_types),
|
|
115
|
+
metadata={'human_readable_name': 'y'},
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
@attr.s(eq=False, frozen=True)
|
|
120
|
+
class ECParamWellKnownParams(CryptoDataParamsNamed):
|
|
121
|
+
standards = attr.ib(
|
|
122
|
+
converter=convert_iterable(convert_enum(Standard)),
|
|
123
|
+
validator=attr.validators.deep_iterable(attr.validators.instance_of(Standard))
|
|
124
|
+
)
|
|
125
|
+
aliases = attr.ib(validator=attr.validators.deep_iterable(attr.validators.instance_of(six.string_types)))
|
|
126
|
+
parameter_numbers = attr.ib(
|
|
127
|
+
converter=convert_dict_to_object(ECParameterNumbers),
|
|
128
|
+
validator=attr.validators.instance_of(ECParameterNumbers)
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
class ECParamWellKnownBase(CryptoDataEnumBase):
|
|
133
|
+
@classmethod
|
|
134
|
+
def from_parameter_numbers(cls, parameter_numbers):
|
|
135
|
+
return cls._from_attr('parameter_numbers', parameter_numbers)
|
|
136
|
+
|
|
137
|
+
@classmethod
|
|
138
|
+
def from_named_group(cls, named_group):
|
|
139
|
+
try:
|
|
140
|
+
ec_param = cls[named_group.name]
|
|
141
|
+
except KeyError as e:
|
|
142
|
+
six.raise_from(InvalidValue(named_group, cls), e)
|
|
143
|
+
|
|
144
|
+
return ec_param
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
ECParamWellKnown = ECParamWellKnownBase(
|
|
148
|
+
'ECParamWellKnown', ECParamWellKnownBase.get_json_records(ECParamWellKnownParams)
|
|
149
|
+
)
|