Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import datetime
from SignatureBasique import SignatureBasique
from GlobalVariables import certificat_dict
from Errors import *
count_horodatage = 0
class Horodatage:
def __init__(self, information, AH, AH_cle_privee):
info = information
heure_date = datetime.datetime.now()
global count_horodatage
numero_serie = count_horodatage
count_horodatage = count_horodatage + 1
self.__TST_info = (info, heure_date, numero_serie)
self.__AH = AH
self.__signature_horo = SignatureBasique(str(self.__TST_info), AH_cle_privee, AH.get_certificat())
def get_heure_date(self):
return self.__TST_info[1]
def get_info(self):
return self.__TST_info[0]
def get_signature_horo(self):
return self.__signature_horo
def get_certificat_horo(self):
certificat_ID = self.__signature_horo.get_certificat_ID()
if certificat_ID not in certificat_dict:
raise CertificateError("Certificat non existant")
certif_horo = certificat_dict[certificat_ID]
return certif_horo