1
|
from typing import Dict
|
2
|
from src.constants import *
|
3
|
|
4
|
|
5
|
class Certificate:
|
6
|
def __init__(self,
|
7
|
certificate_id: int,
|
8
|
common_name: str,
|
9
|
valid_from: str,
|
10
|
valid_to: str,
|
11
|
pem_data: str,
|
12
|
private_key_id: int,
|
13
|
type_id: int,
|
14
|
parent_id: int,
|
15
|
usages: Dict[int, bool],
|
16
|
revocation_date: str = "",
|
17
|
revocation_reason: str = ""):
|
18
|
self.certificate_id: int = certificate_id
|
19
|
self.common_name: str = common_name
|
20
|
self.valid_from: str = valid_from
|
21
|
self.valid_to: str = valid_to
|
22
|
self.pem_data: str = pem_data
|
23
|
self.revocation_date = revocation_date
|
24
|
self.revocation_reason = revocation_reason
|
25
|
self.private_key_id: int = private_key_id
|
26
|
self.type_id: int = type_id
|
27
|
self.parent_id: int = parent_id
|
28
|
self.usages: Dict[int, bool] = DICT_USAGES.copy()
|
29
|
|
30
|
for usage_id, usage_value in usages.items():
|
31
|
self.usages[usage_id] = usage_value
|