Skip to content

Commit

Permalink
add fields for protocol version 6
Browse files Browse the repository at this point in the history
  • Loading branch information
thestinger committed Oct 1, 2024
1 parent 65db5d8 commit a3589d9
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions app/src/main/java/app/attestation/auditor/AttestationProtocol.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,18 @@ class AttestationProtocol {
// byte[] compressedChain { [short encodedCertificateLength, byte[] encodedCertificate] }
// byte[] fingerprint (length: FINGERPRINT_LENGTH)
// int osEnforcedFlags
// short autoRebootMinutes (-1 for unknown)
// byte portSecurityMode (-1 for unknown)
// byte userCount (-1 for unknown)
// }
// byte[] signature (rest of message)
//
// Protocol version changes:
//
// 6: autoRebootMinutes added
// 6: portSecurityMode added
// 6: userCount added
//
// n/a
//
// For each audit, the Auditee generates a fresh hardware-backed key with key attestation
Expand Down Expand Up @@ -1223,6 +1230,12 @@ static VerificationResult verifySerialized(final Context context, final byte[] a
throw new GeneralSecurityException("invalid device administrator state");
}

if (version >= 6) {
short autoRebootMinutes = deserializer.getShort();
byte portSecurityMode = deserializer.get();
byte userCount = deserializer.get();
}

final int signatureLength = deserializer.remaining();
final byte[] signature = new byte[signatureLength];
deserializer.get(signature);
Expand Down Expand Up @@ -1486,6 +1499,17 @@ static AttestationResult generateSerialized(final Context context, final byte[]
}
serializer.putInt(osEnforcedFlags);

if (version >= 6) {
short autoRebootMinutes = 0;
serializer.putShort(autoRebootMinutes);

byte portSecurityMode = 0;
serializer.put(portSecurityMode);

byte userCount = 0;
serializer.put(userCount);
}

final ByteBuffer message = serializer.duplicate();
message.flip();

Expand Down

0 comments on commit a3589d9

Please sign in to comment.