Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/cryptography/hazmat/primitives/asymmetric/utils.py: 62%

13 statements  

« prev     ^ index     » next       coverage.py v7.2.2, created at 2023-03-26 06:36 +0000

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 

5 

6from cryptography.hazmat.bindings._rust import asn1 

7from cryptography.hazmat.primitives import hashes 

8 

9decode_dss_signature = asn1.decode_dss_signature 

10encode_dss_signature = asn1.encode_dss_signature 

11 

12 

13class Prehashed: 

14 def __init__(self, algorithm: hashes.HashAlgorithm): 

15 if not isinstance(algorithm, hashes.HashAlgorithm): 

16 raise TypeError("Expected instance of HashAlgorithm.") 

17 

18 self._algorithm = algorithm 

19 self._digest_size = algorithm.digest_size 

20 

21 @property 

22 def digest_size(self) -> int: 

23 return self._digest_size