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

Commit 508469a1 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix subject in self-signed certificates." am: a27ce048 am: 19c771ec

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1619939

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I294f43561767efe4593407808f3da38df8480741
parents 9a0a35f9 19c771ec
Loading
Loading
Loading
Loading
+8 −2
Original line number Original line Diff line number Diff line
@@ -279,8 +279,10 @@ import javax.security.auth.x500.X500Principal;
 * }
 * }
 */
 */
public final class KeyGenParameterSpec implements AlgorithmParameterSpec, UserAuthArgs {
public final class KeyGenParameterSpec implements AlgorithmParameterSpec, UserAuthArgs {
    private static final X500Principal DEFAULT_CERT_SUBJECT =
    private static final X500Principal DEFAULT_ATTESTATION_CERT_SUBJECT =
            new X500Principal("CN=Android Keystore Key");
            new X500Principal("CN=Android Keystore Key");
    private static final X500Principal DEFAULT_SELF_SIGNED_CERT_SUBJECT =
            new X500Principal("CN=Fake");
    private static final BigInteger DEFAULT_CERT_SERIAL_NUMBER = new BigInteger("1");
    private static final BigInteger DEFAULT_CERT_SERIAL_NUMBER = new BigInteger("1");
    private static final Date DEFAULT_CERT_NOT_BEFORE = new Date(0L); // Jan 1 1970
    private static final Date DEFAULT_CERT_NOT_BEFORE = new Date(0L); // Jan 1 1970
    private static final Date DEFAULT_CERT_NOT_AFTER = new Date(2461449600000L); // Jan 1 2048
    private static final Date DEFAULT_CERT_NOT_AFTER = new Date(2461449600000L); // Jan 1 2048
@@ -366,7 +368,11 @@ public final class KeyGenParameterSpec implements AlgorithmParameterSpec, UserAu
        }
        }


        if (certificateSubject == null) {
        if (certificateSubject == null) {
            certificateSubject = DEFAULT_CERT_SUBJECT;
            if (attestationChallenge == null) {
                certificateSubject = DEFAULT_SELF_SIGNED_CERT_SUBJECT;
            } else {
                certificateSubject = DEFAULT_ATTESTATION_CERT_SUBJECT;
            }
        }
        }
        if (certificateNotBefore == null) {
        if (certificateNotBefore == null) {
            certificateNotBefore = DEFAULT_CERT_NOT_BEFORE;
            certificateNotBefore = DEFAULT_CERT_NOT_BEFORE;