File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 44import io
55import os
66from datetime import datetime , timezone
7- from typing import BinaryIO
7+ from typing import Any , BinaryIO
88
99from dissect .cstruct import cstruct
1010
@@ -151,9 +151,11 @@ def finalize(self) -> None:
151151 self .cipher .clean ()
152152
153153
154- def key_fingerprint (pkey : PKCS1_OAEP .PKCS1OAEP_Cipher ) -> bytes :
155- if isinstance (pkey , PKCS1_OAEP .PKCS1OAEP_Cipher ):
156- pkey = pkey ._key
157- der = pkey .export_key ("DER" )
158-
154+ def key_fingerprint (pkey : PKCS1_OAEP .PKCS1OAEP_Cipher | Any ) -> bytes :
155+ if HAS_PYSTANDALONE :
156+ der = pkey .der ()
157+ else :
158+ if isinstance (pkey , PKCS1_OAEP .PKCS1OAEP_Cipher ):
159+ pkey = pkey ._key
160+ der = pkey .export_key ("DER" )
159161 return hashlib .sha256 (der ).digest ()
You can’t perform that action at this time.
0 commit comments