Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions acquire/crypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import io
import os
from datetime import datetime, timezone
from typing import BinaryIO
from typing import Any, BinaryIO

from dissect.cstruct import cstruct

Expand Down Expand Up @@ -151,9 +151,11 @@
self.cipher.clean()


def key_fingerprint(pkey: PKCS1_OAEP.PKCS1OAEP_Cipher) -> bytes:
if isinstance(pkey, PKCS1_OAEP.PKCS1OAEP_Cipher):
pkey = pkey._key
der = pkey.export_key("DER")

def key_fingerprint(pkey: PKCS1_OAEP.PKCS1OAEP_Cipher | Any) -> bytes:
if HAS_PYSTANDALONE:
der = pkey.der()

Check warning on line 156 in acquire/crypt.py

View check run for this annotation

Codecov / codecov/patch

acquire/crypt.py#L156

Added line #L156 was not covered by tests
else:
if isinstance(pkey, PKCS1_OAEP.PKCS1OAEP_Cipher):
pkey = pkey._key
der = pkey.export_key("DER")
return hashlib.sha256(der).digest()
Loading