Skip to content

Commit 7560738

Browse files
author
Elis Elliott
committed
Add DEVICE_UNIQUE_ATTESTION tag & parse its value.
Make TestDPC aware of the DEVICE_UNIQUE_ATTESTATION tag and parse its value for use in the dialog produced after the attestation record is parsed. Bug: 159706341 Change-Id: I2e7489a8f698ff38ae21a1897699962d7f2ea4de
1 parent 0f2af88 commit 7560738

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

app/src/main/java/com/afwsamples/testdpc/policy/keymanagement/GenerateKeyAndCertificateTask.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ private void showKeyGenerationResult(AttestedKeyPair keyPair) {
204204
attestationDetails.append(
205205
mActivity.getText(R.string.device_meid_description) + "\n");
206206
attestationDetails.append(teeList.getMeid() + "\n");
207+
attestationDetails.append(
208+
"Individual Attestation:" + "\n");
209+
attestationDetails.append(teeList.isIndividualAttestation() + "\n");
207210
}
208211

209212
Certificate root = attestationChain.get(attestationChain.size() - 1);

app/src/main/java/com/afwsamples/testdpc/policy/utils/AuthorizationList.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ public class AuthorizationList {
131131
private static final int KM_TAG_ATTESTATION_ID_MODEL = KM_BYTES | 717;
132132
private static final int KM_TAG_VENDOR_PATCHLEVEL = KM_UINT | 718;
133133
private static final int KM_TAG_BOOT_PATCHLEVEL = KM_UINT | 719;
134+
private static final int KM_TAG_DEVICE_UNIQUE_ATTESTATION = KM_BOOL | 720;
134135

135136
// Map for converting padding values to strings
136137
private static final ImmutableMap<Integer, String> paddingMap = ImmutableMap
@@ -198,6 +199,7 @@ public class AuthorizationList {
198199
private String model;
199200
private boolean userPresenceRequired;
200201
private boolean confirmationRequired;
202+
private boolean individualAttestation;
201203

202204
@RequiresApi(api = VERSION_CODES.N)
203205
public AuthorizationList(ASN1Encodable sequence) throws CertificateParsingException {
@@ -323,6 +325,9 @@ public AuthorizationList(ASN1Encodable sequence) throws CertificateParsingExcept
323325
case KM_TAG_TRUSTED_CONFIRMATION_REQUIRED & KEYMASTER_TAG_TYPE_MASK:
324326
confirmationRequired = true;
325327
break;
328+
case KM_TAG_DEVICE_UNIQUE_ATTESTATION & KEYMASTER_TAG_TYPE_MASK:
329+
individualAttestation = true;
330+
break;
326331
}
327332
}
328333

@@ -600,6 +605,10 @@ public boolean isConfirmationRequired() {
600605
return confirmationRequired;
601606
}
602607

608+
public boolean isIndividualAttestation() {
609+
return individualAttestation;
610+
}
611+
603612
private String getStringFromAsn1Value(ASN1Primitive value) throws CertificateParsingException {
604613
try {
605614
return Asn1Utils.getStringFromAsn1OctetStreamAssumingUTF8(value);
@@ -709,6 +718,10 @@ public String toString() {
709718
s.append("\nConfirmation required");
710719
}
711720

721+
if (individualAttestation) {
722+
s.append("\nIndividual attestation");
723+
}
724+
712725
if (brand != null) {
713726
s.append("\nBrand: ").append(brand);
714727
}

0 commit comments

Comments
 (0)