:py:mod:`dissect.fve.luks.luks` =============================== .. py:module:: dissect.fve.luks.luks Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: dissect.fve.luks.luks.LUKS Functions ~~~~~~~~~ .. autoapisummary:: :nosignatures: dissect.fve.luks.luks.derive_passphrase_key dissect.fve.luks.luks.find_luks_headers dissect.fve.luks.luks.is_luks_volume .. py:class:: LUKS(fh: BinaryIO) LUKS disk encryption. .. rubric:: References - https://gitlab.com/cryptsetup/cryptsetup - https://gitlab.com/cryptsetup/cryptsetup/-/blob/main/docs/on-disk-format-luks2.pdf .. py:attribute:: fh .. py:attribute:: header :value: None .. py:attribute:: header1 :value: None .. py:attribute:: header2 :value: None .. py:attribute:: cipher_name :value: None .. py:attribute:: cipher_mode :value: None .. py:attribute:: hash_spec :value: None .. py:attribute:: label :value: None .. py:attribute:: checksum_algorithm :value: None .. py:attribute:: uuid .. py:property:: unlocked :type: bool .. py:property:: keyslots :type: dict[int, dissect.fve.luks.metadata.Keyslot] .. py:method:: unlock(key: bytes, keyslot: int) -> None Unlock the volume with the volume encryption key. .. py:method:: unlock_with_key_file(path: pathlib.Path, offset: int = 0, size: int = -1, keyslot: int | None = None) -> None .. py:method:: unlock_with_key_fh(fh: BinaryIO, offset: int = 0, size: int = -1, keyslot: int | None = None) -> None .. py:method:: unlock_with_passphrase(passphrase: str | bytes, keyslot: int | None = None) -> None Unlock this volume with a passphrase and optional keyslot hint. .. py:method:: find_digest(keyslot: int) -> dissect.fve.luks.metadata.Digest Find digest metadata corresponding to the given keyslot. .. py:method:: find_segment(keyslot: int) -> dissect.fve.luks.metadata.Segment Find segment metadata corresponding to the given keyslot. .. py:method:: open() -> dissect.fve.crypto.dmcrypt.CryptStream Open this volume and return a readable (decrypted) stream. .. py:function:: derive_passphrase_key(passphrase: bytes, keyslot: dissect.fve.luks.metadata.Keyslot) -> bytes Derive a key from a passphrase with the given keyslot KDF information. :param passphrase: The passphrase to derive a key from. :param keyslot: The keyslot to use for the derivation. .. py:function:: find_luks_headers(fh: BinaryIO) -> tuple[int | None, int | None, int | None] .. py:function:: is_luks_volume(fh: BinaryIO) -> bool Return whether the file-like object is a LUKS volume.