__init__.py 1020 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. from __future__ import absolute_import, division, print_function
  5. import abc
  6. import six
  7. @six.add_metaclass(abc.ABCMeta)
  8. class AsymmetricSignatureContext(object):
  9. @abc.abstractmethod
  10. def update(self, data):
  11. """
  12. Processes the provided bytes and returns nothing.
  13. """
  14. @abc.abstractmethod
  15. def finalize(self):
  16. """
  17. Returns the signature as bytes.
  18. """
  19. @six.add_metaclass(abc.ABCMeta)
  20. class AsymmetricVerificationContext(object):
  21. @abc.abstractmethod
  22. def update(self, data):
  23. """
  24. Processes the provided bytes and returns nothing.
  25. """
  26. @abc.abstractmethod
  27. def verify(self):
  28. """
  29. Raises an exception if the bytes provided to update do not match the
  30. signature or the signature does not match the public key.
  31. """