mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-18 14:42:24 +00:00
cert_audit: Fill validity dates in AuditData constructor
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
This commit is contained in:
parent
ebf011f43e
commit
cb8fc3275a
@ -48,11 +48,10 @@ class DataFormat(Enum):
|
|||||||
class AuditData:
|
class AuditData:
|
||||||
"""Store file, type and expiration date for audit."""
|
"""Store file, type and expiration date for audit."""
|
||||||
#pylint: disable=too-few-public-methods
|
#pylint: disable=too-few-public-methods
|
||||||
def __init__(self, data_type: DataType):
|
def __init__(self, data_type: DataType, x509_obj):
|
||||||
self.data_type = data_type
|
self.data_type = data_type
|
||||||
self.filename = ""
|
self.filename = ""
|
||||||
self.not_valid_after: datetime.datetime
|
self.fill_validity_duration(x509_obj)
|
||||||
self.not_valid_before: datetime.datetime
|
|
||||||
|
|
||||||
def fill_validity_duration(self, x509_obj):
|
def fill_validity_duration(self, x509_obj):
|
||||||
"""Fill expiration_date field from a x509 object"""
|
"""Fill expiration_date field from a x509 object"""
|
||||||
@ -211,8 +210,7 @@ class Auditor:
|
|||||||
result = None
|
result = None
|
||||||
self.warn(val_error)
|
self.warn(val_error)
|
||||||
if result is not None:
|
if result is not None:
|
||||||
audit_data = AuditData(data_type)
|
audit_data = AuditData(data_type, result)
|
||||||
audit_data.fill_validity_duration(result)
|
|
||||||
return audit_data
|
return audit_data
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user