1
|
from typing import Dict
|
2
|
from src.constants import *
|
3
|
|
4
|
|
5
|
class Certificate:
|
6
|
|
7
|
def __init__(self,
|
8
|
certificate_id: int,
|
9
|
valid_from: str,
|
10
|
valid_to: str,
|
11
|
pem_data: str,
|
12
|
type_id: int,
|
13
|
parent_id: int,
|
14
|
private_key_id: int,
|
15
|
usages: Dict[int, bool],
|
16
|
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
|
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
|
self.type_id: int = type_id
|
30
|
self.parent_id: int = parent_id
|
31
|
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
|
self.usages: Dict[int, bool] = DICT_USAGES.copy()
|
42
|
|
43
|
#if revocation_date is None:
|
44
|
# self.revocation_date = ""
|
45
|
|
46
|
#if revocation_reason is None:
|
47
|
# self.revocation_reason = ""
|
48
|
|
49
|
for usage_id, usage_value in usages.items():
|
50
|
self.usages[usage_id] = usage_value
|