certificate_transparency.py 979 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # This file is dual licensed under the terms of the Apache License, Version
  2. # 2.0, and the BSD License. See the LICENSE file in the root of this repository
  3. # for complete details.
  4. import abc
  5. import datetime
  6. from enum import Enum
  7. class LogEntryType(Enum):
  8. X509_CERTIFICATE = 0
  9. PRE_CERTIFICATE = 1
  10. class Version(Enum):
  11. v1 = 0
  12. class SignedCertificateTimestamp(metaclass=abc.ABCMeta):
  13. @abc.abstractproperty
  14. def version(self) -> Version:
  15. """
  16. Returns the SCT version.
  17. """
  18. @abc.abstractproperty
  19. def log_id(self) -> bytes:
  20. """
  21. Returns an identifier indicating which log this SCT is for.
  22. """
  23. @abc.abstractproperty
  24. def timestamp(self) -> datetime.datetime:
  25. """
  26. Returns the timestamp for this SCT.
  27. """
  28. @abc.abstractproperty
  29. def entry_type(self) -> LogEntryType:
  30. """
  31. Returns whether this is an SCT for a certificate or pre-certificate.
  32. """