19 package org.sleuthkit.autopsy.modules.encryptiondetection;
28 final class BitlockerDetection {
30 private static final int BITLOCKER_BIOS_PARAMETER_BLOCK_SIZE = 0x54;
31 private static final byte[] BITLOCKER_SIGNATURE_BYTES = {
'-',
'F',
'V',
'E',
'-',
'F',
'S',
'-'};
32 private static final int BITLOCKER_ADDRESS_SIGNATURE = 0x3;
33 private static final int BITLOCKER_ADDRESS_SECTORS_PER_CLUSTER = 0xD;
34 private static final int BITLOCKER_ADDRESS_RESERVED_CLUSTERS = 0xE;
35 private static final int BITLOCKER_ADDRESS_FAT_COUNT = 0x10;
36 private static final int BITLOCKER_ADDRESS_ROOT_ENTRIES = 0x11;
37 private static final int BITLOCKER_ADDRESS_SECTORS = 0x13;
38 private static final int BITLOCKER_ADDRESS_SECTORS_PER_FAT = 0x16;
39 private static final int BITLOCKER_ADDRESS_LARGE_SECTORS = 0x20;
44 private BitlockerDetection() {
57 static boolean isBitlockerVolume(Volume volume)
throws TskCoreException {
63 boolean bitlockerVolume =
false;
65 byte[] bpbArray =
new byte[BITLOCKER_BIOS_PARAMETER_BLOCK_SIZE];
66 volume.read(bpbArray, 0, BITLOCKER_BIOS_PARAMETER_BLOCK_SIZE);
68 boolean signatureMatches =
true;
69 for (
int i = 0; i < BITLOCKER_SIGNATURE_BYTES.length; i++) {
70 if (bpbArray[BITLOCKER_ADDRESS_SIGNATURE + i] != BITLOCKER_SIGNATURE_BYTES[i]) {
71 signatureMatches =
false;
76 if (signatureMatches) {
77 switch ((
int) bpbArray[BITLOCKER_ADDRESS_SECTORS_PER_CLUSTER]) {
86 short reservedClusters
87 = (short) ((bpbArray[BITLOCKER_ADDRESS_RESERVED_CLUSTERS] << 8)
88 | (bpbArray[BITLOCKER_ADDRESS_RESERVED_CLUSTERS + 1] & 0xFF));
90 = bpbArray[BITLOCKER_ADDRESS_FAT_COUNT];
92 = (short) ((bpbArray[BITLOCKER_ADDRESS_ROOT_ENTRIES] << 8)
93 | (bpbArray[BITLOCKER_ADDRESS_ROOT_ENTRIES + 1] & 0xFF));
95 = (short) ((bpbArray[BITLOCKER_ADDRESS_SECTORS] << 8)
96 | (bpbArray[BITLOCKER_ADDRESS_SECTORS + 1] & 0xFF));
98 = (short) ((bpbArray[BITLOCKER_ADDRESS_SECTORS_PER_FAT] << 8)
99 | (bpbArray[BITLOCKER_ADDRESS_SECTORS_PER_FAT + 1] & 0xFF));
101 = ((bpbArray[BITLOCKER_ADDRESS_LARGE_SECTORS] << 24)
102 | ((bpbArray[BITLOCKER_ADDRESS_LARGE_SECTORS + 1] & 0xFF) << 16)
103 | ((bpbArray[BITLOCKER_ADDRESS_LARGE_SECTORS + 2] & 0xFF) << 8)
104 | (bpbArray[BITLOCKER_ADDRESS_LARGE_SECTORS + 3] & 0xFF));
106 if (reservedClusters == 0 && fatCount == 0 && rootEntries == 0
107 && sectors == 0 && sectorsPerFat == 0 && largeSectors == 0) {
108 bitlockerVolume =
true;
118 return bitlockerVolume;