1 |
dbd44a51
|
David Friesecký
|
from typing import Dict
|
2 |
181e1196
|
Jan Pašek
|
from src.constants import *
|
3 |
dbd44a51
|
David Friesecký
|
|
4 |
|
|
|
5 |
d79d1369
|
David Friesecký
|
class Certificate:
|
6 |
0e7c3096
|
David Friesecký
|
|
7 |
d79d1369
|
David Friesecký
|
def __init__(self,
|
8 |
|
|
certificate_id: int,
|
9 |
|
|
valid_from: str,
|
10 |
|
|
valid_to: str,
|
11 |
|
|
pem_data: str,
|
12 |
dbd44a51
|
David Friesecký
|
type_id: int,
|
13 |
47e0e828
|
David Friesecký
|
parent_id: int,
|
14 |
0e7c3096
|
David Friesecký
|
private_key_id: int,
|
15 |
58051326
|
David Friesecký
|
usages: Dict[int, bool],
|
16 |
0e7c3096
|
David Friesecký
|
common_name: str,
|
17 |
|
|
country_code: str = None,
|
18 |
|
|
locality: str = None,
|
19 |
|
|
province: str = None,
|
20 |
|
|
organization: str = None,
|
21 |
|
|
organizational_unit: str = None,
|
22 |
|
|
email_address: str = None,
|
23 |
|
|
revocation_date: str = None,
|
24 |
|
|
revocation_reason: str = None):
|
25 |
d79d1369
|
David Friesecký
|
self.certificate_id: int = certificate_id
|
26 |
|
|
self.valid_from: str = valid_from
|
27 |
|
|
self.valid_to: str = valid_to
|
28 |
|
|
self.pem_data: str = pem_data
|
29 |
dbd44a51
|
David Friesecký
|
self.type_id: int = type_id
|
30 |
47e0e828
|
David Friesecký
|
self.parent_id: int = parent_id
|
31 |
0e7c3096
|
David Friesecký
|
self.private_key_id: int = private_key_id
|
32 |
|
|
self.common_name: str = common_name
|
33 |
|
|
self.country_code: str = country_code
|
34 |
|
|
self.locality: str = locality
|
35 |
|
|
self.province: str = province
|
36 |
|
|
self.organization: str = organization
|
37 |
|
|
self.organizational_unit: str = organizational_unit
|
38 |
|
|
self.email_address: str = email_address
|
39 |
|
|
self.revocation_date: str = revocation_date
|
40 |
|
|
self.revocation_reason: str = revocation_reason
|
41 |
dbd44a51
|
David Friesecký
|
self.usages: Dict[int, bool] = DICT_USAGES.copy()
|
42 |
|
|
|
43 |
0e7c3096
|
David Friesecký
|
#if revocation_date is None:
|
44 |
|
|
# self.revocation_date = ""
|
45 |
8b049f43
|
David Friesecký
|
|
46 |
0e7c3096
|
David Friesecký
|
#if revocation_reason is None:
|
47 |
|
|
# self.revocation_reason = ""
|
48 |
8b049f43
|
David Friesecký
|
|
49 |
dbd44a51
|
David Friesecký
|
for usage_id, usage_value in usages.items():
|
50 |
eb2ea1ff
|
Captain_Trojan
|
self.usages[usage_id] = usage_value
|