dissect.fve 4.1.dev2__tar.gz → 4.2.dev2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/PKG-INFO +4 -3
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect/fve/bde/bde.py +26 -14
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect/fve/bde/information.py +26 -26
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect.fve.egg-info/PKG-INFO +4 -3
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect.fve.egg-info/requires.txt +1 -1
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/pyproject.toml +1 -1
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/test_bde.py +54 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tox.ini +5 -4
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/.git-blame-ignore-revs +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/.gitattributes +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/COPYRIGHT +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/LICENSE +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/MANIFEST.in +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/README.md +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect/fve/__init__.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect/fve/bde/__init__.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect/fve/bde/c_bde.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect/fve/bde/eow.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect/fve/bde/keys.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect/fve/crypto/__init__.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect/fve/crypto/_pycryptodome.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect/fve/crypto/base.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect/fve/crypto/elephant.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect/fve/crypto/utils.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect/fve/exceptions.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect/fve/luks/__init__.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect/fve/luks/af.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect/fve/luks/c_luks.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect/fve/luks/luks.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect/fve/luks/metadata.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect/fve/tools/__init__.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect/fve/tools/dd.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect.fve.egg-info/SOURCES.txt +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect.fve.egg-info/dependency_links.txt +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect.fve.egg-info/entry_points.txt +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/dissect.fve.egg-info/top_level.txt +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/setup.cfg +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/__init__.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/bde/aes-xts_128.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/bde/aes-xts_256.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/bde/aes_128.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/bde/aes_128_diffuser.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/bde/aes_256.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/bde/aes_256_diffuser.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/bde/decrypted.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/bde/eow_partial.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/bde/recovery_key.bek +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/bde/recovery_key.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/bde/recovery_password.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/bde/startup_key.bek +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/bde/startup_key.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/bde/suspended.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/bde/vista.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/bde/win7_partial.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/luks1/aes-ecb.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/luks1/sha1.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/luks2/aes-cbc-essiv.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/luks2/aes-cbc-plain.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/luks2/aes-ecb-pbkdf2.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/luks2/aes-ecb.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/luks2/aes-xts-plain64.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_data/luks2/multiple-slots.bin.gz +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_docs/Makefile +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_docs/conf.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_docs/index.rst +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/_utils.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/conftest.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/test_bde_eow_bitmap.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/test_crypto.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/test_luks.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/test_luks_kdf.py +0 -0
- {dissect_fve-4.1.dev2 → dissect_fve-4.2.dev2}/tests/test_luks_metadata.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: dissect.fve
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.2.dev2
|
|
4
4
|
Summary: A Dissect module implementing a parsers for full volume encryption implementations, currently Linux Unified Key Setup (LUKS1 and LUKS2) and Microsoft's Bitlocker Disk Encryption
|
|
5
5
|
Author-email: Dissect Team <dissect@fox-it.com>
|
|
6
6
|
License: Affero General Public License v3
|
|
@@ -24,7 +24,7 @@ License-File: LICENSE
|
|
|
24
24
|
License-File: COPYRIGHT
|
|
25
25
|
Requires-Dist: dissect.cstruct<5,>=4
|
|
26
26
|
Requires-Dist: dissect.util<4,>=3
|
|
27
|
-
Requires-Dist: pycryptodome
|
|
27
|
+
Requires-Dist: pycryptodome==3.22.0
|
|
28
28
|
Requires-Dist: argon2-cffi
|
|
29
29
|
Provides-Extra: full
|
|
30
30
|
Requires-Dist: dissect.target; extra == "full"
|
|
@@ -32,6 +32,7 @@ Requires-Dist: rich; extra == "full"
|
|
|
32
32
|
Provides-Extra: dev
|
|
33
33
|
Requires-Dist: dissect.cstruct<5.0.dev,>=4.0.dev; extra == "dev"
|
|
34
34
|
Requires-Dist: dissect.util<4.0.dev,>=3.0.dev; extra == "dev"
|
|
35
|
+
Dynamic: license-file
|
|
35
36
|
|
|
36
37
|
# dissect.fve
|
|
37
38
|
|
|
@@ -79,6 +79,8 @@ class BDE:
|
|
|
79
79
|
if self._valid_eow_information:
|
|
80
80
|
self.eow_information = self._valid_eow_information[0]
|
|
81
81
|
|
|
82
|
+
self._fvek_datum = None
|
|
83
|
+
self._fvek_type = None
|
|
82
84
|
self._fvek = None
|
|
83
85
|
|
|
84
86
|
@property
|
|
@@ -137,7 +139,7 @@ class BDE:
|
|
|
137
139
|
"""Return whether this volume can be unlocked with a BEK file."""
|
|
138
140
|
return len(list(self.information.dataset.find_external_vmk())) != 0
|
|
139
141
|
|
|
140
|
-
def unlock(self, key: bytes) ->
|
|
142
|
+
def unlock(self, key: bytes) -> BDE:
|
|
141
143
|
"""Unlock this volume with the specified encryption key."""
|
|
142
144
|
self.information.check_integrity(key)
|
|
143
145
|
|
|
@@ -149,27 +151,31 @@ class BDE:
|
|
|
149
151
|
if not isinstance(fvek, KeyDatum):
|
|
150
152
|
raise TypeError("Invalid unboxed FVEK")
|
|
151
153
|
|
|
152
|
-
self.
|
|
154
|
+
self._fvek_datum = fvek
|
|
155
|
+
self._fvek_type = fvek.key_type
|
|
156
|
+
self._fvek = fvek.data
|
|
153
157
|
|
|
154
|
-
|
|
158
|
+
return self
|
|
159
|
+
|
|
160
|
+
def unlock_with_clear_key(self) -> BDE:
|
|
155
161
|
"""Unlock this volume with the clear/obfuscated key."""
|
|
156
162
|
vmk = self.information.dataset.find_clear_vmk()
|
|
157
163
|
if not vmk:
|
|
158
164
|
raise ValueError("No clear VMK found")
|
|
159
165
|
|
|
160
|
-
self.unlock(vmk.decrypt(vmk.clear_key()))
|
|
166
|
+
return self.unlock(vmk.decrypt(vmk.clear_key()))
|
|
161
167
|
|
|
162
|
-
def unlock_with_recovery_password(self, recovery_password: str, identifier: UUID | str | None = None) ->
|
|
168
|
+
def unlock_with_recovery_password(self, recovery_password: str, identifier: UUID | str | None = None) -> BDE:
|
|
163
169
|
"""Unlock this volume with the recovery password."""
|
|
164
170
|
recovery_key = derive_recovery_key(recovery_password)
|
|
165
|
-
self._unlock_with_user_key(self.information.dataset.find_recovery_vmk(), recovery_key, identifier)
|
|
171
|
+
return self._unlock_with_user_key(self.information.dataset.find_recovery_vmk(), recovery_key, identifier)
|
|
166
172
|
|
|
167
|
-
def unlock_with_passphrase(self, passphrase: str, identifier: UUID | str | None = None) ->
|
|
173
|
+
def unlock_with_passphrase(self, passphrase: str, identifier: UUID | str | None = None) -> BDE:
|
|
168
174
|
"""Unlock this volume with the user passphrase."""
|
|
169
175
|
user_key = derive_user_key(passphrase)
|
|
170
|
-
self._unlock_with_user_key(self.information.dataset.find_passphrase_vmk(), user_key, identifier)
|
|
176
|
+
return self._unlock_with_user_key(self.information.dataset.find_passphrase_vmk(), user_key, identifier)
|
|
171
177
|
|
|
172
|
-
def unlock_with_bek(self, bek_fh: BinaryIO) ->
|
|
178
|
+
def unlock_with_bek(self, bek_fh: BinaryIO) -> BDE:
|
|
173
179
|
"""Unlock this volume with a BEK file."""
|
|
174
180
|
bek_ds = Dataset(bek_fh)
|
|
175
181
|
startup_key = bek_ds.find_startup_key()
|
|
@@ -183,11 +189,17 @@ class BDE:
|
|
|
183
189
|
raise ValueError("No compatible VMK found")
|
|
184
190
|
|
|
185
191
|
decrypted_key = vmk.decrypt(startup_key.external_key())
|
|
186
|
-
self.unlock(decrypted_key)
|
|
192
|
+
return self.unlock(decrypted_key)
|
|
193
|
+
|
|
194
|
+
def unlock_with_fvek(self, key: bytes) -> BDE:
|
|
195
|
+
"""Unlock this volume with a raw FVEK key."""
|
|
196
|
+
self._fvek_type = self.information.dataset.fvek_type
|
|
197
|
+
self._fvek = key
|
|
198
|
+
return self
|
|
187
199
|
|
|
188
200
|
def _unlock_with_user_key(
|
|
189
201
|
self, vmks: list[VmkInfoDatum], user_key: bytes, identifier: UUID | str | None = None
|
|
190
|
-
) ->
|
|
202
|
+
) -> BDE:
|
|
191
203
|
decrypted_key = None
|
|
192
204
|
for vmk in vmks:
|
|
193
205
|
if identifier and str(identifier) != str(vmk.identifier):
|
|
@@ -207,7 +219,7 @@ class BDE:
|
|
|
207
219
|
else:
|
|
208
220
|
raise ValueError("No compatible VMK found")
|
|
209
221
|
|
|
210
|
-
self.unlock(decrypted_key)
|
|
222
|
+
return self.unlock(decrypted_key)
|
|
211
223
|
|
|
212
224
|
def open(self) -> BitlockerStream:
|
|
213
225
|
"""Open this volume and return a readable (decrypted) stream."""
|
|
@@ -340,8 +352,8 @@ class BitlockerStream(AlignedStream):
|
|
|
340
352
|
if self.bde.encrypted:
|
|
341
353
|
self.encrypted = True
|
|
342
354
|
self.cipher = create_cipher(
|
|
343
|
-
CIPHER_MAP[bde.
|
|
344
|
-
bde._fvek
|
|
355
|
+
CIPHER_MAP[bde._fvek_type],
|
|
356
|
+
bde._fvek,
|
|
345
357
|
sector_size=self.sector_size,
|
|
346
358
|
iv_sector_size=self.sector_size,
|
|
347
359
|
)
|
|
@@ -314,32 +314,7 @@ class Datum:
|
|
|
314
314
|
header = c_bde.FVE_DATUM(fh)
|
|
315
315
|
fh.seek(offset)
|
|
316
316
|
|
|
317
|
-
|
|
318
|
-
FVE_DATUM_TYPE.KEY: KeyDatum,
|
|
319
|
-
FVE_DATUM_TYPE.UNICODE: UnicodeDatum,
|
|
320
|
-
FVE_DATUM_TYPE.STRETCH_KEY: StretchKeyDatum,
|
|
321
|
-
FVE_DATUM_TYPE.USE_KEY: UseKeyDatum,
|
|
322
|
-
FVE_DATUM_TYPE.AES_CCM_ENCRYPTED_KEY: AesCcmEncryptedDatum,
|
|
323
|
-
FVE_DATUM_TYPE.TPM_ENCRYPTED_BLOB: TpmEncryptedBlobDatum,
|
|
324
|
-
FVE_DATUM_TYPE.VALIDATION_INFO: ValidationInfoDatum,
|
|
325
|
-
FVE_DATUM_TYPE.VOLUME_MASTER_KEY_INFO: VmkInfoDatum,
|
|
326
|
-
FVE_DATUM_TYPE.EXTERNAL_INFO: ExternalInfoDatum,
|
|
327
|
-
FVE_DATUM_TYPE.UPDATE: UpdateDatum,
|
|
328
|
-
FVE_DATUM_TYPE.ERROR_LOG: ErrorLogDatum,
|
|
329
|
-
FVE_DATUM_TYPE.ASYMMETRIC_ENCRYPTED_KEY: AsymmetricEncryptedDatum,
|
|
330
|
-
FVE_DATUM_TYPE.EXPORTED_KEY: ExportedPublicKeyDatum,
|
|
331
|
-
FVE_DATUM_TYPE.PUBLIC_KEY_INFO: PublicKeyInfoDatum,
|
|
332
|
-
FVE_DATUM_TYPE.VIRTUALIZATION_INFO: VirtualizationInfoDatum,
|
|
333
|
-
FVE_DATUM_TYPE.SIMPLE_1: SimpleDatum,
|
|
334
|
-
FVE_DATUM_TYPE.SIMPLE_2: SimpleDatum,
|
|
335
|
-
FVE_DATUM_TYPE.CONCAT_HASH_KEY: ConcatHashKeyDatum,
|
|
336
|
-
FVE_DATUM_TYPE.SIMPLE_3: SimpleDatum,
|
|
337
|
-
FVE_DATUM_TYPE.SIMPLE_LARGE: SimpleLargeDatum,
|
|
338
|
-
FVE_DATUM_TYPE.BACKUP_INFO: BackupInfoDatum,
|
|
339
|
-
}
|
|
340
|
-
datum_type = FVE_DATUM_TYPE(header.Type)
|
|
341
|
-
|
|
342
|
-
return datum_type_map.get(datum_type, Datum)(fh)
|
|
317
|
+
return DATUM_TYPE_MAP.get(FVE_DATUM_TYPE(header.Type), Datum)(fh)
|
|
343
318
|
|
|
344
319
|
@classmethod
|
|
345
320
|
def from_bytes(cls, buf: bytes) -> Datum:
|
|
@@ -750,3 +725,28 @@ class AesCbc256HmacSha512EncryptedDatum(Datum):
|
|
|
750
725
|
@property
|
|
751
726
|
def data(self) -> bytes:
|
|
752
727
|
return self._data[len(self.__struct__) :]
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
DATUM_TYPE_MAP = {
|
|
731
|
+
FVE_DATUM_TYPE.KEY: KeyDatum,
|
|
732
|
+
FVE_DATUM_TYPE.UNICODE: UnicodeDatum,
|
|
733
|
+
FVE_DATUM_TYPE.STRETCH_KEY: StretchKeyDatum,
|
|
734
|
+
FVE_DATUM_TYPE.USE_KEY: UseKeyDatum,
|
|
735
|
+
FVE_DATUM_TYPE.AES_CCM_ENCRYPTED_KEY: AesCcmEncryptedDatum,
|
|
736
|
+
FVE_DATUM_TYPE.TPM_ENCRYPTED_BLOB: TpmEncryptedBlobDatum,
|
|
737
|
+
FVE_DATUM_TYPE.VALIDATION_INFO: ValidationInfoDatum,
|
|
738
|
+
FVE_DATUM_TYPE.VOLUME_MASTER_KEY_INFO: VmkInfoDatum,
|
|
739
|
+
FVE_DATUM_TYPE.EXTERNAL_INFO: ExternalInfoDatum,
|
|
740
|
+
FVE_DATUM_TYPE.UPDATE: UpdateDatum,
|
|
741
|
+
FVE_DATUM_TYPE.ERROR_LOG: ErrorLogDatum,
|
|
742
|
+
FVE_DATUM_TYPE.ASYMMETRIC_ENCRYPTED_KEY: AsymmetricEncryptedDatum,
|
|
743
|
+
FVE_DATUM_TYPE.EXPORTED_KEY: ExportedPublicKeyDatum,
|
|
744
|
+
FVE_DATUM_TYPE.PUBLIC_KEY_INFO: PublicKeyInfoDatum,
|
|
745
|
+
FVE_DATUM_TYPE.VIRTUALIZATION_INFO: VirtualizationInfoDatum,
|
|
746
|
+
FVE_DATUM_TYPE.SIMPLE_1: SimpleDatum,
|
|
747
|
+
FVE_DATUM_TYPE.SIMPLE_2: SimpleDatum,
|
|
748
|
+
FVE_DATUM_TYPE.CONCAT_HASH_KEY: ConcatHashKeyDatum,
|
|
749
|
+
FVE_DATUM_TYPE.SIMPLE_3: SimpleDatum,
|
|
750
|
+
FVE_DATUM_TYPE.SIMPLE_LARGE: SimpleLargeDatum,
|
|
751
|
+
FVE_DATUM_TYPE.BACKUP_INFO: BackupInfoDatum,
|
|
752
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: dissect.fve
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.2.dev2
|
|
4
4
|
Summary: A Dissect module implementing a parsers for full volume encryption implementations, currently Linux Unified Key Setup (LUKS1 and LUKS2) and Microsoft's Bitlocker Disk Encryption
|
|
5
5
|
Author-email: Dissect Team <dissect@fox-it.com>
|
|
6
6
|
License: Affero General Public License v3
|
|
@@ -24,7 +24,7 @@ License-File: LICENSE
|
|
|
24
24
|
License-File: COPYRIGHT
|
|
25
25
|
Requires-Dist: dissect.cstruct<5,>=4
|
|
26
26
|
Requires-Dist: dissect.util<4,>=3
|
|
27
|
-
Requires-Dist: pycryptodome
|
|
27
|
+
Requires-Dist: pycryptodome==3.22.0
|
|
28
28
|
Requires-Dist: argon2-cffi
|
|
29
29
|
Provides-Extra: full
|
|
30
30
|
Requires-Dist: dissect.target; extra == "full"
|
|
@@ -32,6 +32,7 @@ Requires-Dist: rich; extra == "full"
|
|
|
32
32
|
Provides-Extra: dev
|
|
33
33
|
Requires-Dist: dissect.cstruct<5.0.dev,>=4.0.dev; extra == "dev"
|
|
34
34
|
Requires-Dist: dissect.util<4.0.dev,>=3.0.dev; extra == "dev"
|
|
35
|
+
Dynamic: license-file
|
|
35
36
|
|
|
36
37
|
# dissect.fve
|
|
37
38
|
|
|
@@ -65,6 +65,20 @@ def _verify_bek_crypto(test_file: BinaryIO, bek_file: BinaryIO, fvek_type: c_bde
|
|
|
65
65
|
_verify_crypto_stream(bde_obj)
|
|
66
66
|
|
|
67
67
|
|
|
68
|
+
def _verify_raw_key_crypto(test_file: BinaryIO, raw_key: bytes, fvek_type: c_bde.FVE_KEY_TYPE) -> None:
|
|
69
|
+
bde_obj = bde.BDE(test_file)
|
|
70
|
+
|
|
71
|
+
assert bde_obj.encrypted
|
|
72
|
+
assert bde_obj.information.current_state == bde_obj.information.next_state == c_bde.FVE_STATE.ENCRYPTED
|
|
73
|
+
assert bde_obj.information.dataset.fvek_type == fvek_type
|
|
74
|
+
assert not bde_obj.unlocked
|
|
75
|
+
|
|
76
|
+
bde_obj.unlock_with_fvek(raw_key)
|
|
77
|
+
assert bde_obj.unlocked
|
|
78
|
+
|
|
79
|
+
_verify_crypto_stream(bde_obj)
|
|
80
|
+
|
|
81
|
+
|
|
68
82
|
def test_bde_basic(bde_aes_128: BinaryIO) -> None:
|
|
69
83
|
bde_obj = bde.BDE(bde_aes_128)
|
|
70
84
|
|
|
@@ -157,6 +171,46 @@ def test_bde_bek(test_file: str, bek_file: str, key_type: c_bde.FVE_KEY_TYPE) ->
|
|
|
157
171
|
_verify_bek_crypto(fh, bek_fh, key_type)
|
|
158
172
|
|
|
159
173
|
|
|
174
|
+
@pytest.mark.parametrize(
|
|
175
|
+
("test_file", "raw_key", "key_type"),
|
|
176
|
+
[
|
|
177
|
+
(
|
|
178
|
+
"_data/bde/aes_128.bin.gz",
|
|
179
|
+
"84c3a3157e5f21dee140005220bc940e",
|
|
180
|
+
c_bde.FVE_KEY_TYPE.AES_128,
|
|
181
|
+
),
|
|
182
|
+
(
|
|
183
|
+
"_data/bde/aes_256.bin.gz",
|
|
184
|
+
"dd3885ef9948c8dc6ad1b54a6c4a4b6fb74b44d1d9775ac7ed186c35f1b59022",
|
|
185
|
+
c_bde.FVE_KEY_TYPE.AES_256,
|
|
186
|
+
),
|
|
187
|
+
(
|
|
188
|
+
"_data/bde/aes_128_diffuser.bin.gz",
|
|
189
|
+
"10730f695df62a49cd3aa1b1c9ae3edf2229c338a3740830e2b19d2b83f9cada268af0e0613921085edc89e1b804de354fd265acf4e5c410b47764bb9565666b",
|
|
190
|
+
c_bde.FVE_KEY_TYPE.AES_128_DIFFUSER,
|
|
191
|
+
),
|
|
192
|
+
(
|
|
193
|
+
"_data/bde/aes_256_diffuser.bin.gz",
|
|
194
|
+
"3a600625f8fd5cc506cf8b30c8ca0600cc32f0c6b54c140789f7518c4fb5c71ba272f34f1a920d5be247298b5d233ce6199023c24d0aefec28717232f9894d1f",
|
|
195
|
+
c_bde.FVE_KEY_TYPE.AES_256_DIFFUSER,
|
|
196
|
+
),
|
|
197
|
+
(
|
|
198
|
+
"_data/bde/aes-xts_128.bin.gz",
|
|
199
|
+
"4eb949c473f0edfc379ad041670ddb9c4da0abdb4482a2c8bb47250493aa1ed5",
|
|
200
|
+
c_bde.FVE_KEY_TYPE.AES_XTS_128,
|
|
201
|
+
),
|
|
202
|
+
(
|
|
203
|
+
"_data/bde/aes-xts_256.bin.gz",
|
|
204
|
+
"c74002df41f5eadeee2549fc009233a2a510726ce08736aba2f84a52ac6e7bbc56b8a824a4dc26cf9c4c2926386319d17427998e045ebfdc789e328e0dc97da4",
|
|
205
|
+
c_bde.FVE_KEY_TYPE.AES_XTS_256,
|
|
206
|
+
),
|
|
207
|
+
],
|
|
208
|
+
)
|
|
209
|
+
def test_bde_raw_key(test_file: str, raw_key: str, key_type: c_bde.FVE_KEY_TYPE) -> None:
|
|
210
|
+
with contextlib.contextmanager(open_file_gz)(test_file) as fh:
|
|
211
|
+
_verify_raw_key_crypto(fh, bytes.fromhex(raw_key), key_type)
|
|
212
|
+
|
|
213
|
+
|
|
160
214
|
def test_bde_vista(bde_vista: BinaryIO) -> None:
|
|
161
215
|
bde_obj = bde.BDE(bde_vista)
|
|
162
216
|
|
|
@@ -35,6 +35,7 @@ deps =
|
|
|
35
35
|
ruff==0.9.2
|
|
36
36
|
commands =
|
|
37
37
|
ruff format dissect tests
|
|
38
|
+
ruff check --fix dissect tests
|
|
38
39
|
|
|
39
40
|
[testenv:lint]
|
|
40
41
|
package = skip
|
|
@@ -55,12 +56,12 @@ deps =
|
|
|
55
56
|
sphinx-design
|
|
56
57
|
furo
|
|
57
58
|
commands =
|
|
58
|
-
make -C tests/
|
|
59
|
-
make -C tests/
|
|
59
|
+
make -C tests/_docs clean
|
|
60
|
+
make -C tests/_docs html
|
|
60
61
|
|
|
61
62
|
[testenv:docs-linkcheck]
|
|
62
63
|
allowlist_externals = make
|
|
63
64
|
deps = {[testenv:docs-build]deps}
|
|
64
65
|
commands =
|
|
65
|
-
make -C tests/
|
|
66
|
-
make -C tests/
|
|
66
|
+
make -C tests/_docs clean
|
|
67
|
+
make -C tests/_docs linkcheck
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|