Merge "Add KeyChain.createManageCredentialsIntent"
This commit is contained in:
@@ -36030,6 +36030,7 @@ package android.security {
|
|||||||
method public static void choosePrivateKeyAlias(@NonNull android.app.Activity, @NonNull android.security.KeyChainAliasCallback, @Nullable String[], @Nullable java.security.Principal[], @Nullable String, int, @Nullable String);
|
method public static void choosePrivateKeyAlias(@NonNull android.app.Activity, @NonNull android.security.KeyChainAliasCallback, @Nullable String[], @Nullable java.security.Principal[], @Nullable String, int, @Nullable String);
|
||||||
method public static void choosePrivateKeyAlias(@NonNull android.app.Activity, @NonNull android.security.KeyChainAliasCallback, @Nullable String[], @Nullable java.security.Principal[], @Nullable android.net.Uri, @Nullable String);
|
method public static void choosePrivateKeyAlias(@NonNull android.app.Activity, @NonNull android.security.KeyChainAliasCallback, @Nullable String[], @Nullable java.security.Principal[], @Nullable android.net.Uri, @Nullable String);
|
||||||
method @NonNull public static android.content.Intent createInstallIntent();
|
method @NonNull public static android.content.Intent createInstallIntent();
|
||||||
|
method @NonNull public static android.content.Intent createManageCredentialsIntent(@NonNull android.security.AppUriAuthenticationPolicy);
|
||||||
method @Nullable @WorkerThread public static java.security.cert.X509Certificate[] getCertificateChain(@NonNull android.content.Context, @NonNull String) throws java.lang.InterruptedException, android.security.KeyChainException;
|
method @Nullable @WorkerThread public static java.security.cert.X509Certificate[] getCertificateChain(@NonNull android.content.Context, @NonNull String) throws java.lang.InterruptedException, android.security.KeyChainException;
|
||||||
method @Nullable @WorkerThread public static java.security.PrivateKey getPrivateKey(@NonNull android.content.Context, @NonNull String) throws java.lang.InterruptedException, android.security.KeyChainException;
|
method @Nullable @WorkerThread public static java.security.PrivateKey getPrivateKey(@NonNull android.content.Context, @NonNull String) throws java.lang.InterruptedException, android.security.KeyChainException;
|
||||||
method @Deprecated public static boolean isBoundKeyAlgorithm(@NonNull String);
|
method @Deprecated public static boolean isBoundKeyAlgorithm(@NonNull String);
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ public class Credentials {
|
|||||||
|
|
||||||
public static final String INSTALL_AS_USER_ACTION = "android.credentials.INSTALL_AS_USER";
|
public static final String INSTALL_AS_USER_ACTION = "android.credentials.INSTALL_AS_USER";
|
||||||
|
|
||||||
|
public static final String ACTION_MANAGE_CREDENTIALS = "android.security.MANAGE_CREDENTIALS";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Key prefix for CA certificates.
|
* Key prefix for CA certificates.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package android.security;
|
package android.security;
|
||||||
|
|
||||||
|
import static android.security.Credentials.ACTION_MANAGE_CREDENTIALS;
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.annotation.SdkConstant;
|
import android.annotation.SdkConstant;
|
||||||
@@ -121,6 +123,11 @@ public final class KeyChain {
|
|||||||
*/
|
*/
|
||||||
private static final String CERT_INSTALLER_PACKAGE = "com.android.certinstaller";
|
private static final String CERT_INSTALLER_PACKAGE = "com.android.certinstaller";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Package name for Settings.
|
||||||
|
*/
|
||||||
|
private static final String SETTINGS_PACKAGE = "com.android.settings";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extra for use with {@link #ACTION_CHOOSER}
|
* Extra for use with {@link #ACTION_CHOOSER}
|
||||||
* @hide Also used by KeyChainActivity implementation
|
* @hide Also used by KeyChainActivity implementation
|
||||||
@@ -201,6 +208,20 @@ public final class KeyChain {
|
|||||||
// Compatible with old android.security.Credentials.PKCS12
|
// Compatible with old android.security.Credentials.PKCS12
|
||||||
public static final String EXTRA_PKCS12 = "PKCS12";
|
public static final String EXTRA_PKCS12 = "PKCS12";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extra used by {@link #createManageCredentialsIntent(AppUriAuthenticationPolicy)} to specify
|
||||||
|
* the authentication policy of the credential management app.
|
||||||
|
*
|
||||||
|
* <p>The authentication policy declares which alias for a private key and certificate pair
|
||||||
|
* should be used for authentication, given a list of apps and URIs.
|
||||||
|
*
|
||||||
|
* <p>The extra value should be a {@link AppUriAuthenticationPolicy}.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String EXTRA_AUTHENTICATION_POLICY =
|
||||||
|
"android.security.extra.AUTHENTICATION_POLICY";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Broadcast Action: Indicates the trusted storage has changed. Sent when
|
* Broadcast Action: Indicates the trusted storage has changed. Sent when
|
||||||
* one of this happens:
|
* one of this happens:
|
||||||
@@ -385,6 +406,23 @@ public final class KeyChain {
|
|||||||
return intent;
|
return intent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an {@code Intent} that should be used by an app to request to manage the user's
|
||||||
|
* credentials. This is limited to unmanaged devices. The authentication policy must be
|
||||||
|
* provided to be able to make this request successfully.
|
||||||
|
*
|
||||||
|
* @param policy The authentication policy determines which alias for a private key and
|
||||||
|
* certificate pair should be used for authentication.
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public static Intent createManageCredentialsIntent(@NonNull AppUriAuthenticationPolicy policy) {
|
||||||
|
Intent intent = new Intent(ACTION_MANAGE_CREDENTIALS);
|
||||||
|
intent.setComponent(ComponentName.createRelative(SETTINGS_PACKAGE,
|
||||||
|
".security.RequestManageCredentials"));
|
||||||
|
intent.putExtra(EXTRA_AUTHENTICATION_POLICY, policy);
|
||||||
|
return intent;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launches an {@code Activity} for the user to select the alias
|
* Launches an {@code Activity} for the user to select the alias
|
||||||
* for a private key and certificate pair for authentication. The
|
* for a private key and certificate pair for authentication. The
|
||||||
|
|||||||
Reference in New Issue
Block a user