Merge "Keystore 2.0 SPI: Add NAMESPACE_WIFI." am: 07f94fbb01 am: 7e0e17ab0d

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If3005ffbc84c4c6921c154d9ed1ebe2b8866652a
This commit is contained in:
Treehugger Robot
2021-02-06 05:39:52 +00:00
committed by Automerger Merge Worker
2 changed files with 20 additions and 0 deletions

View File

@@ -8435,6 +8435,11 @@ package android.security.keystore {
method @Deprecated @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setUid(int); method @Deprecated @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setUid(int);
} }
public abstract class KeyProperties {
field public static final int NAMESPACE_APPLICATION = -1; // 0xffffffff
field public static final int NAMESPACE_WIFI = 102; // 0x66
}
} }
package android.security.keystore.recovery { package android.security.keystore.recovery {

View File

@@ -20,6 +20,8 @@ import android.annotation.IntDef;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.annotation.StringDef; import android.annotation.StringDef;
import android.annotation.SystemApi;
import android.os.Process;
import android.security.KeyStore; import android.security.KeyStore;
import android.security.keymaster.KeymasterDefs; import android.security.keymaster.KeymasterDefs;
@@ -874,8 +876,17 @@ public abstract class KeyProperties {
* which it must be configured in SEPolicy. * which it must be configured in SEPolicy.
* @hide * @hide
*/ */
@SystemApi
public static final int NAMESPACE_APPLICATION = -1; public static final int NAMESPACE_APPLICATION = -1;
/**
* The namespace identifier for the WIFI Keystore namespace.
* This must be kept in sync with system/sepolicy/private/keystore2_key_contexts
* @hide
*/
@SystemApi
public static final int NAMESPACE_WIFI = 102;
/** /**
* For legacy support, translate namespaces into known UIDs. * For legacy support, translate namespaces into known UIDs.
* @hide * @hide
@@ -884,6 +895,8 @@ public abstract class KeyProperties {
switch (namespace) { switch (namespace) {
case NAMESPACE_APPLICATION: case NAMESPACE_APPLICATION:
return KeyStore.UID_SELF; return KeyStore.UID_SELF;
case NAMESPACE_WIFI:
return Process.WIFI_UID;
// TODO Translate WIFI and VPN UIDs once the namespaces are defined. // TODO Translate WIFI and VPN UIDs once the namespaces are defined.
// b/171305388 and b/171305607 // b/171305388 and b/171305607
default: default:
@@ -900,6 +913,8 @@ public abstract class KeyProperties {
switch (uid) { switch (uid) {
case KeyStore.UID_SELF: case KeyStore.UID_SELF:
return NAMESPACE_APPLICATION; return NAMESPACE_APPLICATION;
case Process.WIFI_UID:
return NAMESPACE_WIFI;
// TODO Translate WIFI and VPN UIDs once the namespaces are defined. // TODO Translate WIFI and VPN UIDs once the namespaces are defined.
// b/171305388 and b/171305607 // b/171305388 and b/171305607
default: default: