codekingpro/portable-devtools
114k
1# This file is dual licensed under the terms of the Apache License, Version2# 2.0, and the BSD License. See the LICENSE file in the root of this repository3# for complete details.4 5from __future__ import annotations6 7from cryptography.hazmat.bindings._rust import asn18from cryptography.hazmat.primitives import hashes9 10decode_dss_signature = asn1.decode_dss_signature11encode_dss_signature = asn1.encode_dss_signature12 13 14class NoDigestInfo:15 pass16 17 18class Prehashed:19 def __init__(self, algorithm: hashes.HashAlgorithm):20 if not isinstance(algorithm, hashes.HashAlgorithm):21 raise TypeError("Expected instance of HashAlgorithm.")22 23 self._algorithm = algorithm24 self._digest_size = algorithm.digest_size25 26 @property27 def digest_size(self) -> int:28 return self._digest_size29 