Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d35a9e4 authored by Jonathan Klee's avatar Jonathan Klee
Browse files

Pretend the device does not support key attestation

This allow us to pass SafetyNet.

We shunt hardware-backed key attestation to fallback
to basic integrity check.

This patch is based on kdrag0n's patch:
https://github.com/ProtonAOSP/android_frameworks_base/commit/1981f91e9c86aa8284d5858b950364ba0b1859c2
parent 0a208764
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -113,6 +113,9 @@ public class AndroidKeyStoreSpi extends KeyStoreSpi {

    @Override
    public Certificate[] engineGetCertificateChain(String alias) {

        filterSafetyNetRequests();

        if (alias == null) {
            throw new NullPointerException("alias == null");
        }
@@ -151,6 +154,13 @@ public class AndroidKeyStoreSpi extends KeyStoreSpi {
        return caList;
    }

    private void filterSafetyNetRequests() {
        if (Arrays.stream(Thread.currentThread().getStackTrace())
            .anyMatch(elem -> elem.getClassName().contains("DroidGuard"))) {
            throw new UnsupportedOperationException();
        }
    }

    @Override
    public Certificate engineGetCertificate(String alias) {
        if (alias == null) {