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 |
|
|
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 |
dbd44a51
|
David Friesecký
|
type_id: int,
|
14 |
47e0e828
|
David Friesecký
|
parent_id: int,
|
15 |
58051326
|
David Friesecký
|
usages: Dict[int, bool],
|
16 |
|
|
revocation_date: str = "",
|
17 |
|
|
revocation_reason: str = ""):
|
18 |
d79d1369
|
David Friesecký
|
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 |
58051326
|
David Friesecký
|
self.revocation_date = revocation_date
|
24 |
|
|
self.revocation_reason = revocation_reason
|
25 |
d79d1369
|
David Friesecký
|
self.private_key_id: int = private_key_id
|
26 |
dbd44a51
|
David Friesecký
|
self.type_id: int = type_id
|
27 |
47e0e828
|
David Friesecký
|
self.parent_id: int = parent_id
|
28 |
dbd44a51
|
David Friesecký
|
self.usages: Dict[int, bool] = DICT_USAGES.copy()
|
29 |
|
|
|
30 |
8b049f43
|
David Friesecký
|
if revocation_date is None:
|
31 |
|
|
self.revocation_date = ""
|
32 |
|
|
|
33 |
|
|
if revocation_reason is None:
|
34 |
|
|
self.revocation_reason = ""
|
35 |
|
|
|
36 |
dbd44a51
|
David Friesecký
|
for usage_id, usage_value in usages.items():
|
37 |
eb2ea1ff
|
Captain_Trojan
|
self.usages[usage_id] = usage_value
|