Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Mono.Android] Add convenience KeyChain APIs (#9047)
Context: dotnet/runtime#99874 Context: dotnet/runtime#103337 dotnet/runtime#103337 added the ability for the [`X509Certificate2(IntPtr)` constructor][0] to accept a [`java.security.KeyStore.PrivateKeyEntry`][1] instance. Add convenience methods to [`Android.Security.KeyChain`][2] to make it easier for developers to access certificates with non-exportable private keys: partial class KeyChain { public static X509Certificate2? GetX509Certificate2WithPrivateKey ( Android.Content.Context context, string alias); public static async Task<string?> ChoosePrivateKeyAliasAsync ( Android.App.Activity activity, string[]? keyTypes, Java.Security.IPrincipal[]? issuers, Android.Net.Uri? uri, string? alias); public static async Task<string?> ChoosePrivateKeyAliasAsync ( Android.App.Activity activity, string[]? keyTypes, Java.Security.IPrincipal[]? issuers, string? host, int port, string? alias); public static async Task<X509Certificate2?> ChooseX509Certificate2WithPrivateKeyAsync ( Android.App.Activity activity, string[]? keyTypes, Java.Security.IPrincipal[]? issuers, Android.Net.Uri? uri, string? alias); public static async Task<X509Certificate2?> ChooseX509Certificate2WithPrivateKeyAsync ( Android.App.Activity activity, string[]? keyTypes, Java.Security.IPrincipal[]? issuers, string? host, int port, string? alias); } [0]: https://learn.microsoft.com/dotnet/api/system.security.cryptography.x509certificates.x509certificate2.-ctor?view=net-8.0#system-security-cryptography-x509certificates-x509certificate2-ctor(system-intptr) [1]: https://developer.android.com/reference/java/security/KeyStore.PrivateKeyEntry [2]: https://learn.microsoft.com/dotnet/api/android.security.keychain?view=net-android-34.0
- Loading branch information