Skip to content

Commit d77d9c3

Browse files
committed
add generic biometrics support (face, iris, etc.)
1 parent b876976 commit d77d9c3

4 files changed

Lines changed: 16 additions & 12 deletions

File tree

src/main/java/app/attestation/server/AttestationProtocol.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class AttestationProtocol {
144144
private static final int OS_ENFORCED_FLAGS_DEVICE_ADMIN = 1 << 2;
145145
private static final int OS_ENFORCED_FLAGS_ADB_ENABLED = 1 << 3;
146146
private static final int OS_ENFORCED_FLAGS_ADD_USERS_WHEN_LOCKED = 1 << 4;
147-
private static final int OS_ENFORCED_FLAGS_ENROLLED_FINGERPRINTS = 1 << 5;
147+
private static final int OS_ENFORCED_FLAGS_ENROLLED_BIOMETRICS = 1 << 5;
148148
private static final int OS_ENFORCED_FLAGS_DENY_NEW_USB = 1 << 6;
149149
private static final int OS_ENFORCED_FLAGS_DEVICE_ADMIN_NON_SYSTEM = 1 << 7;
150150
private static final int OS_ENFORCED_FLAGS_OEM_UNLOCK_ALLOWED = 1 << 8;
@@ -155,7 +155,7 @@ class AttestationProtocol {
155155
OS_ENFORCED_FLAGS_DEVICE_ADMIN |
156156
OS_ENFORCED_FLAGS_ADB_ENABLED |
157157
OS_ENFORCED_FLAGS_ADD_USERS_WHEN_LOCKED |
158-
OS_ENFORCED_FLAGS_ENROLLED_FINGERPRINTS |
158+
OS_ENFORCED_FLAGS_ENROLLED_BIOMETRICS |
159159
OS_ENFORCED_FLAGS_DENY_NEW_USB |
160160
OS_ENFORCED_FLAGS_DEVICE_ADMIN_NON_SYSTEM |
161161
OS_ENFORCED_FLAGS_OEM_UNLOCK_ALLOWED |
@@ -985,7 +985,7 @@ private static void verify(final byte[] fingerprint,
985985
final Certificate[] attestationCertificates, final boolean userProfileSecure,
986986
final boolean accessibility, final boolean deviceAdmin,
987987
final boolean deviceAdminNonSystem, final boolean adbEnabled,
988-
final boolean addUsersWhenLocked, final boolean enrolledFingerprints,
988+
final boolean addUsersWhenLocked, final boolean enrolledBiometrics,
989989
final boolean denyNewUsb, final boolean oemUnlockAllowed, final boolean systemUser)
990990
throws GeneralSecurityException, IOException {
991991
final String fingerprintHex = BaseEncoding.base16().encode(fingerprint);
@@ -1117,7 +1117,7 @@ private static void verify(final byte[] fingerprint,
11171117
update.bind(7, verified.appVersion);
11181118
update.bind(8, verified.securityLevel); // new field
11191119
update.bind(9, userProfileSecure ? 1 : 0);
1120-
update.bind(10, enrolledFingerprints ? 1 : 0);
1120+
update.bind(10, enrolledBiometrics ? 1 : 0);
11211121
update.bind(11, accessibility ? 1 : 0);
11221122
update.bind(12, deviceAdmin ? (deviceAdminNonSystem ? 2 : 1) : 0);
11231123
update.bind(13, adbEnabled ? 1 : 0);
@@ -1160,7 +1160,7 @@ private static void verify(final byte[] fingerprint,
11601160
insert.bind(12, verified.appVersion);
11611161
insert.bind(13, verified.securityLevel);
11621162
insert.bind(14, userProfileSecure ? 1 : 0);
1163-
insert.bind(15, enrolledFingerprints ? 1 : 0);
1163+
insert.bind(15, enrolledBiometrics ? 1 : 0);
11641164
insert.bind(16, accessibility ? 1 : 0);
11651165
insert.bind(17, deviceAdmin ? (deviceAdminNonSystem ? 2 : 1) : 0);
11661166
insert.bind(18, adbEnabled ? 1 : 0);
@@ -1183,8 +1183,8 @@ private static void verify(final byte[] fingerprint,
11831183
osEnforced.append(String.format("Auditor app version: %s\n", verified.appVersion));
11841184
osEnforced.append(String.format("User profile secure: %s\n",
11851185
toYesNoString(userProfileSecure)));
1186-
osEnforced.append(String.format("Enrolled fingerprints: %s\n",
1187-
toYesNoString(enrolledFingerprints)));
1186+
osEnforced.append(String.format(verified.appVersion < 26 ? "Enrolled fingerprints: %s\n" : "Enrolled biometrics: %s\n",
1187+
toYesNoString(enrolledBiometrics)));
11881188
osEnforced.append(String.format("Accessibility service(s) enabled: %s\n",
11891189
toYesNoString(accessibility)));
11901190

@@ -1280,7 +1280,7 @@ static void verifySerialized(final byte[] attestationResult,
12801280
final boolean deviceAdminNonSystem = (osEnforcedFlags & OS_ENFORCED_FLAGS_DEVICE_ADMIN_NON_SYSTEM) != 0;
12811281
final boolean adbEnabled = (osEnforcedFlags & OS_ENFORCED_FLAGS_ADB_ENABLED) != 0;
12821282
final boolean addUsersWhenLocked = (osEnforcedFlags & OS_ENFORCED_FLAGS_ADD_USERS_WHEN_LOCKED) != 0;
1283-
final boolean enrolledFingerprints = (osEnforcedFlags & OS_ENFORCED_FLAGS_ENROLLED_FINGERPRINTS) != 0;
1283+
final boolean enrolledBiometrics = (osEnforcedFlags & OS_ENFORCED_FLAGS_ENROLLED_BIOMETRICS) != 0;
12841284
final boolean denyNewUsb = (osEnforcedFlags & OS_ENFORCED_FLAGS_DENY_NEW_USB) != 0;
12851285
final boolean oemUnlockAllowed = (osEnforcedFlags & OS_ENFORCED_FLAGS_OEM_UNLOCK_ALLOWED) != 0;
12861286
final boolean systemUser = (osEnforcedFlags & OS_ENFORCED_FLAGS_SYSTEM_USER) != 0;
@@ -1298,7 +1298,7 @@ static void verifySerialized(final byte[] attestationResult,
12981298

12991299
verify(fingerprint, pendingChallenges, userId, paired, deserializer.asReadOnlyBuffer(), signature,
13001300
certificates, userProfileSecure, accessibility, deviceAdmin, deviceAdminNonSystem,
1301-
adbEnabled, addUsersWhenLocked, enrolledFingerprints, denyNewUsb, oemUnlockAllowed,
1301+
adbEnabled, addUsersWhenLocked, enrolledBiometrics, denyNewUsb, oemUnlockAllowed,
13021302
systemUser);
13031303
}
13041304
}

src/main/java/app/attestation/server/AttestationServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@ private static void writeDevicesJson(final HttpExchange exchange, final long use
11051105
device.add("pinnedAppVersion", select.columnInt(11));
11061106
device.add("pinnedSecurityLevel", pinnedSecurityLevel);
11071107
device.add("userProfileSecure", select.columnInt(13));
1108-
device.add("enrolledFingerprints", select.columnInt(14));
1108+
device.add("enrolledBiometrics", select.columnInt(14));
11091109
device.add("accessibility", select.columnInt(15));
11101110
device.add("deviceAdmin", select.columnInt(16));
11111111
device.add("adbEnabled", select.columnInt(17));

static/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<link rel="manifest" href="/manifest.webmanifest"/>
2727
<link rel="canonical" href="https://attestation.app/"/>
2828
<link rel="license" href="/LICENSE.txt"/>
29-
<script type="module" src="/monitoring.js?27"></script>
29+
<script type="module" src="/monitoring.js?28"></script>
3030
</head>
3131
<body>
3232
<header>

static/monitoring.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,11 @@ function fetchDevices() {
238238
info.appendChild(create("h3", "Information provided by the verified OS:"));
239239
appendLine(info, "Auditor app version: " + device.pinnedAppVersion);
240240
appendLine(info, "User profile secure: " + toYesNoString(device.userProfileSecure));
241-
appendLine(info, "Enrolled fingerprints: " + toYesNoString(device.enrolledFingerprints));
241+
if (device.pinnedAppVersion < 26) {
242+
appendLine(info, "Enrolled fingerprints: " + toYesNoString(device.enrolledBiometrics));
243+
} else {
244+
appendLine(info, "Enrolled biometrics: " + toYesNoString(device.enrolledBiometrics));
245+
}
242246
appendLine(info, "Accessibility service(s) enabled: " + toYesNoString(device.accessibility));
243247
appendLine(info, "Device administrator(s) enabled: " + deviceAdminStrings.get(device.deviceAdmin));
244248
appendLine(info, "Android Debug Bridge enabled: " + toYesNoString(device.adbEnabled));

0 commit comments

Comments
 (0)