Skip to content

Commit 24a7bbd

Browse files
committed
Add support for tpm attestation
1 parent 82bea3f commit 24a7bbd

File tree

5 files changed

+804
-51
lines changed

5 files changed

+804
-51
lines changed

webauthn-server-core/src/main/java/com/yubico/webauthn/Crypto.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,18 @@ public static boolean verifySignature(
9696

9797
public static ByteArray sha256(ByteArray bytes) {
9898
//noinspection UnstableApiUsage
99+
// TODO remove noinspection
99100
return new ByteArray(Hashing.sha256().hashBytes(bytes.getBytes()).asBytes());
100101
}
101102

103+
public static ByteArray sha384(ByteArray bytes) {
104+
return new ByteArray(Hashing.sha384().hashBytes(bytes.getBytes()).asBytes());
105+
}
106+
107+
public static ByteArray sha512(ByteArray bytes) {
108+
return new ByteArray(Hashing.sha512().hashBytes(bytes.getBytes()).asBytes());
109+
}
110+
102111
public static ByteArray sha256(String str) {
103112
return sha256(new ByteArray(str.getBytes(StandardCharsets.UTF_8)));
104113
}

webauthn-server-core/src/main/java/com/yubico/webauthn/FinishRegistrationSteps.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,8 @@ public Optional<AttestationStatementVerifier> attestationStatementVerifier() {
373373
return Optional.of(new AndroidSafetynetAttestationStatementVerifier());
374374
case "apple":
375375
return Optional.of(new AppleAttestationStatementVerifier());
376+
case "tpm":
377+
return Optional.of(new TpmAttestationStatementVerifier());
376378
default:
377379
return Optional.empty();
378380
}
@@ -411,9 +413,6 @@ public AttestationType attestationType() {
411413
case "android-key":
412414
// TODO delete this once android-key attestation verification is implemented
413415
return AttestationType.BASIC;
414-
case "tpm":
415-
// TODO delete this once tpm attestation verification is implemented
416-
return AttestationType.ATTESTATION_CA;
417416
default:
418417
return AttestationType.UNKNOWN;
419418
}

0 commit comments

Comments
 (0)