mirror of
https://gitee.com/csharpui/CPF.git
synced 2025-04-05 17:37:51 +08:00
40 lines
1.0 KiB
C#
40 lines
1.0 KiB
C#
using CPF.Mac.ObjCRuntime;
|
|
using System;
|
|
|
|
namespace CPF.Mac.Security
|
|
{
|
|
internal static class SecClass
|
|
{
|
|
public static IntPtr SecClassKey;
|
|
|
|
public static IntPtr GenericPassword;
|
|
|
|
public static IntPtr InternetPassword;
|
|
|
|
public static IntPtr Certificate;
|
|
|
|
public static IntPtr Key;
|
|
|
|
public static IntPtr Identity;
|
|
|
|
static SecClass()
|
|
{
|
|
SecClassKey = Dlfcn.GetIntPtr(SecItem.securityLibrary, "kSecClass");
|
|
GenericPassword = Dlfcn.GetIntPtr(SecItem.securityLibrary, "kSecClassGenericPassword");
|
|
InternetPassword = Dlfcn.GetIntPtr(SecItem.securityLibrary, "kSecClassInternetPassword");
|
|
Certificate = Dlfcn.GetIntPtr(SecItem.securityLibrary, "kSecClassCertificate");
|
|
Key = Dlfcn.GetIntPtr(SecItem.securityLibrary, "kSecClassKey");
|
|
Identity = Dlfcn.GetIntPtr(SecItem.securityLibrary, "kSecClassIdentity");
|
|
}
|
|
|
|
public static IntPtr FromSecKind(SecKind secKind)
|
|
{
|
|
if (secKind == SecKind.InternetPassword)
|
|
{
|
|
return InternetPassword;
|
|
}
|
|
throw new ArgumentException("secKind");
|
|
}
|
|
}
|
|
}
|