-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AndroidCrypto] Implement Root (read-only) and CurrentUser/My certifi…
…cate stores (#48862)
- Loading branch information
1 parent
54d8c84
commit eae9a1d
Showing
28 changed files
with
1,374 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...mmon/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.X509Store.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
using System.Security.Cryptography; | ||
using System.Security.Cryptography.X509Certificates; | ||
using Microsoft.Win32.SafeHandles; | ||
|
||
internal static partial class Interop | ||
{ | ||
internal static partial class AndroidCrypto | ||
{ | ||
[DllImport(Libraries.CryptoNative, EntryPoint = "AndroidCryptoNative_X509StoreAddCertificate")] | ||
[return: MarshalAs(UnmanagedType.Bool)] | ||
internal static extern unsafe bool X509StoreAddCertificate( | ||
SafeX509StoreHandle store, | ||
SafeX509Handle cert, | ||
string hashString); | ||
|
||
[DllImport(Libraries.CryptoNative, EntryPoint = "AndroidCryptoNative_X509StoreAddCertificateWithPrivateKey")] | ||
[return: MarshalAs(UnmanagedType.Bool)] | ||
internal static extern unsafe bool X509StoreAddCertificateWithPrivateKey( | ||
SafeX509StoreHandle store, | ||
SafeX509Handle cert, | ||
SafeKeyHandle key, | ||
PAL_KeyAlgorithm algorithm, | ||
string hashString); | ||
|
||
[DllImport(Libraries.CryptoNative, EntryPoint = "AndroidCryptoNative_X509StoreContainsCertificate")] | ||
[return: MarshalAs(UnmanagedType.Bool)] | ||
internal static extern unsafe bool X509StoreContainsCertificate( | ||
SafeX509StoreHandle store, | ||
SafeX509Handle cert, | ||
string hashString); | ||
|
||
[DllImport(Libraries.CryptoNative, EntryPoint = "AndroidCryptoNative_X509StoreEnumerateCertificates")] | ||
[return: MarshalAs(UnmanagedType.Bool)] | ||
internal static extern unsafe bool X509StoreEnumerateCertificates( | ||
SafeX509StoreHandle storeHandle, | ||
delegate* unmanaged<void*, void*, Interop.AndroidCrypto.PAL_KeyAlgorithm, void*, void> callback, | ||
void *callbackContext); | ||
|
||
[DllImport(Libraries.CryptoNative, EntryPoint = "AndroidCryptoNative_X509StoreEnumerateTrustedCertificates")] | ||
[return: MarshalAs(UnmanagedType.Bool)] | ||
internal static extern unsafe bool X509StoreEnumerateTrustedCertificates( | ||
byte systemOnly, | ||
delegate* unmanaged<void*, void*, void> callback, | ||
void *callbackContext); | ||
|
||
[DllImport(Libraries.CryptoNative, EntryPoint = "AndroidCryptoNative_X509StoreOpenDefault")] | ||
internal static extern unsafe SafeX509StoreHandle X509StoreOpenDefault(); | ||
|
||
[DllImport(Libraries.CryptoNative, EntryPoint = "AndroidCryptoNative_X509StoreRemoveCertificate")] | ||
[return: MarshalAs(UnmanagedType.Bool)] | ||
internal static extern unsafe bool X509StoreRemoveCertificate( | ||
SafeX509StoreHandle store, | ||
SafeX509Handle cert, | ||
string hashString); | ||
} | ||
} | ||
|
||
namespace System.Security.Cryptography.X509Certificates | ||
{ | ||
internal sealed class SafeX509StoreHandle : Interop.JObjectLifetime.SafeJObjectHandle | ||
{ | ||
public SafeX509StoreHandle() | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.