diff --git a/src/Security/Authorization.cs b/src/Security/Authorization.cs
index e890c2f32ea3..317d141f0716 100644
--- a/src/Security/Authorization.cs
+++ b/src/Security/Authorization.cs
@@ -33,21 +33,12 @@
using Foundation;
using System;
using System.Runtime.InteropServices;
-#if NET
-#else
-using NativeHandle = System.IntPtr;
-#endif
namespace Security {
-
-#if NET
/// To be added.
/// To be added.
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
-#else
- [MacCatalyst (15,0)]
-#endif
// Untyped enum in ObjC
public enum AuthorizationStatus {
/// To be added.
@@ -82,14 +73,10 @@ public enum AuthorizationStatus {
BadAddress = -60033,
}
-#if NET
/// To be added.
/// To be added.
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
-#else
- [MacCatalyst (15,0)]
-#endif
// typedef UInt32 AuthorizationFlags;
[Flags]
public enum AuthorizationFlags : int {
@@ -105,12 +92,8 @@ public enum AuthorizationFlags : int {
DestroyRights = 1 << 3,
/// To be added.
PreAuthorize = 1 << 4,
-#if NET
[SupportedOSPlatform ("maccatalyst17.0")]
[SupportedOSPlatform ("macos14.0")]
-#else
- [Mac(14, 0), MacCatalyst(17, 0)]
-#endif
SkipInternalAuth = 1 << 9,
NoData = 1 << 20,
}
@@ -119,14 +102,10 @@ public enum AuthorizationFlags : int {
// For ease of use, we let the user pass the AuthorizationParameters, and we
// create the structure for them with the proper data
//
-#if NET
/// To be added.
/// To be added.
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
-#else
- [MacCatalyst (15,0)]
-#endif
public class AuthorizationParameters {
/// To be added.
/// To be added.
@@ -139,14 +118,10 @@ public class AuthorizationParameters {
public string? IconPath;
}
-#if NET
/// To be added.
/// To be added.
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
-#else
- [MacCatalyst (15,0)]
-#endif
public class AuthorizationEnvironment {
/// To be added.
/// To be added.
@@ -159,12 +134,8 @@ public class AuthorizationEnvironment {
public bool AddToSharedCredentialPool;
}
-#if NET
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
-#else
- [MacCatalyst (15,0)]
-#endif
[StructLayout (LayoutKind.Sequential)]
struct AuthorizationItem {
public IntPtr /* AuthorizationString = const char * */ name;
@@ -173,43 +144,27 @@ struct AuthorizationItem {
public int /* UInt32 */ flags; // zero
}
-#if NET
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
-#else
- [MacCatalyst (15,0)]
-#endif
unsafe struct AuthorizationItemSet {
public int /* UInt32 */ count;
public AuthorizationItem* /* AuthorizationItem* */ ptrToAuthorization;
}
-#if NET
/// To be added.
/// To be added.
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
-#else
- [MacCatalyst (15,0)]
-#endif
public unsafe class Authorization : DisposableObject {
[DllImport (Constants.SecurityLibrary)]
unsafe extern static int /* OSStatus = int */ AuthorizationCreate (AuthorizationItemSet* rights, AuthorizationItemSet* environment, AuthorizationFlags flags, IntPtr* auth);
-#if NET
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
- [ObsoletedOSPlatform ("macos10.7", "Use the Service Management framework or the launchd-launched helper tool instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 10,7)]
-#endif
-#if NET
+ [ObsoletedOSPlatform ("maccatalyst", "Use the Service Management framework or the launchd-launched helper tool instead.")]
+ [ObsoletedOSPlatform ("macos", "Use the Service Management framework or the launchd-launched helper tool instead.")]
[DllImport (Constants.SecurityLibrary)]
extern static int /* OSStatus = int */ AuthorizationExecuteWithPrivileges (IntPtr handle, IntPtr pathToTool, AuthorizationFlags flags, IntPtr args, IntPtr FILEPtr);
-#else
- [DllImport (Constants.SecurityLibrary)]
- extern static int /* OSStatus = int */ AuthorizationExecuteWithPrivileges (IntPtr handle, string pathToTool, AuthorizationFlags flags, string? []? args, IntPtr FILEPtr);
-#endif
[DllImport (Constants.SecurityLibrary)]
extern static int /* OSStatus = int */ AuthorizationFree (IntPtr handle, AuthorizationFlags flags);
@@ -220,7 +175,6 @@ internal Authorization (NativeHandle handle, bool owns)
{
}
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -229,10 +183,8 @@ internal Authorization (NativeHandle handle, bool owns)
/// To be added.
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
- [ObsoletedOSPlatform ("macos10.7", "Use the Service Management framework or the launchd-launched helper tool instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 10,7)]
-#endif
+ [ObsoletedOSPlatform ("maccatalyst", "Use the Service Management framework or the launchd-launched helper tool instead.")]
+ [ObsoletedOSPlatform ("macos", "Use the Service Management framework or the launchd-launched helper tool instead.")]
public int ExecuteWithPrivileges (string pathToTool, AuthorizationFlags flags, string []? args)
{
string? []? arguments = args!;
@@ -247,15 +199,11 @@ public int ExecuteWithPrivileges (string pathToTool, AuthorizationFlags flags, s
arguments = array;
}
}
-#if NET
using var pathToToolStr = new TransientString (pathToTool);
var argsPtr = TransientString.AllocStringArray (arguments);
var retval = AuthorizationExecuteWithPrivileges (Handle, pathToToolStr, flags, argsPtr, IntPtr.Zero);
TransientString.FreeStringArray (argsPtr, args is null ? 0 : args.Length);
return retval;
-#else
- return AuthorizationExecuteWithPrivileges (Handle, pathToTool, flags, arguments, IntPtr.Zero);
-#endif
}
protected override void Dispose (bool disposing)
diff --git a/src/Security/Certificate.cs b/src/Security/Certificate.cs
index ffb18b33a93d..26564d6d19d4 100644
--- a/src/Security/Certificate.cs
+++ b/src/Security/Certificate.cs
@@ -30,10 +30,6 @@
#nullable enable
-#if !NET
-#define NATIVE_APPLE_CERTIFICATE
-#endif
-
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -42,23 +38,12 @@
using CoreFoundation;
using Foundation;
-#if !NET
-using NativeHandle = System.IntPtr;
-#endif
-
namespace Security {
/// Represents digital certificates on iOS/OSX.
///
///
public partial class SecCertificate : NativeObject {
-#if !NET
- public SecCertificate (NativeHandle handle)
- : base (handle, false, verify: true)
- {
- }
-#endif // !NET
-
[Preserve (Conditional = true)]
internal SecCertificate (NativeHandle handle, bool owns)
: base (handle, owns, verify: true)
@@ -117,36 +102,11 @@ public SecCertificate (X509Certificate certificate)
if (certificate is null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (certificate));
-#if NATIVE_APPLE_CERTIFICATE
- var handle = certificate.Impl.GetNativeAppleCertificate ();
- if (handle != IntPtr.Zero) {
- CFObject.CFRetain (handle);
- InitializeHandle (handle);
- return;
- }
-#endif
-
using (NSData cert = NSData.FromArray (certificate.GetRawCertData ())) {
Initialize (cert);
}
}
-#if NATIVE_APPLE_CERTIFICATE
- internal SecCertificate (X509CertificateImpl impl)
- {
- var handle = impl.GetNativeAppleCertificate ();
- if (handle != IntPtr.Zero) {
- CFObject.CFRetain (handle);
- InitializeHandle (handle);
- return;
- }
-
- using (NSData cert = NSData.FromArray (impl.RawData)) {
- Initialize (cert);
- }
- }
-#endif
-
/// a valid X509Certificate2 instance
/// Initialize this instance from an existing X509Certificate2 instance.
///
@@ -156,15 +116,6 @@ public SecCertificate (X509Certificate2 certificate)
if (certificate is null)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (certificate));
-#if NATIVE_APPLE_CERTIFICATE
- var handle = certificate.Impl.GetNativeAppleCertificate ();
- if (handle != IntPtr.Zero) {
- CFObject.CFRetain (handle);
- InitializeHandle (handle);
- return;
- }
-#endif
-
using (NSData cert = NSData.FromArray (certificate.RawData)) {
Initialize (cert);
}
@@ -220,16 +171,7 @@ byte [] GetRawData ()
/// To be added.
public X509Certificate ToX509Certificate ()
{
-#if NET
return X509CertificateLoader.LoadCertificate (GetRawData ());
-#else
-#if NATIVE_APPLE_CERTIFICATE
- var impl = new Mono.AppleTls.X509CertificateImplApple (GetCheckedHandle (), false);
- return new X509Certificate (impl);
-#else
- return new X509Certificate (GetRawData ());
-#endif
-#endif
}
/// To be added.
@@ -237,11 +179,7 @@ public X509Certificate ToX509Certificate ()
/// To be added.
public X509Certificate2 ToX509Certificate2 ()
{
-#if NET
return X509CertificateLoader.LoadCertificate (GetRawData ());
-#else
- return new X509Certificate2 (GetRawData ());
-#endif
}
internal static bool Equals (SecCertificate first, SecCertificate second)
@@ -280,7 +218,6 @@ internal static bool Equals (SecCertificate first, SecCertificate second)
[DllImport (Constants.SecurityLibrary)]
extern static /* CFDictionaryRef */ IntPtr SecCertificateCopyValues (/* SecCertificateRef */ IntPtr certificate, /* CFArrayRef */ IntPtr keys, /* CFErrorRef _Nullable * */ IntPtr error);
-#if NET
/// To be added.
/// The return type is on iOS and on MacOS.
/// To be added.
@@ -288,10 +225,7 @@ internal static bool Equals (SecCertificate first, SecCertificate second)
[UnsupportedOSPlatform ("ios")]
[UnsupportedOSPlatform ("tvos")]
[UnsupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.14", "Use 'GetKey' instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 10,14, message: "Use 'GetKey' instead.")]
-#endif
+ [ObsoletedOSPlatform ("macos", "Use 'GetKey' instead.")]
public NSData? GetPublicKey ()
{
IntPtr result;
@@ -312,31 +246,21 @@ internal static bool Equals (SecCertificate first, SecCertificate second)
}
}
#else
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("tvos")]
[UnsupportedOSPlatform ("maccatalyst")]
[UnsupportedOSPlatform ("macos")]
[ObsoletedOSPlatform ("tvos12.0")]
[ObsoletedOSPlatform ("ios12.0")]
-#else
- [Deprecated (PlatformName.iOS, 12, 0)]
- [Deprecated (PlatformName.TvOS, 12, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern /* __nullable SecKeyRef */ IntPtr SecCertificateCopyPublicKey (IntPtr /* SecCertificateRef */ certificate);
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("tvos")]
[UnsupportedOSPlatform ("maccatalyst")]
[UnsupportedOSPlatform ("macos")]
[ObsoletedOSPlatform ("tvos12.0", "Use 'GetKey' instead.")]
[ObsoletedOSPlatform ("ios12.0", "Use 'GetKey' instead.")]
-#else
- [Deprecated (PlatformName.iOS, 12, 0, message: "Use 'GetKey' instead.")]
- [Deprecated (PlatformName.TvOS, 12, 0, message: "Use 'GetKey' instead.")]
-#endif
public SecKey? GetPublicKey ()
{
IntPtr data = SecCertificateCopyPublicKey (Handle);
@@ -345,16 +269,13 @@ internal static bool Equals (SecCertificate first, SecCertificate second)
#endif
#endif // !__MACCATALYST__
-#if NET
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern IntPtr /* SecKeyRef* */ SecCertificateCopyKey (IntPtr /* SecKeyRef* */ key);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -362,23 +283,19 @@ internal static bool Equals (SecCertificate first, SecCertificate second)
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public SecKey? GetKey ()
{
var key = SecCertificateCopyKey (Handle);
return key == IntPtr.Zero ? null : new SecKey (key, true);
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe static extern /* OSStatus */ int SecCertificateCopyCommonName (IntPtr /* SecCertificateRef */ certificate, IntPtr* /* CFStringRef * __nonnull CF_RETURNS_RETAINED */ commonName);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -386,7 +303,6 @@ internal static bool Equals (SecCertificate first, SecCertificate second)
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
-#endif
public string? GetCommonName ()
{
IntPtr cn;
@@ -397,16 +313,13 @@ internal static bool Equals (SecCertificate first, SecCertificate second)
return null;
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe static extern /* OSStatus */ int SecCertificateCopyEmailAddresses (IntPtr /* SecCertificateRef */ certificate, IntPtr* /* CFArrayRef * __nonnull CF_RETURNS_RETAINED */ emailAddresses);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -414,7 +327,6 @@ internal static bool Equals (SecCertificate first, SecCertificate second)
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
-#endif
public string? []? GetEmailAddresses ()
{
IntPtr emails;
@@ -425,16 +337,13 @@ internal static bool Equals (SecCertificate first, SecCertificate second)
return null;
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern /* __nullable CFDataRef */ IntPtr SecCertificateCopyNormalizedIssuerSequence (IntPtr /* SecCertificateRef */ certificate);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -442,23 +351,19 @@ internal static bool Equals (SecCertificate first, SecCertificate second)
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public NSData? GetNormalizedIssuerSequence ()
{
IntPtr data = SecCertificateCopyNormalizedIssuerSequence (Handle);
return Runtime.GetNSObject (data, true);
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern /* __nullable CFDataRef */ IntPtr SecCertificateCopyNormalizedSubjectSequence (IntPtr /* SecCertificateRef */ certificate);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -466,42 +371,26 @@ internal static bool Equals (SecCertificate first, SecCertificate second)
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public NSData? GetNormalizedSubjectSequence ()
{
IntPtr data = SecCertificateCopyNormalizedSubjectSequence (Handle);
return Runtime.GetNSObject (data, true);
}
-#if MONOMAC
-#if NET
- [SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("macos")]
- [ObsoletedOSPlatform ("macos10.13", "Use 'GetSerialNumber' instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 10,13, message: "Use 'GetSerialNumber' instead.")]
-#endif
- [DllImport (Constants.SecurityLibrary)]
- static extern /* __nullable CFDataRef */ IntPtr SecCertificateCopySerialNumber (IntPtr /* SecCertificateRef */ certificate, IntPtr /* CFErrorRef * */ error);
-
-#else // !MONOMAC
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("macos10.13", "Use 'GetSerialNumber' instead.")]
- [ObsoletedOSPlatform ("tvos11.0", "Use 'GetSerialNumber' instead.")]
- [ObsoletedOSPlatform ("ios11.0", "Use 'GetSerialNumber' instead.")]
-#else
- [Deprecated (PlatformName.iOS, 11, 0, message: "Use 'GetSerialNumber' instead.")]
- [Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'GetSerialNumber' instead.")]
- [Deprecated (PlatformName.TvOS, 11, 0, message: "Use 'GetSerialNumber' instead.")]
-#endif
+ [ObsoletedOSPlatform ("macos", "Use 'GetSerialNumber' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'GetSerialNumber' instead.")]
+ [ObsoletedOSPlatform ("tvos", "Use 'GetSerialNumber' instead.")]
+ [ObsoletedOSPlatform ("ios", "Use 'GetSerialNumber' instead.")]
[DllImport (Constants.SecurityLibrary)]
+#if MONOMAC
+ static extern /* __nullable CFDataRef */ IntPtr SecCertificateCopySerialNumber (IntPtr /* SecCertificateRef */ certificate, IntPtr /* CFErrorRef * */ error);
+#else
static extern /* __nullable CFDataRef */ IntPtr SecCertificateCopySerialNumber (IntPtr /* SecCertificateRef */ certificate);
#endif
-#if NET
/// Developers should not use this deprecated method. Developers should use 'GetSerialNumber(out NSError)' instead.
/// To be added.
/// To be added.
@@ -509,14 +398,10 @@ internal static bool Equals (SecCertificate first, SecCertificate second)
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("macos10.13", "Use 'GetSerialNumber(out NSError)' instead.")]
- [ObsoletedOSPlatform ("tvos11.0", "Use 'GetSerialNumber(out NSError)' instead.")]
- [ObsoletedOSPlatform ("ios11.0", "Use 'GetSerialNumber(out NSError)' instead.")]
-#else
- [Deprecated (PlatformName.iOS, 11, 0, message: "Use 'GetSerialNumber(out NSError)' instead.")]
- [Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'GetSerialNumber(out NSError)' instead.")]
- [Deprecated (PlatformName.TvOS, 11, 0, message: "Use 'GetSerialNumber(out NSError)' instead.")]
-#endif
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'GetSerialNumber(out NSError)' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'GetSerialNumber(out NSError)' instead.")]
+ [ObsoletedOSPlatform ("tvos", "Use 'GetSerialNumber(out NSError)' instead.")]
+ [ObsoletedOSPlatform ("ios", "Use 'GetSerialNumber(out NSError)' instead.")]
public NSData? GetSerialNumber ()
{
#if MONOMAC
@@ -527,16 +412,13 @@ internal static bool Equals (SecCertificate first, SecCertificate second)
return Runtime.GetNSObject (data, true);
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe static extern /* __nullable CFDataRef */ IntPtr SecCertificateCopySerialNumberData (IntPtr /* SecCertificateRef */ certificate, IntPtr* /* CFErrorRef * */ error);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -545,7 +427,6 @@ internal static bool Equals (SecCertificate first, SecCertificate second)
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public NSData? GetSerialNumber (out NSError? error)
{
IntPtr err = IntPtr.Zero;
@@ -557,27 +438,19 @@ internal static bool Equals (SecCertificate first, SecCertificate second)
return Runtime.GetNSObject (data, true);
}
-#if NET
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
-#else
- [TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern /* CFDateRef */ IntPtr SecCertificateCopyNotValidBeforeDate (/* SecCertificateRef */ IntPtr certificate);
/// Get the date when this certificate becomes valid.
/// The date when this certificate becomes valid, or null if the date could not be obtained.
-#if NET
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
-#else
- [TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
-#endif
public NSDate? NotValidBeforeDate {
get {
var ptr = SecCertificateCopyNotValidBeforeDate (Handle);
@@ -585,27 +458,19 @@ public NSDate? NotValidBeforeDate {
}
}
-#if NET
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
-#else
- [TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern /* CFDateRef */ IntPtr SecCertificateCopyNotValidAfterDate (/* SecCertificateRef */ IntPtr certificate);
/// Get the date when this certificate is no longer valid.
/// The date when this certificate is no longer valid, or null if the date could not be obtained.
-#if NET
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
-#else
- [TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
-#endif
public NSDate? NotValidAfterDate {
get {
var ptr = SecCertificateCopyNotValidAfterDate (Handle);
@@ -619,13 +484,6 @@ public NSDate? NotValidAfterDate {
/// Encapsulate a security identity. A security identity comprises a certificate and its private key.
/// To be added.
public partial class SecIdentity : NativeObject {
-#if !NET
- public SecIdentity (NativeHandle handle)
- : base (handle, false)
- {
- }
-#endif
-
[Preserve (Conditional = true)]
internal SecIdentity (NativeHandle handle, bool owns)
: base (handle, owns)
@@ -788,19 +646,8 @@ public static SecIdentity Import (X509Certificate2 certificate)
/// Encapsulates a security key, one half of a public-private key-pair.
/// To be added.
public partial class SecKey : NativeObject {
-#if !NET
- public SecKey (IntPtr handle)
- : base (handle, false)
- {
- }
-#endif
-
[Preserve (Conditional = true)]
-#if NET
internal SecKey (NativeHandle handle, bool owns)
-#else
- public SecKey (NativeHandle handle, bool owns)
-#endif
: base (handle, owns)
{
}
@@ -819,27 +666,19 @@ public SecKey (NativeHandle handle, bool owns)
[DllImport (Constants.SecurityLibrary, EntryPoint = "SecKeyGetTypeID")]
public extern static nint GetTypeID ();
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("macos12.0", "Use 'SecKeyCreateRandomKey' instead.")]
- [ObsoletedOSPlatform ("maccatalyst15.0", "Use 'SecKeyCreateRandomKey' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'SecKeyCreateRandomKey' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'SecKeyCreateRandomKey' instead.")]
[ObsoletedOSPlatform ("tvos15.0", "Use 'SecKeyCreateRandomKey' instead.")]
[ObsoletedOSPlatform ("ios15.0", "Use 'SecKeyCreateRandomKey' instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 12, 0, message: "Use 'SecKeyCreateRandomKey' instead.")]
- [Deprecated (PlatformName.iOS, 15, 0, message: "Use 'SecKeyCreateRandomKey' instead.")]
- [Deprecated (PlatformName.MacCatalyst, 15, 0, message: "Use 'SecKeyCreateRandomKey' instead.")]
- [Deprecated (PlatformName.TvOS, 15, 0, message: "Use 'SecKeyCreateRandomKey' instead.")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe extern static SecStatusCode SecKeyGeneratePair (IntPtr dictHandle, IntPtr* pubKey, IntPtr* privKey);
// TODO: pull all the TypeRefs needed for the NSDictionary
-#if NET
/// A dictionary of key pair parameters.
/// A location to store the public key.
/// A location to store the private key.
@@ -850,16 +689,10 @@ public SecKey (NativeHandle handle, bool owns)
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("macos12.0", "Use 'CreateRandomKey' instead.")]
- [ObsoletedOSPlatform ("maccatalyst15.0", "Use 'CreateRandomKey' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'CreateRandomKey' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'CreateRandomKey' instead.")]
[ObsoletedOSPlatform ("tvos15.0", "Use 'CreateRandomKey' instead.")]
[ObsoletedOSPlatform ("ios15.0", "Use 'CreateRandomKey' instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 12, 0, message: "Use 'CreateRandomKey' instead.")]
- [Deprecated (PlatformName.iOS, 15, 0, message: "Use 'CreateRandomKey' instead.")]
- [Deprecated (PlatformName.MacCatalyst, 15, 0, message: "Use 'CreateRandomKey' instead.")]
- [Deprecated (PlatformName.TvOS, 15, 0, message: "Use 'CreateRandomKey' instead.")]
-#endif
public static SecStatusCode GenerateKeyPair (NSDictionary parameters, out SecKey? publicKey, out SecKey? privateKey)
{
if (parameters is null)
@@ -881,14 +714,21 @@ public static SecStatusCode GenerateKeyPair (NSDictionary parameters, out SecKey
}
/// The type of key pair to generate.
- /// The key size, in bits
- /// Attributes for the keys in the pair.
- /// A location to store the public key.
- /// A location to store the private key.
- /// Generates a key pair from the provided values.
- /// A status code for the operation.
- /// To be added.
- [Advice ("On iOS this method applies the attributes to both public and private key. To apply different attributes to each key, use 'GenerateKeyPair (SecKeyType, int, SecPublicPrivateKeyAttrs, SecPublicPrivateKeyAttrs, out SecKey, out SecKey)' instead.")]
+ /// The key size, in bits
+ /// Attributes for the keys in the pair.
+ /// A location to store the public key.
+ /// A location to store the private key.
+ /// Generates a key pair from the provided values.
+ /// A status code for the operation.
+ /// On every platform except macOS this method applies the attributes to both the public and the private key.
+ [SupportedOSPlatform ("ios")]
+ [SupportedOSPlatform ("maccatalyst")]
+ [SupportedOSPlatform ("macos")]
+ [SupportedOSPlatform ("tvos")]
+ [ObsoletedOSPlatform ("macos", "Use 'CreateRandomKey' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'CreateRandomKey' instead.")]
+ [ObsoletedOSPlatform ("tvos15.0", "Use 'CreateRandomKey' instead.")]
+ [ObsoletedOSPlatform ("ios15.0", "Use 'CreateRandomKey' instead.")]
public static SecStatusCode GenerateKeyPair (SecKeyType type, int keySizeInBits, SecPublicPrivateKeyAttrs publicAndPrivateKeyAttrs, out SecKey? publicKey, out SecKey? privateKey)
{
#if !MONOMAC
@@ -909,6 +749,7 @@ public static SecStatusCode GenerateKeyPair (SecKeyType type, int keySizeInBits,
return GenerateKeyPair (dic, out publicKey, out privateKey);
#endif
}
+
#if !MONOMAC
/// The type of key pair to generate.
/// The key size, in bits
@@ -919,6 +760,13 @@ public static SecStatusCode GenerateKeyPair (SecKeyType type, int keySizeInBits,
/// Generates a key pair from the provided values.
/// A status code for the operation.
/// To be added.
+ [SupportedOSPlatform ("ios")]
+ [SupportedOSPlatform ("maccatalyst")]
+ [SupportedOSPlatform ("tvos")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'CreateRandomKey' instead.")]
+ [ObsoletedOSPlatform ("tvos15.0", "Use 'CreateRandomKey' instead.")]
+ [ObsoletedOSPlatform ("ios15.0", "Use 'CreateRandomKey' instead.")]
+ [UnsupportedOSPlatform ("macos")]
public static SecStatusCode GenerateKeyPair (SecKeyType type, int keySizeInBits, SecPublicPrivateKeyAttrs publicKeyAttrs, SecPublicPrivateKeyAttrs privateKeyAttrs, out SecKey? publicKey, out SecKey? privateKey)
{
if (type == SecKeyType.Invalid)
@@ -950,23 +798,22 @@ public int BlockSize {
}
}
-#if NET
+#if !(__MACOS__ && XAMCORE_5_0)
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
+#if XAMCORE_5_0
+ [UnsupportedOSPlatform ("macos")]
+#else
[SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos", "Use 'SecKeyCreateSignature' instead.")]
+#endif
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("maccatalyst15.0", "Use 'SecKeyCreateSignature' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'SecKeyCreateSignature' instead.")]
[ObsoletedOSPlatform ("tvos15.0", "Use 'SecKeyCreateSignature' instead.")]
[ObsoletedOSPlatform ("ios15.0", "Use 'SecKeyCreateSignature' instead.")]
-#else
- [Deprecated (PlatformName.iOS, 15, 0, message: "Use 'SecKeyCreateSignature' instead.")]
- [Deprecated (PlatformName.MacCatalyst, 15, 0, message: "Use 'SecKeyCreateSignature' instead.")]
- [Deprecated (PlatformName.TvOS, 15, 0, message: "Use 'SecKeyCreateSignature' instead.")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe extern static SecStatusCode SecKeyRawSign (IntPtr handle, SecPadding padding, IntPtr dataToSign, nint dataToSignLen, IntPtr sig, nint* sigLen);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -976,16 +823,16 @@ public int BlockSize {
/// To be added.
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
+#if XAMCORE_5_0
+ [UnsupportedOSPlatform ("macos")]
+#else
[SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos", "Use 'CreateSignature' instead.")]
+#endif
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("maccatalyst15.0", "Use 'CreateSignature' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'CreateSignature' instead.")]
[ObsoletedOSPlatform ("tvos15.0", "Use 'CreateSignature' instead.")]
[ObsoletedOSPlatform ("ios15.0", "Use 'CreateSignature' instead.")]
-#else
- [Deprecated (PlatformName.iOS, 15, 0, message: "Use 'CreateSignature' instead.")]
- [Deprecated (PlatformName.MacCatalyst, 15, 0, message: "Use 'CreateSignature' instead.")]
- [Deprecated (PlatformName.TvOS, 15, 0, message: "Use 'CreateSignature' instead.")]
-#endif
public SecStatusCode RawSign (SecPadding padding, IntPtr dataToSign, int dataToSignLen, out byte [] result)
{
if (dataToSign == IntPtr.Zero)
@@ -1000,6 +847,18 @@ public SecStatusCode RawSign (SecPadding padding, IntPtr dataToSign, int dataToS
/// To be added.
/// To be added.
/// To be added.
+ [SupportedOSPlatform ("ios")]
+ [SupportedOSPlatform ("maccatalyst")]
+#if XAMCORE_5_0
+ [UnsupportedOSPlatform ("macos")]
+#else
+ [SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos", "Use 'CreateSignature' instead.")]
+#endif
+ [SupportedOSPlatform ("tvos")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'CreateSignature' instead.")]
+ [ObsoletedOSPlatform ("tvos15.0", "Use 'CreateSignature' instead.")]
+ [ObsoletedOSPlatform ("ios15.0", "Use 'CreateSignature' instead.")]
public unsafe SecStatusCode RawSign (SecPadding padding, byte [] dataToSign, out byte [] result)
{
if (dataToSign is null)
@@ -1009,6 +868,18 @@ public unsafe SecStatusCode RawSign (SecPadding padding, byte [] dataToSign, out
return _RawSign (padding, (IntPtr) bp, dataToSign.Length, out result);
}
+ [SupportedOSPlatform ("ios")]
+ [SupportedOSPlatform ("maccatalyst")]
+#if XAMCORE_5_0
+ [UnsupportedOSPlatform ("macos")]
+#else
+ [SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos", "Use 'CreateSignature' instead.")]
+#endif
+ [SupportedOSPlatform ("tvos")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'CreateSignature' instead.")]
+ [ObsoletedOSPlatform ("tvos15.0", "Use 'CreateSignature' instead.")]
+ [ObsoletedOSPlatform ("ios15.0", "Use 'CreateSignature' instead.")]
unsafe SecStatusCode _RawSign (SecPadding padding, IntPtr dataToSign, int dataToSignLen, out byte [] result)
{
SecStatusCode status;
@@ -1021,23 +892,16 @@ unsafe SecStatusCode _RawSign (SecPadding padding, IntPtr dataToSign, int dataTo
return status;
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("macos")]
+ [UnsupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("maccatalyst15.0", "Use 'SecKeyVerifySignature' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'SecKeyVerifySignature' instead.")]
[ObsoletedOSPlatform ("tvos15.0", "Use 'SecKeyVerifySignature' instead.")]
[ObsoletedOSPlatform ("ios15.0", "Use 'SecKeyVerifySignature' instead.")]
-#else
- [Deprecated (PlatformName.iOS, 15, 0, message: "Use 'SecKeyVerifySignature' instead.")]
- [Deprecated (PlatformName.MacCatalyst, 15, 0, message: "Use 'SecKeyVerifySignature' instead.")]
- [Deprecated (PlatformName.TvOS, 15, 0, message: "Use 'SecKeyVerifySignature' instead.")]
-#endif
[DllImport (Constants.SecurityLibrary)]
extern static SecStatusCode SecKeyRawVerify (IntPtr handle, SecPadding padding, IntPtr signedData, nint signedLen, IntPtr sign, nint signLen);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -1048,16 +912,16 @@ unsafe SecStatusCode _RawSign (SecPadding padding, IntPtr dataToSign, int dataTo
/// To be added.
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
+#if XAMCORE_5_0
+ [UnsupportedOSPlatform ("macos")]
+#else
[SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos", "Use 'VerifySignature' instead.")]
+#endif
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("maccatalyst15.0", "Use 'VerifySignature' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'VerifySignature' instead.")]
[ObsoletedOSPlatform ("tvos15.0", "Use 'VerifySignature' instead.")]
[ObsoletedOSPlatform ("ios15.0", "Use 'VerifySignature' instead.")]
-#else
- [Deprecated (PlatformName.iOS, 15, 0, message: "Use 'VerifySignature' instead.")]
- [Deprecated (PlatformName.MacCatalyst, 15, 0, message: "Use 'VerifySignature' instead.")]
- [Deprecated (PlatformName.TvOS, 15, 0, message: "Use 'VerifySignature' instead.")]
-#endif
public unsafe SecStatusCode RawVerify (SecPadding padding, IntPtr signedData, int signedDataLen, IntPtr signature, int signatureLen)
{
return SecKeyRawVerify (GetCheckedHandle (), padding, signedData, (nint) signedDataLen, signature, (nint) signatureLen);
@@ -1069,6 +933,18 @@ public unsafe SecStatusCode RawVerify (SecPadding padding, IntPtr signedData, in
/// To be added.
/// To be added.
/// To be added.
+ [SupportedOSPlatform ("ios")]
+ [SupportedOSPlatform ("maccatalyst")]
+#if XAMCORE_5_0
+ [UnsupportedOSPlatform ("macos")]
+#else
+ [SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos", "Use 'VerifySignature' instead.")]
+#endif
+ [SupportedOSPlatform ("tvos")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'VerifySignature' instead.")]
+ [ObsoletedOSPlatform ("tvos15.0", "Use 'VerifySignature' instead.")]
+ [ObsoletedOSPlatform ("ios15.0", "Use 'VerifySignature' instead.")]
public SecStatusCode RawVerify (SecPadding padding, byte [] signedData, byte [] signature)
{
if (signature is null)
@@ -1088,35 +964,28 @@ public SecStatusCode RawVerify (SecPadding padding, byte [] signedData, byte []
}
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("macos")]
+ [UnsupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
[ObsoletedOSPlatform ("tvos15.0", "Use 'SecKeyCreateEncryptedData' instead.")]
- [ObsoletedOSPlatform ("maccatalyst15.0", "Use 'SecKeyCreateEncryptedData' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'SecKeyCreateEncryptedData' instead.")]
[ObsoletedOSPlatform ("ios15.0", "Use 'SecKeyCreateEncryptedData' instead.")]
-#else
- [Deprecated (PlatformName.iOS, 15, 0, message: "Use 'SecKeyCreateEncryptedData' instead.")]
- [Deprecated (PlatformName.TvOS, 15, 0, message: "Use 'SecKeyCreateEncryptedData' instead.")]
- [Deprecated (PlatformName.MacCatalyst, 15, 0, message: "Use 'SecKeyCreateEncryptedData' instead.")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe extern static SecStatusCode SecKeyEncrypt (IntPtr handle, SecPadding padding, IntPtr plainText, nint plainTextLen, IntPtr cipherText, nint* cipherTextLengh);
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
+#if XAMCORE_5_0
+ [UnsupportedOSPlatform ("macos")]
+#else
[SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos", "Use 'CreateEncryptedData' instead.")]
+#endif
[SupportedOSPlatform ("tvos")]
[ObsoletedOSPlatform ("tvos15.0", "Use 'CreateEncryptedData' instead.")]
- [ObsoletedOSPlatform ("maccatalyst15.0", "Use 'CreateEncryptedData' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'CreateEncryptedData' instead.")]
[ObsoletedOSPlatform ("ios15.0", "Use 'CreateEncryptedData' instead.")]
-#else
- [Deprecated (PlatformName.iOS, 15, 0, message: "Use 'CreateEncryptedData' instead.")]
- [Deprecated (PlatformName.TvOS, 15, 0, message: "Use 'CreateEncryptedData' instead.")]
- [Deprecated (PlatformName.MacCatalyst, 15, 0, message: "Use 'CreateEncryptedData' instead.")]
-#endif
public unsafe SecStatusCode Encrypt (SecPadding padding, IntPtr plainText, nint plainTextLen, IntPtr cipherText, ref nint cipherTextLen)
{
return SecKeyEncrypt (GetCheckedHandle (), padding, plainText, plainTextLen, cipherText, (nint*) Unsafe.AsPointer (ref cipherTextLen));
@@ -1128,6 +997,18 @@ public unsafe SecStatusCode Encrypt (SecPadding padding, IntPtr plainText, nint
/// To be added.
/// To be added.
/// To be added.
+ [SupportedOSPlatform ("ios")]
+ [SupportedOSPlatform ("maccatalyst")]
+#if XAMCORE_5_0
+ [UnsupportedOSPlatform ("macos")]
+#else
+ [SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos", "Use 'CreateEncryptedData' instead.")]
+#endif
+ [SupportedOSPlatform ("tvos")]
+ [ObsoletedOSPlatform ("tvos15.0", "Use 'CreateEncryptedData' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'CreateEncryptedData' instead.")]
+ [ObsoletedOSPlatform ("ios15.0", "Use 'CreateEncryptedData' instead.")]
public SecStatusCode Encrypt (SecPadding padding, byte [] plainText, byte [] cipherText)
{
if (cipherText is null)
@@ -1149,46 +1030,63 @@ public SecStatusCode Encrypt (SecPadding padding, byte [] plainText, byte [] cip
/// To be added.
/// To be added.
/// To be added.
+ [SupportedOSPlatform ("ios")]
+ [SupportedOSPlatform ("maccatalyst")]
+#if XAMCORE_5_0
+ [UnsupportedOSPlatform ("macos")]
+#else
+ [SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos", "Use 'CreateEncryptedData' instead.")]
+#endif
+ [SupportedOSPlatform ("tvos")]
+ [ObsoletedOSPlatform ("tvos15.0", "Use 'CreateEncryptedData' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'CreateEncryptedData' instead.")]
+ [ObsoletedOSPlatform ("ios15.0", "Use 'CreateEncryptedData' instead.")]
public SecStatusCode Encrypt (SecPadding padding, byte [] plainText, out byte [] cipherText)
{
cipherText = new byte [BlockSize];
return Encrypt (padding, plainText, cipherText);
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
- [SupportedOSPlatform ("macos")]
+ [UnsupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
[ObsoletedOSPlatform ("tvos15.0", "Use 'SecKeyCreateDecryptedData' instead.")]
- [ObsoletedOSPlatform ("maccatalyst15.0", "Use 'SecKeyCreateDecryptedData' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'SecKeyCreateDecryptedData' instead.")]
[ObsoletedOSPlatform ("ios15.0", "Use 'SecKeyCreateDecryptedData' instead.")]
-#else
- [Deprecated (PlatformName.iOS, 15, 0, message: "Use 'SecKeyCreateDecryptedData' instead.")]
- [Deprecated (PlatformName.TvOS, 15, 0, message: "Use 'SecKeyCreateDecryptedData' instead.")]
- [Deprecated (PlatformName.MacCatalyst, 15, 0, message: "Use 'SecKeyCreateDecryptedData' instead.")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe extern static SecStatusCode SecKeyDecrypt (IntPtr handle, SecPadding padding, IntPtr cipherTextLen, nint cipherLen, IntPtr plainText, nint* plainTextLen);
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
+#if XAMCORE_5_0
+ [UnsupportedOSPlatform ("macos")]
+#else
[SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos", "Use 'CreateDecryptedData' instead.")]
+#endif
[SupportedOSPlatform ("tvos")]
[ObsoletedOSPlatform ("tvos15.0", "Use 'CreateDecryptedData' instead.")]
- [ObsoletedOSPlatform ("maccatalyst15.0", "Use 'CreateDecryptedData' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'CreateDecryptedData' instead.")]
[ObsoletedOSPlatform ("ios15.0", "Use 'CreateDecryptedData' instead.")]
-#else
- [Deprecated (PlatformName.iOS, 15, 0, message: "Use 'CreateDecryptedData' instead.")]
- [Deprecated (PlatformName.TvOS, 15, 0, message: "Use 'CreateDecryptedData' instead.")]
- [Deprecated (PlatformName.MacCatalyst, 15, 0, message: "Use 'CreateDecryptedData' instead.")]
-#endif
public unsafe SecStatusCode Decrypt (SecPadding padding, IntPtr cipherText, nint cipherTextLen, IntPtr plainText, ref nint plainTextLen)
{
return SecKeyDecrypt (GetCheckedHandle (), padding, cipherText, cipherTextLen, plainText, (nint*) Unsafe.AsPointer (ref plainTextLen));
}
+ [SupportedOSPlatform ("ios")]
+ [SupportedOSPlatform ("maccatalyst")]
+#if XAMCORE_5_0
+ [UnsupportedOSPlatform ("macos")]
+#else
+ [SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos", "Use 'CreateDecryptedData' instead.")]
+#endif
+ [SupportedOSPlatform ("tvos")]
+ [ObsoletedOSPlatform ("tvos15.0", "Use 'CreateDecryptedData' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'CreateDecryptedData' instead.")]
+ [ObsoletedOSPlatform ("ios15.0", "Use 'CreateDecryptedData' instead.")]
SecStatusCode _Decrypt (SecPadding padding, byte [] cipherText, ref byte []? plainText)
{
if (cipherText is null)
@@ -1215,22 +1113,32 @@ SecStatusCode _Decrypt (SecPadding padding, byte [] cipherText, ref byte []? pla
/// To be added.
/// To be added.
/// To be added.
+ [SupportedOSPlatform ("ios")]
+ [SupportedOSPlatform ("maccatalyst")]
+#if XAMCORE_5_0
+ [UnsupportedOSPlatform ("macos")]
+#else
+ [SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos", "Use 'CreateDecryptedData' instead.")]
+#endif
+ [SupportedOSPlatform ("tvos")]
+ [ObsoletedOSPlatform ("tvos15.0", "Use 'CreateDecryptedData' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'CreateDecryptedData' instead.")]
+ [ObsoletedOSPlatform ("ios15.0", "Use 'CreateDecryptedData' instead.")]
public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, out byte []? plainText)
{
plainText = null;
return _Decrypt (padding, cipherText, ref plainText);
}
+#endif // !(__MACOS__ && XAMCORE_5_0)
-#if NET
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe static extern IntPtr /* SecKeyRef _Nullable */ SecKeyCreateRandomKey (IntPtr /* CFDictionaryRef* */ parameters, IntPtr* /* CFErrorRef** */ error);
-#if NET
/// A dictionary of values, keyed by keys from .
/// A location in which to write codes for any errors that occur.
/// Creates and returns a new key pair.
@@ -1240,7 +1148,6 @@ public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, out byte [
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
static public SecKey? CreateRandomKey (NSDictionary parameters, out NSError? error)
{
if (parameters is null)
@@ -1256,7 +1163,6 @@ public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, out byte [
return key == IntPtr.Zero ? null : new SecKey (key, true);
}
-#if NET
/// Whether to create a DSA elliptic curve or RSA key.
/// To be added.
/// A dictionary of values, keyed by keys from .
@@ -1268,7 +1174,6 @@ public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, out byte [
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
static public SecKey? CreateRandomKey (SecKeyType keyType, int keySizeInBits, NSDictionary? parameters, out NSError? error)
{
using (var ks = new NSNumber (keySizeInBits))
@@ -1279,7 +1184,6 @@ public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, out byte [
}
}
-#if NET
/// A parameter object for specifying details about the key pair to create.
/// A location in which to write codes for any errors that occur.
/// Creates and returns a new key pair.
@@ -1289,7 +1193,6 @@ public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, out byte [
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
static public SecKey? CreateRandomKey (SecKeyGenerationParameters parameters, out NSError? error)
{
if (parameters is null)
@@ -1302,16 +1205,13 @@ public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, out byte [
}
}
-#if NET
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe static extern IntPtr /* SecKeyRef _Nullable */ SecKeyCreateWithData (IntPtr /* CFDataRef* */ keyData, IntPtr /* CFDictionaryRef* */ attributes, IntPtr* /* CFErrorRef** */ error);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -1322,7 +1222,6 @@ public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, out byte [
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
static public SecKey? Create (NSData keyData, NSDictionary parameters, out NSError? error)
{
if (keyData is null)
@@ -1341,7 +1240,6 @@ public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, out byte [
return key == IntPtr.Zero ? null : new SecKey (key, true);
}
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -1355,7 +1253,6 @@ public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, out byte [
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
static public SecKey? Create (NSData keyData, SecKeyType keyType, SecKeyClass keyClass, int keySizeInBits, NSDictionary parameters, out NSError? error)
{
using (var ks = new NSNumber (keySizeInBits))
@@ -1367,16 +1264,13 @@ public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, out byte [
}
}
-#if NET
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe static extern IntPtr /* CFDataRef _Nullable */ SecKeyCopyExternalRepresentation (IntPtr /* SecKeyRef* */ key, IntPtr* /* CFErrorRef** */ error);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -1385,7 +1279,6 @@ public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, out byte [
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public NSData? GetExternalRepresentation (out NSError? error)
{
IntPtr data;
@@ -1397,7 +1290,6 @@ public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, out byte [
return Runtime.GetNSObject (data, true);
}
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -1405,7 +1297,6 @@ public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, out byte [
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public NSData? GetExternalRepresentation ()
{
IntPtr data;
@@ -1416,16 +1307,13 @@ public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, out byte [
return Runtime.GetNSObject (data, true);
}
-#if NET
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern IntPtr /* CFDictionaryRef _Nullable */ SecKeyCopyAttributes (IntPtr /* SecKeyRef* */ key);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -1433,23 +1321,19 @@ public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, out byte [
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public NSDictionary? GetAttributes ()
{
var dict = SecKeyCopyAttributes (Handle);
return Runtime.GetNSObject (dict, true);
}
-#if NET
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern IntPtr /* SecKeyRef* */ SecKeyCopyPublicKey (IntPtr /* SecKeyRef* */ key);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -1457,23 +1341,19 @@ public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, out byte [
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public SecKey? GetPublicKey ()
{
var key = SecKeyCopyPublicKey (Handle);
return key == IntPtr.Zero ? null : new SecKey (key, true);
}
-#if NET
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern byte /* Boolean */ SecKeyIsAlgorithmSupported (IntPtr /* SecKeyRef* */ key, /* SecKeyOperationType */ nint operation, IntPtr /* SecKeyAlgorithm* */ algorithm);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -1483,22 +1363,18 @@ public SecStatusCode Decrypt (SecPadding padding, byte [] cipherText, out byte [
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public bool IsAlgorithmSupported (SecKeyOperationType operation, SecKeyAlgorithm algorithm)
{
return SecKeyIsAlgorithmSupported (Handle, (int) operation, algorithm.GetConstant ().GetHandle ()) != 0;
}
-#if NET
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe static extern /* CFDataRef _Nullable */ IntPtr SecKeyCreateSignature (/* SecKeyRef */ IntPtr key, /* SecKeyAlgorithm */ IntPtr algorithm, /* CFDataRef */ IntPtr dataToSign, /* CFErrorRef* */ IntPtr* error);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -1509,7 +1385,6 @@ public bool IsAlgorithmSupported (SecKeyOperationType operation, SecKeyAlgorithm
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public NSData? CreateSignature (SecKeyAlgorithm algorithm, NSData dataToSign, out NSError? error)
{
if (dataToSign is null)
@@ -1525,16 +1400,13 @@ public bool IsAlgorithmSupported (SecKeyOperationType operation, SecKeyAlgorithm
return Runtime.GetNSObject (data, true);
}
-#if NET
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe static extern /* Boolean */ byte SecKeyVerifySignature (/* SecKeyRef */ IntPtr key, /* SecKeyAlgorithm */ IntPtr algorithm, /* CFDataRef */ IntPtr signedData, /* CFDataRef */ IntPtr signature, /* CFErrorRef* */ IntPtr* error);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -1546,7 +1418,6 @@ public bool IsAlgorithmSupported (SecKeyOperationType operation, SecKeyAlgorithm
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public bool VerifySignature (SecKeyAlgorithm algorithm, NSData signedData, NSData signature, out NSError? error)
{
if (signedData is null)
@@ -1565,16 +1436,13 @@ public bool VerifySignature (SecKeyAlgorithm algorithm, NSData signedData, NSDat
return result;
}
-#if NET
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe static extern /* CFDataRef _Nullable */ IntPtr SecKeyCreateEncryptedData (/* SecKeyRef */ IntPtr key, /* SecKeyAlgorithm */ IntPtr algorithm, /* CFDataRef */ IntPtr plaintext, /* CFErrorRef* */ IntPtr* error);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -1585,7 +1453,6 @@ public bool VerifySignature (SecKeyAlgorithm algorithm, NSData signedData, NSDat
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public NSData? CreateEncryptedData (SecKeyAlgorithm algorithm, NSData plaintext, out NSError? error)
{
if (plaintext is null)
@@ -1601,16 +1468,13 @@ public bool VerifySignature (SecKeyAlgorithm algorithm, NSData signedData, NSDat
return Runtime.GetNSObject (data, true);
}
-#if NET
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe static extern /* CFDataRef _Nullable */ IntPtr SecKeyCreateDecryptedData (/* SecKeyRef */ IntPtr key, /* SecKeyAlgorithm */ IntPtr algorithm, /* CFDataRef */ IntPtr ciphertext, /* CFErrorRef* */ IntPtr* error);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -1621,7 +1485,6 @@ public bool VerifySignature (SecKeyAlgorithm algorithm, NSData signedData, NSDat
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public NSData? CreateDecryptedData (SecKeyAlgorithm algorithm, NSData ciphertext, out NSError? error)
{
if (ciphertext is null)
@@ -1637,16 +1500,13 @@ public bool VerifySignature (SecKeyAlgorithm algorithm, NSData signedData, NSDat
return Runtime.GetNSObject (data, true);
}
-#if NET
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe static extern /* CFDataRef _Nullable */ IntPtr SecKeyCopyKeyExchangeResult (/* SecKeyRef */ IntPtr privateKey, /* SecKeyAlgorithm */ IntPtr algorithm, /* SecKeyRef */ IntPtr publicKey, /* CFDictionaryRef */ IntPtr parameters, /* CFErrorRef* */ IntPtr* error);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -1658,7 +1518,6 @@ public bool VerifySignature (SecKeyAlgorithm algorithm, NSData signedData, NSDat
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public NSData? GetKeyExchangeResult (SecKeyAlgorithm algorithm, SecKey publicKey, NSDictionary parameters, out NSError? error)
{
if (publicKey is null)
@@ -1677,7 +1536,6 @@ public bool VerifySignature (SecKeyAlgorithm algorithm, NSData signedData, NSDat
return Runtime.GetNSObject (data, true);
}
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -1689,7 +1547,6 @@ public bool VerifySignature (SecKeyAlgorithm algorithm, NSData signedData, NSDat
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public NSData? GetKeyExchangeResult (SecKeyAlgorithm algorithm, SecKey publicKey, SecKeyKeyExchangeParameter parameters, out NSError? error)
{
if (parameters is null)
diff --git a/src/Security/Items.cs b/src/Security/Items.cs
index fc2d599a118b..6314e19e7a97 100644
--- a/src/Security/Items.cs
+++ b/src/Security/Items.cs
@@ -44,10 +44,6 @@
using UIKit;
#endif
-#if !NET
-using NativeHandle = System.IntPtr;
-#endif
-
namespace Security {
/// The kind of SecRecord.
@@ -80,35 +76,29 @@ public enum SecAccessible {
WhenUnlocked,
/// The data is only available after the first time the device has been unlocked after booting.
AfterFirstUnlock,
-#if NET
/// Always available.
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("macos10.14", "Use 'AfterFirstUnlock' or a better suited option instead.")]
- [ObsoletedOSPlatform ("ios12.0", "Use 'AfterFirstUnlock' or a better suited option instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 10, 14, message: "Use 'AfterFirstUnlock' or a better suited option instead.")]
- [Deprecated (PlatformName.iOS, 12, 0, message: "Use 'AfterFirstUnlock' or a better suited option instead.")]
-#endif
+ [ObsoletedOSPlatform ("macos", "Use 'AfterFirstUnlock' or a better suited option instead.")]
+ [ObsoletedOSPlatform ("ios", "Use 'AfterFirstUnlock' or a better suited option instead.")]
+ [ObsoletedOSPlatform ("tvos", "Use 'AfterFirstUnlock' or a better suited option instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'AfterFirstUnlock' or a better suited option instead.")]
Always,
/// Limits access to the item to this device and the device being unlocked.
WhenUnlockedThisDeviceOnly,
/// The data is only available after the first time the device has been unlocked after booting.
AfterFirstUnlockThisDeviceOnly,
-#if NET
/// Always available.
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("macos10.14", "Use 'AfterFirstUnlockThisDeviceOnly' or a better suited option instead.")]
- [ObsoletedOSPlatform ("ios12.0", "Use 'AfterFirstUnlockThisDeviceOnly' or a better suited option instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 10, 14, message: "Use 'AfterFirstUnlockThisDeviceOnly' or a better suited option instead.")]
- [Deprecated (PlatformName.iOS, 12, 0, message: "Use 'AfterFirstUnlockThisDeviceOnly' or a better suited option instead.")]
-#endif
+ [ObsoletedOSPlatform ("macos", "Use 'AfterFirstUnlockThisDeviceOnly' or a better suited option instead.")]
+ [ObsoletedOSPlatform ("ios", "Use 'AfterFirstUnlockThisDeviceOnly' or a better suited option instead.")]
+ [ObsoletedOSPlatform ("tvos", "Use 'AfterFirstUnlockThisDeviceOnly' or a better suited option instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'AfterFirstUnlockThisDeviceOnly' or a better suited option instead.")]
AlwaysThisDeviceOnly,
/// Limits access to the item to both this device and requires a passcode to be set and the data is only available if the device is currently unlocked.
WhenPasscodeSetThisDeviceOnly,
@@ -209,13 +199,11 @@ public enum SecAuthenticationType {
Default = 1953261156,
}
-#if NET
///
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
-#endif
public class SecKeyChain : INativeObject {
internal SecKeyChain (NativeHandle handle)
@@ -455,11 +443,11 @@ public static SecStatusCode Update (SecRecord query, SecRecord newAttributes)
}
#if MONOMAC
-#if NET
- [ObsoletedOSPlatform ("macos10.10")]
-#else
- [Deprecated (PlatformName.MacOSX, 10,10)]
-#endif
+ [SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos")]
+ [UnsupportedOSPlatform ("ios")]
+ [UnsupportedOSPlatform ("tvos")]
+ [UnsupportedOSPlatform ("maccatalyst")]
[DllImport (Constants.SecurityLibrary)]
extern static SecStatusCode SecKeychainAddGenericPassword (
IntPtr keychain,
@@ -471,11 +459,11 @@ extern static SecStatusCode SecKeychainAddGenericPassword (
byte [] passwordData,
IntPtr itemRef);
-#if NET
- [ObsoletedOSPlatform ("macos10.10")]
-#else
- [Deprecated (PlatformName.MacOSX, 10,10)]
-#endif
+ [SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos")]
+ [UnsupportedOSPlatform ("ios")]
+ [UnsupportedOSPlatform ("tvos")]
+ [UnsupportedOSPlatform ("maccatalyst")]
[DllImport (Constants.SecurityLibrary)]
unsafe extern static SecStatusCode SecKeychainFindGenericPassword (
IntPtr keychainOrArray,
@@ -487,11 +475,11 @@ unsafe extern static SecStatusCode SecKeychainFindGenericPassword (
IntPtr* passwordData,
IntPtr itemRef);
-#if NET
- [ObsoletedOSPlatform ("macos10.10")]
-#else
- [Deprecated (PlatformName.MacOSX, 10,10)]
-#endif
+ [SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos")]
+ [UnsupportedOSPlatform ("ios")]
+ [UnsupportedOSPlatform ("tvos")]
+ [UnsupportedOSPlatform ("maccatalyst")]
[DllImport (Constants.SecurityLibrary)]
extern static SecStatusCode SecKeychainAddInternetPassword (
IntPtr keychain,
@@ -510,11 +498,11 @@ extern static SecStatusCode SecKeychainAddInternetPassword (
byte [] passwordData,
IntPtr itemRef);
-#if NET
- [ObsoletedOSPlatform ("macos10.10")]
-#else
- [Deprecated (PlatformName.MacOSX, 10,10)]
-#endif
+ [SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos")]
+ [UnsupportedOSPlatform ("ios")]
+ [UnsupportedOSPlatform ("tvos")]
+ [UnsupportedOSPlatform ("maccatalyst")]
[DllImport (Constants.SecurityLibrary)]
unsafe extern static SecStatusCode SecKeychainFindInternetPassword (
IntPtr keychain,
@@ -533,11 +521,11 @@ unsafe extern static SecStatusCode SecKeychainFindInternetPassword (
IntPtr* passwordData,
IntPtr itemRef);
-#if NET
- [ObsoletedOSPlatform ("macos10.10")]
-#else
- [Deprecated (PlatformName.MacOSX, 10,10)]
-#endif
+ [SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos")]
+ [UnsupportedOSPlatform ("ios")]
+ [UnsupportedOSPlatform ("tvos")]
+ [UnsupportedOSPlatform ("maccatalyst")]
[DllImport (Constants.SecurityLibrary)]
extern static SecStatusCode SecKeychainItemFreeContent (IntPtr attrList, IntPtr data);
@@ -552,6 +540,11 @@ unsafe extern static SecStatusCode SecKeychainFindInternetPassword (
/// To be added.
/// To be added.
/// To be added.
+ [SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos")]
+ [UnsupportedOSPlatform ("ios")]
+ [UnsupportedOSPlatform ("tvos")]
+ [UnsupportedOSPlatform ("maccatalyst")]
public static SecStatusCode AddInternetPassword (
string serverName,
string accountName,
@@ -609,6 +602,11 @@ public static SecStatusCode AddInternetPassword (
/// To be added.
/// To be added.
/// To be added.
+ [SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos")]
+ [UnsupportedOSPlatform ("ios")]
+ [UnsupportedOSPlatform ("tvos")]
+ [UnsupportedOSPlatform ("maccatalyst")]
public static SecStatusCode FindInternetPassword (
string serverName,
string accountName,
@@ -690,6 +688,11 @@ public static SecStatusCode FindInternetPassword (
/// To be added.
/// To be added.
/// To be added.
+ [SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos")]
+ [UnsupportedOSPlatform ("ios")]
+ [UnsupportedOSPlatform ("tvos")]
+ [UnsupportedOSPlatform ("maccatalyst")]
public static SecStatusCode AddGenericPassword (string serviceName, string accountName, byte [] password)
{
byte []? serviceNameBytes = null;
@@ -719,6 +722,11 @@ public static SecStatusCode AddGenericPassword (string serviceName, string accou
/// To be added.
/// To be added.
/// To be added.
+ [SupportedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("macos")]
+ [UnsupportedOSPlatform ("ios")]
+ [UnsupportedOSPlatform ("tvos")]
+ [UnsupportedOSPlatform ("maccatalyst")]
public static SecStatusCode FindGenericPassword (string serviceName, string accountName, out byte []? password)
{
password = null;
@@ -875,7 +883,6 @@ public static void RemoveIdentity (SecIdentity identity)
}
}
-#if NET
/// Tracks a set of properties from the keychain.
///
///
@@ -903,7 +910,6 @@ public static void RemoveIdentity (SecIdentity identity)
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
-#endif
public class SecRecord : IDisposable {
// Fix <= iOS 6 Behaviour - Desk #83099
// NSCFDictionary: mutating method sent to immutable object
@@ -1144,7 +1150,6 @@ public bool SynchronizableAny {
}
#if !MONOMAC
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -1152,7 +1157,6 @@ public bool SynchronizableAny {
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
[UnsupportedOSPlatform ("macos")]
-#endif
public string? SyncViewHint {
get {
return FetchString (SecAttributeKey.SyncViewHint);
@@ -1162,7 +1166,6 @@ public string? SyncViewHint {
}
}
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -1170,7 +1173,6 @@ public string? SyncViewHint {
[SupportedOSPlatform ("maccatalyst")]
[UnsupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
-#endif
public SecTokenID TokenID {
get {
return SecTokenIDExtensions.GetValue (Fetch (SecKeyGenerationAttributeKeys.TokenIDKey.GetHandle ())!);
@@ -1303,7 +1305,7 @@ public bool IsNegative {
}
}
- /// Accout name.
+ /// Account name.
///
/// Used by GenericPassword and InternetPassword kinds.
public string? Account {
@@ -1335,6 +1337,13 @@ public string? Service {
///
///
/// Set this value to a string that will be displayed to the user when the authentication takes place for the item to give the user some context for the request.
+ [SupportedOSPlatform ("ios")]
+ [UnsupportedOSPlatform ("macos")]
+ [SupportedOSPlatform ("tvos")]
+ [SupportedOSPlatform ("maccatalyst")]
+ [ObsoletedOSPlatform ("ios14.0", "Use 'LAContext.InteractionNotAllowed' instead.")]
+ [ObsoletedOSPlatform ("tvos14.0", "Use 'LAContext.InteractionNotAllowed' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'LAContext.InteractionNotAllowed' instead.")]
public string? UseOperationPrompt {
get {
return FetchString (SecItem.UseOperationPrompt);
@@ -1344,7 +1353,6 @@ public string? UseOperationPrompt {
}
}
-#if NET
/// Developers should not use this deprecated property. Developers should use AuthenticationUI property
///
///
@@ -1354,10 +1362,9 @@ public string? UseOperationPrompt {
[SupportedOSPlatform ("maccatalyst")]
[UnsupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("ios9.0", "Use 'AuthenticationUI' property instead.")]
-#else
- [Deprecated (PlatformName.iOS, 9, 0, message: "Use 'AuthenticationUI' property instead.")]
-#endif
+ [ObsoletedOSPlatform ("tvos", "Use 'AuthenticationUI' property instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'AuthenticationUI' property instead.")]
+ [ObsoletedOSPlatform ("ios", "Use 'AuthenticationUI' property instead.")]
public bool UseNoAuthenticationUI {
get {
return Fetch (SecItem.UseNoAuthenticationUI) == CFBoolean.TrueHandle;
@@ -1367,7 +1374,6 @@ public bool UseNoAuthenticationUI {
}
}
#endif
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -1375,7 +1381,6 @@ public bool UseNoAuthenticationUI {
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
public SecAuthenticationUI AuthenticationUI {
get {
var s = Fetch (SecItem.UseAuthenticationUI);
@@ -1387,7 +1392,6 @@ public SecAuthenticationUI AuthenticationUI {
}
#if !TVOS
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -1395,7 +1399,6 @@ public SecAuthenticationUI AuthenticationUI {
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[UnsupportedOSPlatform ("tvos")]
-#endif
public LocalAuthentication.LAContext? AuthenticationContext {
get {
return Fetch (SecItem.UseAuthenticationContext);
@@ -1831,7 +1834,6 @@ public string? AccessGroup {
}
}
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -1839,7 +1841,6 @@ public string? AccessGroup {
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public bool PersistentReference {
get {
return Fetch (SecAttributeKey.PersistentReference) == CFBoolean.TrueHandle;
@@ -1849,15 +1850,10 @@ public bool PersistentReference {
}
}
-#if NET
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [iOS (13, 0)]
- [TV (13, 0)]
-#endif
public bool UseDataProtectionKeychain {
get {
return Fetch (SecItem.UseDataProtectionKeychain) == CFBoolean.TrueHandle;
@@ -2091,14 +2087,18 @@ public static IntPtr FromSecAccessible (SecAccessible accessible)
return WhenUnlocked;
case SecAccessible.AfterFirstUnlock:
return AfterFirstUnlock;
+#pragma warning disable CA1422 // This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecAccessible.Always' is obsoleted on: 'ios' 12.0 and later (Use 'AfterFirstUnlock' or a better suited option instead.), 'maccatalyst' 12.0 and later (Use 'AfterFirstUnlock' or a better suited option instead.), 'macOS/OSX' 10.14 and later (Use 'AfterFirstUnlock' or a better suited option instead.).
case SecAccessible.Always:
return Always;
+#pragma warning restore CA1422
case SecAccessible.WhenUnlockedThisDeviceOnly:
return WhenUnlockedThisDeviceOnly;
case SecAccessible.AfterFirstUnlockThisDeviceOnly:
return AfterFirstUnlockThisDeviceOnly;
+#pragma warning disable CA1422 // This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecAccessible.AlwaysThisDeviceOnly' is obsoleted on: 'ios' 12.0 and later (Use 'AfterFirstUnlockThisDeviceOnly' or a better suited option instead.), 'maccatalyst' 12.0 and later (Use 'AfterFirstUnlockThisDeviceOnly' or a better suited option instead.), 'macOS/OSX' 10.14 and later (Use 'AfterFirstUnlockThisDeviceOnly' or a better suited option instead.).
case SecAccessible.AlwaysThisDeviceOnly:
return AlwaysThisDeviceOnly;
+#pragma warning restore CA1422
case SecAccessible.WhenPasscodeSetThisDeviceOnly:
return WhenPasscodeSetThisDeviceOnly;
default:
@@ -2116,14 +2116,18 @@ public static SecAccessible ToSecAccessible (IntPtr handle)
return SecAccessible.WhenUnlocked;
if (CFType.Equal (handle, AfterFirstUnlock))
return SecAccessible.AfterFirstUnlock;
+#pragma warning disable CA1422 // This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecAccessible.Always' is obsoleted on: 'ios' 12.0 and later (Use 'AfterFirstUnlock' or a better suited option instead.), 'maccatalyst' 12.0 and later (Use 'AfterFirstUnlock' or a better suited option instead.), 'macOS/OSX' 10.14 and later (Use 'AfterFirstUnlock' or a better suited option instead.).
if (CFType.Equal (handle, Always))
return SecAccessible.Always;
+#pragma warning restore CA1422
if (CFType.Equal (handle, WhenUnlockedThisDeviceOnly))
return SecAccessible.WhenUnlockedThisDeviceOnly;
if (CFType.Equal (handle, AfterFirstUnlockThisDeviceOnly))
return SecAccessible.AfterFirstUnlockThisDeviceOnly;
+#pragma warning disable CA1422 // This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecAccessible.AlwaysThisDeviceOnly' is obsoleted on: 'ios' 12.0 and later (Use 'AfterFirstUnlockThisDeviceOnly' or a better suited option instead.), 'maccatalyst' 12.0 and later (Use 'AfterFirstUnlockThisDeviceOnly' or a better suited option instead.), 'macOS/OSX' 10.14 and later (Use 'AfterFirstUnlockThisDeviceOnly' or a better suited option instead.).
if (CFType.Equal (handle, AlwaysThisDeviceOnly))
return SecAccessible.AlwaysThisDeviceOnly;
+#pragma warning restore CA1422
if (CFType.Equal (handle, WhenUnlockedThisDeviceOnly))
return SecAccessible.WhenUnlockedThisDeviceOnly;
return SecAccessible.Invalid;
@@ -2288,14 +2292,12 @@ public static IntPtr FromSecAuthenticationType (SecAuthenticationType type)
}
}
-#if NET
/// An exception based on a .
/// To be added.
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
-#endif
public class SecurityException : Exception {
static string ToMessage (SecStatusCode code)
{
@@ -2329,7 +2331,6 @@ public partial class SecKeyParameters : DictionaryContainer {
// For caching, as we can't reverse it easily.
SecAccessControl? _secAccessControl;
-#if NET
/// Gets or sets the access control for the new key.
/// The access control for the new key.
/// To be added.
@@ -2337,7 +2338,6 @@ public partial class SecKeyParameters : DictionaryContainer {
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
public SecAccessControl AccessControl {
get {
return _secAccessControl!;
@@ -2376,7 +2376,6 @@ public SecKeyType KeyType {
// For caching, as we can't reverse it easily.
SecAccessControl? _secAccessControl;
-#if NET
/// Gets or sets the access control for the new key.
/// The access control for the new key.
/// To be added.
@@ -2384,7 +2383,6 @@ public SecKeyType KeyType {
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
public SecAccessControl AccessControl {
get {
return _secAccessControl!;
@@ -2398,7 +2396,6 @@ public SecAccessControl AccessControl {
}
}
-#if NET
/// Gets or sets the token ID.
/// The token ID.
/// To be added.
@@ -2406,7 +2403,6 @@ public SecAccessControl AccessControl {
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
public SecTokenID TokenID {
get {
return SecTokenIDExtensions.GetValue (GetNSStringValue (SecKeyGenerationAttributeKeys.TokenIDKey)!);
diff --git a/src/Security/Policy.cs b/src/Security/Policy.cs
index 2841129807bd..d95f09bbbaff 100644
--- a/src/Security/Policy.cs
+++ b/src/Security/Policy.cs
@@ -36,22 +36,11 @@
using CoreFoundation;
using Foundation;
-#if !NET
-using NativeHandle = System.IntPtr;
-#endif
-
namespace Security {
/// Encapsulates a security policy. A policy comprises a set of rules that specify how to evaluate a certificate for a certain level of trust.
/// To be added.
public partial class SecPolicy : NativeObject {
-#if !NET
- public SecPolicy (NativeHandle handle)
- : base (handle, false, true)
- {
- }
-#endif
-
[Preserve (Conditional = true)]
internal SecPolicy (NativeHandle handle, bool owns)
: base (handle, owns, true)
@@ -101,39 +90,5 @@ static public SecPolicy CreateBasicX509Policy ()
///
[DllImport (Constants.SecurityLibrary, EntryPoint = "SecPolicyGetTypeID")]
public extern static nint GetTypeID ();
-
-#if !NET
- public static bool operator == (SecPolicy? a, SecPolicy? b)
- {
- if (a is null)
- return b is null;
- else if (b is null)
- return false;
-
- return a.Handle == b.Handle;
- }
-
- public static bool operator != (SecPolicy? a, SecPolicy? b)
- {
- if (a is null)
- return b is not null;
- else if (b is null)
- return true;
- return a.Handle != b.Handle;
- }
-
- // For the .net profile `DisposableObject` implements both
- // `Equals` and `GetHashCode` based on the Handle property.
- public override bool Equals (object? other)
- {
- var o = other as SecPolicy;
- return this == o;
- }
-
- public override int GetHashCode ()
- {
- return ((IntPtr) Handle).ToInt32 ();
- }
-#endif
}
}
diff --git a/src/Security/SecAccessControl.cs b/src/Security/SecAccessControl.cs
index 054634236bac..2babeb1111f8 100644
--- a/src/Security/SecAccessControl.cs
+++ b/src/Security/SecAccessControl.cs
@@ -21,150 +21,107 @@
using CoreFoundation;
using Foundation;
-#if !NET
-using NativeHandle = System.IntPtr;
-#endif
-
namespace Security {
/// Contains access control flags for creating keychain entries.
/// To be added.
[Flags]
[Native]
-#if NET
// changed to CFOptionFlags in Xcode 8 SDK
public enum SecAccessControlCreateFlags : ulong {
-#else
- // CFOptionFlags -> SecAccessControl.h
- public enum SecAccessControlCreateFlags : long {
-#endif
/// Requires the user to validate, either biometrically or via the device passcode.
UserPresence = 1 << 0,
-#if NET
/// Developers should use instead.
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
[Advice ("'BiometryAny' is preferred over 'TouchIDAny' since Xcode 9.3. Touch ID and Face ID together are biometric authentication mechanisms.")]
TouchIDAny = BiometryAny,
-#if NET
/// Developers should use instead.
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
[Advice ("'BiometryCurrentSet' is preferred over 'TouchIDCurrentSet' since Xcode 9.3. Touch ID and Face ID together are biometric authentication mechanisms.")]
TouchIDCurrentSet = BiometryCurrentSet,
// Added in iOS 11.3 and macOS 10.13.4 but keeping initial availability attribute because it's using the value
// of 'TouchIDAny' which iOS 9 / macOS 10.12.1 will accept.
-#if NET
/// Require any biometric for access.
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
BiometryAny = 1 << 1,
// Added in iOS 11.3 and macOS 10.13.4 but keeping initial availability attribute because it's using the value
// of 'TouchIDCurrentSet' which iOS 9 / macOS 10.12.1 will accept.
-#if NET
/// Require the currently set biometric for access.
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
BiometryCurrentSet = 1 << 3,
-#if NET
/// Validation via the device passcode.
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
DevicePasscode = 1 << 4,
-#if NET
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[ObsoletedOSPlatform ("macos", "Use 'Companion' instead.")]
[ObsoletedOSPlatform ("maccatalyst", "Use 'Companion' instead.")]
[UnsupportedOSPlatform ("ios")]
[UnsupportedOSPlatform ("tvos")]
-#else
- [NoiOS]
- [NoTV]
-#endif
Watch = 1 << 5,
-#if NET
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[UnsupportedOSPlatform ("ios")]
[UnsupportedOSPlatform ("tvos")]
-#else
- [NoiOS]
- [NoTV]
-#endif
Companion = 1 << 5,
-#if NET
/// An "OR" operation applied to other flags.
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
Or = 1 << 14,
-#if NET
/// An "And" operation applied to other flags.
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
And = 1 << 15,
-#if NET
/// Require a private key for access.
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
PrivateKeyUsage = 1 << 30,
-#if NET
/// Require an application password for access.
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
-#if NET
ApplicationPassword = 1UL << 31,
-#else
- ApplicationPassword = 1 << 31,
-#endif
}
-#if NET
/// Class that contains accessibility flags and access control object creation flags.
/// To be added.
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
public partial class SecAccessControl : NativeObject {
#if !COREBUILD
[Preserve (Conditional = true)]
diff --git a/src/Security/SecCertificate2.cs b/src/Security/SecCertificate2.cs
index ffbd1ffe7798..e7281ef3d964 100644
--- a/src/Security/SecCertificate2.cs
+++ b/src/Security/SecCertificate2.cs
@@ -21,27 +21,16 @@
using Foundation;
using CoreFoundation;
-#if !NET
-using NativeHandle = System.IntPtr;
-#endif
-
namespace Security {
-
-#if NET
/// To be added.
/// To be added.
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public class SecCertificate2 : NativeObject {
[Preserve (Conditional = true)]
-#if NET
internal SecCertificate2 (NativeHandle handle, bool owns) : base (handle, owns) { }
-#else
- public SecCertificate2 (NativeHandle handle, bool owns) : base (handle, owns) { }
-#endif
[DllImport (Constants.SecurityLibrary)]
extern static IntPtr sec_certificate_create (IntPtr seccertificateHandle);
diff --git a/src/Security/SecIdentity2.cs b/src/Security/SecIdentity2.cs
index f627bef47836..5487fdee14ef 100644
--- a/src/Security/SecIdentity2.cs
+++ b/src/Security/SecIdentity2.cs
@@ -21,29 +21,16 @@
using Foundation;
using CoreFoundation;
-#if !NET
-using NativeHandle = System.IntPtr;
-#endif
-
namespace Security {
-
-#if NET
/// To be added.
/// To be added.
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public class SecIdentity2 : NativeObject {
-#if NET
[Preserve (Conditional = true)]
internal SecIdentity2 (NativeHandle handle, bool owns) : base (handle, owns) { }
-#else
- internal SecIdentity2 (NativeHandle handle) : base (handle, false) { }
- [Preserve (Conditional = true)]
- public SecIdentity2 (NativeHandle handle, bool owns) : base (handle, owns) { }
-#endif
#if !COREBUILD
[DllImport (Constants.SecurityLibrary)]
@@ -106,26 +93,14 @@ public SecCertificate [] Certificates {
}
}
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe static extern byte sec_identity_access_certificates (IntPtr identity, BlockLiteral* block);
-#if !NET
- internal delegate void AccessCertificatesHandler (IntPtr block, IntPtr cert);
- static readonly AccessCertificatesHandler access = TrampolineAccessCertificates;
-
- [MonoPInvokeCallback (typeof (AccessCertificatesHandler))]
-#else
[UnmanagedCallersOnly]
-#endif
static void TrampolineAccessCertificates (IntPtr block, IntPtr cert)
{
var del = BlockLiteral.GetTarget> (block);
@@ -133,15 +108,10 @@ static void TrampolineAccessCertificates (IntPtr block, IntPtr cert)
del (new SecCertificate2 (cert, false));
}
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
// no [Async] as it can be called multiple times
[BindingImpl (BindingImplOptions.Optimizable)]
public bool AccessCertificates (Action* sec_identity_t */SecCertificate2> handler)
@@ -150,13 +120,8 @@ public bool AccessCertificates (Action* sec_identity_t */SecCertificate2> hand
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (handler));
unsafe {
-#if NET
delegate* unmanaged trampoline = &TrampolineAccessCertificates;
using var block = new BlockLiteral (trampoline, handler, typeof (SecIdentity2), nameof (TrampolineAccessCertificates));
-#else
- using var block = new BlockLiteral ();
- block.SetupBlockUnsafe (access, handler);
-#endif
return sec_identity_access_certificates (GetCheckedHandle (), &block) != 0;
}
}
diff --git a/src/Security/SecPolicy.cs b/src/Security/SecPolicy.cs
index 6ef166267c1c..b1212f3d96ef 100644
--- a/src/Security/SecPolicy.cs
+++ b/src/Security/SecPolicy.cs
@@ -20,17 +20,13 @@ namespace Security {
/// Encapsulates a security policy. A policy comprises a set of rules that specify how to evaluate a certificate for a certain level of trust.
/// To be added.
public partial class SecPolicy {
-
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
-#endif
[DllImport (Constants.SecurityLibrary)]
extern static IntPtr /* __nullable CFDictionaryRef */ SecPolicyCopyProperties (IntPtr /* SecPolicyRef */ policyRef);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -38,23 +34,19 @@ public partial class SecPolicy {
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
-#endif
public NSDictionary? GetProperties ()
{
var dict = SecPolicyCopyProperties (Handle);
return Runtime.GetNSObject (dict, true);
}
-#if NET
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
[DllImport (Constants.SecurityLibrary)]
extern static IntPtr /* __nullable SecPolicyRef */ SecPolicyCreateRevocation (/* CFOptionFlags */ nuint revocationFlags);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -63,23 +55,19 @@ public partial class SecPolicy {
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
static public SecPolicy? CreateRevocationPolicy (SecRevocation revocationFlags)
{
var policy = SecPolicyCreateRevocation ((nuint) (ulong) revocationFlags);
return policy == IntPtr.Zero ? null : new SecPolicy (policy, true);
}
-#if NET
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
[DllImport (Constants.SecurityLibrary)]
extern static IntPtr /* __nullable SecPolicyRef */ SecPolicyCreateWithProperties (IntPtr /* CFTypeRef */ policyIdentifier, IntPtr /* CFDictionaryRef */ properties);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -89,7 +77,6 @@ public partial class SecPolicy {
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
static public SecPolicy CreatePolicy (NSString policyIdentifier, NSDictionary properties)
{
if (policyIdentifier is null)
diff --git a/src/Security/SecProtocolMetadata.cs b/src/Security/SecProtocolMetadata.cs
index f37cde4ffb8d..2e9b4fa77ab1 100644
--- a/src/Security/SecProtocolMetadata.cs
+++ b/src/Security/SecProtocolMetadata.cs
@@ -19,24 +19,14 @@
using sec_protocol_metadata_t = System.IntPtr;
using dispatch_queue_t = System.IntPtr;
-#if !NET
-using NativeHandle = System.IntPtr;
-#endif
-
namespace Security {
-#if NET
/// To be added.
/// To be added.
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public class SecProtocolMetadata : NativeObject {
-#if !NET
- internal SecProtocolMetadata (NativeHandle handle) : base (handle, false) { }
-#endif
-
// This type is only ever surfaced in response to callbacks in TLS/Network and documented as read-only
// if this ever changes, make this public[tv
[Preserve (Conditional = true)]
@@ -59,23 +49,17 @@ internal SecProtocolMetadata (NativeHandle handle, bool owns) : base (handle, ow
/// To be added.
public DispatchData? PeerPublicKey => CreateDispatchData (sec_protocol_metadata_copy_peer_public_key (GetCheckedHandle ()));
-#if NET
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'NegotiatedTlsProtocolVersion' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'NegotiatedTlsProtocolVersion' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'NegotiatedTlsProtocolVersion' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'NegotiatedTlsProtocolVersion' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'NegotiatedTlsProtocolVersion' instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'NegotiatedTlsProtocolVersion' instead.")]
- [Deprecated (PlatformName.iOS, 13, 0, message: "Use 'NegotiatedTlsProtocolVersion' instead.")]
- [Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'NegotiatedTlsProtocolVersion' instead.")]
-#endif
[DllImport (Constants.SecurityLibrary)]
extern static SslProtocol sec_protocol_metadata_get_negotiated_protocol_version (IntPtr handle);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -83,77 +67,38 @@ internal SecProtocolMetadata (NativeHandle handle, bool owns) : base (handle, ow
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'NegotiatedTlsProtocolVersion' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'NegotiatedTlsProtocolVersion' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'NegotiatedTlsProtocolVersion' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'NegotiatedTlsProtocolVersion' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'NegotiatedTlsProtocolVersion' instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'NegotiatedTlsProtocolVersion' instead.")]
- [Deprecated (PlatformName.iOS, 13, 0, message: "Use 'NegotiatedTlsProtocolVersion' instead.")]
- [Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'NegotiatedTlsProtocolVersion' instead.")]
-#endif
public SslProtocol NegotiatedProtocolVersion => sec_protocol_metadata_get_negotiated_protocol_version (GetCheckedHandle ());
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern TlsProtocolVersion sec_protocol_metadata_get_negotiated_tls_protocol_version (IntPtr handle);
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
public TlsProtocolVersion NegotiatedTlsProtocolVersion => sec_protocol_metadata_get_negotiated_tls_protocol_version (GetCheckedHandle ());
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern TlsCipherSuite sec_protocol_metadata_get_negotiated_tls_ciphersuite (IntPtr handle);
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
public TlsCipherSuite NegotiatedTlsCipherSuite => sec_protocol_metadata_get_negotiated_tls_ciphersuite (GetCheckedHandle ());
-#if !NET
- [Deprecated (PlatformName.iOS, 13, 0, message: "Use 'NegotiatedTlsCipherSuite' instead.")]
- [Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'NegotiatedTlsCipherSuite' instead.")]
- [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'NegotiatedTlsCipherSuite' instead.")]
- [DllImport (Constants.SecurityLibrary)]
- extern static SslCipherSuite sec_protocol_metadata_get_negotiated_ciphersuite (IntPtr handle);
-#endif
-
-#if !NET
- [Deprecated (PlatformName.iOS, 13, 0, message: "Use 'NegotiatedTlsCipherSuite' instead.")]
- [Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'NegotiatedTlsCipherSuite' instead.")]
- [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'NegotiatedTlsCipherSuite' instead.")]
- public SslCipherSuite NegotiatedCipherSuite => sec_protocol_metadata_get_negotiated_ciphersuite (GetCheckedHandle ());
-#endif
-
[DllImport (Constants.SecurityLibrary)]
extern static byte sec_protocol_metadata_get_early_data_accepted (IntPtr handle);
@@ -202,14 +147,7 @@ public static bool PeersAreEqual (SecProtocolMetadata metadataA, SecProtocolMeta
return result;
}
-#if !NET
- delegate void sec_protocol_metadata_access_distinguished_names_handler_t (IntPtr block, IntPtr dispatchData);
- static sec_protocol_metadata_access_distinguished_names_handler_t static_DistinguishedNamesForPeer = TrampolineDistinguishedNamesForPeer;
-
- [MonoPInvokeCallback (typeof (sec_protocol_metadata_access_distinguished_names_handler_t))]
-#else
[UnmanagedCallersOnly]
-#endif
static void TrampolineDistinguishedNamesForPeer (IntPtr block, IntPtr data)
{
var del = BlockLiteral.GetTarget> (block);
@@ -232,26 +170,14 @@ public void SetDistinguishedNamesForPeerHandler (Action callback)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (callback));
unsafe {
-#if NET
delegate* unmanaged trampoline = &TrampolineDistinguishedNamesForPeer;
using var block = new BlockLiteral (trampoline, callback, typeof (SecProtocolMetadata), nameof (TrampolineDistinguishedNamesForPeer));
-#else
- using var block = new BlockLiteral ();
- block.SetupBlockUnsafe (static_DistinguishedNamesForPeer, callback);
-#endif
if (sec_protocol_metadata_access_distinguished_names (GetCheckedHandle (), &block) == 0)
throw new InvalidOperationException ("Distinguished names are not accessible.");
}
}
-#if !NET
- delegate void sec_protocol_metadata_access_ocsp_response_handler_t (IntPtr block, IntPtr dispatchData);
- static sec_protocol_metadata_access_ocsp_response_handler_t static_OcspReposeForPeer = TrampolineOcspReposeForPeer;
-
- [MonoPInvokeCallback (typeof (sec_protocol_metadata_access_ocsp_response_handler_t))]
-#else
[UnmanagedCallersOnly]
-#endif
static void TrampolineOcspReposeForPeer (IntPtr block, IntPtr data)
{
var del = BlockLiteral.GetTarget> (block);
@@ -274,26 +200,14 @@ public void SetOcspResponseForPeerHandler (Action callback)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (callback));
unsafe {
-#if NET
delegate* unmanaged trampoline = &TrampolineOcspReposeForPeer;
using var block = new BlockLiteral (trampoline, callback, typeof (SecProtocolMetadata), nameof (TrampolineOcspReposeForPeer));
-#else
- using var block = new BlockLiteral ();
- block.SetupBlockUnsafe (static_OcspReposeForPeer, callback);
-#endif
if (sec_protocol_metadata_access_ocsp_response (GetCheckedHandle (), &block) == 0)
throw new InvalidOperationException ("The OSCP response is not accessible.");
}
}
-#if !NET
- delegate void sec_protocol_metadata_access_peer_certificate_chain_handler_t (IntPtr block, IntPtr certificate);
- static sec_protocol_metadata_access_peer_certificate_chain_handler_t static_CertificateChainForPeer = TrampolineCertificateChainForPeer;
-
- [MonoPInvokeCallback (typeof (sec_protocol_metadata_access_peer_certificate_chain_handler_t))]
-#else
[UnmanagedCallersOnly]
-#endif
static void TrampolineCertificateChainForPeer (IntPtr block, IntPtr certificate)
{
var del = BlockLiteral.GetTarget> (block);
@@ -316,26 +230,14 @@ public void SetCertificateChainForPeerHandler (Action callback)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (callback));
unsafe {
-#if NET
delegate* unmanaged trampoline = &TrampolineCertificateChainForPeer;
using var block = new BlockLiteral (trampoline, callback, typeof (SecProtocolMetadata), nameof (TrampolineCertificateChainForPeer));
-#else
- using var block = new BlockLiteral ();
- block.SetupBlockUnsafe (static_CertificateChainForPeer, callback);
-#endif
if (sec_protocol_metadata_access_peer_certificate_chain (GetCheckedHandle (), &block) == 0)
throw new InvalidOperationException ("The peer certificates are not accessible.");
}
}
-#if !NET
- delegate void sec_protocol_metadata_access_supported_signature_algorithms_handler_t (IntPtr block, ushort signatureAlgorithm);
- static sec_protocol_metadata_access_supported_signature_algorithms_handler_t static_SignatureAlgorithmsForPeer = TrampolineSignatureAlgorithmsForPeer;
-
- [MonoPInvokeCallback (typeof (sec_protocol_metadata_access_supported_signature_algorithms_handler_t))]
-#else
[UnmanagedCallersOnly]
-#endif
static void TrampolineSignatureAlgorithmsForPeer (IntPtr block, ushort signatureAlgorithm)
{
var del = BlockLiteral.GetTarget> (block);
@@ -357,13 +259,8 @@ public void SetSignatureAlgorithmsForPeerHandler (Action callback)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (callback));
unsafe {
-#if NET
delegate* unmanaged trampoline = &TrampolineSignatureAlgorithmsForPeer;
using var block = new BlockLiteral (trampoline, callback, typeof (SecProtocolMetadata), nameof (TrampolineSignatureAlgorithmsForPeer));
-#else
- using var block = new BlockLiteral ();
- block.SetupBlockUnsafe (static_SignatureAlgorithmsForPeer, callback);
-#endif
if (sec_protocol_metadata_access_supported_signature_algorithms (GetCheckedHandle (), &block) != 0)
throw new InvalidOperationException ("The supported signature list is not accessible.");
}
@@ -401,51 +298,29 @@ public void SetSignatureAlgorithmsForPeerHandler (Action callback)
return handle == IntPtr.Zero ? null : new DispatchData (handle, owns: true);
}
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern /* const char* */ IntPtr sec_protocol_metadata_get_server_name (IntPtr /* sec_protocol_metadata_t */ handle);
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
public string? ServerName => Marshal.PtrToStringAnsi (sec_protocol_metadata_get_server_name (GetCheckedHandle ()));
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe static extern byte sec_protocol_metadata_access_pre_shared_keys (IntPtr /* sec_protocol_metadata_t */ handle, BlockLiteral* block);
public delegate void SecAccessPreSharedKeysHandler (DispatchData psk, DispatchData pskIdentity);
-#if !NET
- internal delegate void AccessPreSharedKeysHandler (IntPtr block, IntPtr dd_psk, IntPtr dd_psk_identity);
- static readonly AccessPreSharedKeysHandler presharedkeys = TrampolineAccessPreSharedKeys;
-
- [MonoPInvokeCallback (typeof (AccessPreSharedKeysHandler))]
-#else
[UnmanagedCallersOnly]
-#endif
static void TrampolineAccessPreSharedKeys (IntPtr block, IntPtr psk, IntPtr psk_identity)
{
var del = BlockLiteral.GetTarget> (block);
@@ -453,15 +328,10 @@ static void TrampolineAccessPreSharedKeys (IntPtr block, IntPtr psk, IntPtr psk_
del (CreateDispatchData (psk), CreateDispatchData (psk_identity));
}
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
// no [Async] as it can be called multiple times
[BindingImpl (BindingImplOptions.Optimizable)]
public bool AccessPreSharedKeys (SecAccessPreSharedKeysHandler handler)
@@ -470,13 +340,8 @@ public bool AccessPreSharedKeys (SecAccessPreSharedKeysHandler handler)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (handler));
unsafe {
-#if NET
delegate* unmanaged trampoline = &TrampolineAccessPreSharedKeys;
using var block = new BlockLiteral (trampoline, handler, typeof (SecProtocolMetadata), nameof (TrampolineAccessPreSharedKeys));
-#else
- using var block = new BlockLiteral ();
- block.SetupBlockUnsafe (presharedkeys, handler);
-#endif
return sec_protocol_metadata_access_pre_shared_keys (GetCheckedHandle (), &block) != 0;
}
}
diff --git a/src/Security/SecProtocolOptions.cs b/src/Security/SecProtocolOptions.cs
index 8cf730358ccf..3c75f11a4d27 100644
--- a/src/Security/SecProtocolOptions.cs
+++ b/src/Security/SecProtocolOptions.cs
@@ -20,20 +20,13 @@
using dispatch_queue_t = System.IntPtr;
using sec_identity_t = System.IntPtr;
-#if !NET
-using NativeHandle = System.IntPtr;
-#endif
-
namespace Security {
-
-#if NET
/// To be added.
/// To be added.
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public class SecProtocolOptions : NativeObject {
#if !COREBUILD
// This type is only ever surfaced in response to callbacks in TLS/Network and documented as read-only
@@ -55,62 +48,30 @@ public void SetLocalIdentity (SecIdentity2 identity)
GC.KeepAlive (identity);
}
-#if !NET
- [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'AddTlsCipherSuite (TlsCipherSuite)' instead.")]
- [Deprecated (PlatformName.iOS, 13, 0, message: "Use 'AddTlsCipherSuite (TlsCipherSuite)' instead.")]
- [Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'AddTlsCipherSuite (TlsCipherSuite)' instead.")]
- [DllImport (Constants.SecurityLibrary)]
- static extern void sec_protocol_options_add_tls_ciphersuite (sec_protocol_options_t handle, SslCipherSuite cipherSuite);
-#endif
-
-#if !NET
- [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'AddTlsCipherSuite (TlsCipherSuite)' instead.")]
- [Deprecated (PlatformName.iOS, 13, 0, message: "Use 'AddTlsCipherSuite (TlsCipherSuite)' instead.")]
- [Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'AddTlsCipherSuite (TlsCipherSuite)' instead.")]
- [Unavailable (PlatformName.MacCatalyst)]
- public void AddTlsCipherSuite (SslCipherSuite cipherSuite) => sec_protocol_options_add_tls_ciphersuite (GetCheckedHandle (), cipherSuite);
-#endif
-
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_append_tls_ciphersuite (sec_protocol_options_t options, TlsCipherSuite ciphersuite);
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
public void AddTlsCipherSuite (TlsCipherSuite cipherSuite) => sec_protocol_options_append_tls_ciphersuite (GetCheckedHandle (), cipherSuite);
-#if NET
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'AddTlsCipherSuiteGroup (TlsCipherSuiteGroup)' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'AddTlsCipherSuiteGroup (TlsCipherSuiteGroup)' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'AddTlsCipherSuiteGroup (TlsCipherSuiteGroup)' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'AddTlsCipherSuiteGroup (TlsCipherSuiteGroup)' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'AddTlsCipherSuiteGroup (TlsCipherSuiteGroup)' instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'AddTlsCipherSuiteGroup (TlsCipherSuiteGroup)' instead.")]
- [Deprecated (PlatformName.iOS, 13, 0, message: "Use 'AddTlsCipherSuiteGroup (TlsCipherSuiteGroup)' instead.")]
- [Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'AddTlsCipherSuiteGroup (TlsCipherSuiteGroup)' instead.")]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_add_tls_ciphersuite_group (sec_protocol_options_t handle, SslCipherSuiteGroup cipherSuiteGroup);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -118,57 +79,36 @@ public void SetLocalIdentity (SecIdentity2 identity)
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'AddTlsCipherSuiteGroup (TlsCipherSuiteGroup)' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'AddTlsCipherSuiteGroup (TlsCipherSuiteGroup)' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'AddTlsCipherSuiteGroup (TlsCipherSuiteGroup)' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'AddTlsCipherSuiteGroup (TlsCipherSuiteGroup)' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'AddTlsCipherSuiteGroup (TlsCipherSuiteGroup)' instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'AddTlsCipherSuiteGroup (TlsCipherSuiteGroup)' instead.")]
- [Deprecated (PlatformName.iOS, 13, 0, message: "Use 'AddTlsCipherSuiteGroup (TlsCipherSuiteGroup)' instead.")]
- [Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'AddTlsCipherSuiteGroup (TlsCipherSuiteGroup)' instead.")]
-#endif
public void AddTlsCipherSuiteGroup (SslCipherSuiteGroup cipherSuiteGroup) => sec_protocol_options_add_tls_ciphersuite_group (GetCheckedHandle (), cipherSuiteGroup);
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_append_tls_ciphersuite_group (sec_protocol_options_t options, TlsCipherSuiteGroup group);
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
public void AddTlsCipherSuiteGroup (TlsCipherSuiteGroup cipherSuiteGroup) => sec_protocol_options_append_tls_ciphersuite_group (GetCheckedHandle (), cipherSuiteGroup);
-#if NET
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'SetTlsMinVersion (TlsProtocolVersion)' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'SetTlsMinVersion (TlsProtocolVersion)' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'SetTlsMinVersion (TlsProtocolVersion)' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'SetTlsMinVersion (TlsProtocolVersion)' instead.")]
- [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'SetTlsMinVersion (TlsProtocolVersion)' instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'SetTlsMinVersion (TlsProtocolVersion)' instead.")]
- [Deprecated (PlatformName.iOS, 13, 0, message: "Use 'SetTlsMinVersion (TlsProtocolVersion)' instead.")]
- [Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'SetTlsMinVersion (TlsProtocolVersion)' instead.")]
-#endif
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'SetTlsMinVersion (TlsProtocolVersion)' instead.")]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_tls_min_version (sec_protocol_options_t handle, SslProtocol protocol);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -176,59 +116,36 @@ public void SetLocalIdentity (SecIdentity2 identity)
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'SetTlsMinVersion (TlsProtocolVersion)' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'SetTlsMinVersion (TlsProtocolVersion)' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'SetTlsMinVersion (TlsProtocolVersion)' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'SetTlsMinVersion (TlsProtocolVersion)' instead.")]
- [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'SetTlsMinVersion (TlsProtocolVersion)' instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'SetTlsMinVersion (TlsProtocolVersion)' instead.")]
- [Deprecated (PlatformName.iOS, 13, 0, message: "Use 'SetTlsMinVersion (TlsProtocolVersion)' instead.")]
- [Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'SetTlsMinVersion (TlsProtocolVersion)' instead.")]
- [Unavailable (PlatformName.MacCatalyst)]
-#endif
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'SetTlsMinVersion (TlsProtocolVersion)' instead.")]
public void SetTlsMinVersion (SslProtocol protocol) => sec_protocol_options_set_tls_min_version (GetCheckedHandle (), protocol);
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_min_tls_protocol_version (sec_protocol_options_t handle, TlsProtocolVersion version);
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
public void SetTlsMinVersion (TlsProtocolVersion protocol) => sec_protocol_options_set_min_tls_protocol_version (GetCheckedHandle (), protocol);
-#if NET
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'SetTlsMaxVersion (TlsProtocolVersion)' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'SetTlsMaxVersion (TlsProtocolVersion)' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'SetTlsMaxVersion (TlsProtocolVersion)' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'SetTlsMaxVersion (TlsProtocolVersion)' instead.")]
- [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'SetTlsMaxVersion (TlsProtocolVersion)' instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'SetTlsMaxVersion (TlsProtocolVersion)' instead.")]
- [Deprecated (PlatformName.iOS, 13, 0, message: "Use 'SetTlsMaxVersion (TlsProtocolVersion)' instead.")]
- [Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'SetTlsMaxVersion (TlsProtocolVersion)' instead.")]
-#endif
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'SetTlsMaxVersion (TlsProtocolVersion)' instead.")]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_tls_max_version (sec_protocol_options_t handle, SslProtocol protocol);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -236,132 +153,75 @@ public void SetLocalIdentity (SecIdentity2 identity)
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'SetTlsMaxVersion (TlsProtocolVersion)' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'SetTlsMaxVersion (TlsProtocolVersion)' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'SetTlsMaxVersion (TlsProtocolVersion)' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'SetTlsMaxVersion (TlsProtocolVersion)' instead.")]
- [ObsoletedOSPlatform ("maccatalyst13.1", "Use 'SetTlsMaxVersion (TlsProtocolVersion)' instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'SetTlsMaxVersion (TlsProtocolVersion)' instead.")]
- [Deprecated (PlatformName.iOS, 13, 0, message: "Use 'SetTlsMaxVersion (TlsProtocolVersion)' instead.")]
- [Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'SetTlsMaxVersion (TlsProtocolVersion)' instead.")]
- [Unavailable (PlatformName.MacCatalyst)]
-#endif
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'SetTlsMaxVersion (TlsProtocolVersion)' instead.")]
public void SetTlsMaxVersion (SslProtocol protocol) => sec_protocol_options_set_tls_max_version (GetCheckedHandle (), protocol);
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_max_tls_protocol_version (sec_protocol_options_t handle, TlsProtocolVersion version);
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
public void SetTlsMaxVersion (TlsProtocolVersion protocol) => sec_protocol_options_set_max_tls_protocol_version (GetCheckedHandle (), protocol);
-
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern TlsProtocolVersion sec_protocol_options_get_default_min_dtls_protocol_version ();
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
static public TlsProtocolVersion DefaultMinDtlsProtocolVersion => sec_protocol_options_get_default_min_dtls_protocol_version ();
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern TlsProtocolVersion sec_protocol_options_get_default_max_dtls_protocol_version ();
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
static public TlsProtocolVersion DefaultMaxDtlsProtocolVersion => sec_protocol_options_get_default_max_dtls_protocol_version ();
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern TlsProtocolVersion sec_protocol_options_get_default_min_tls_protocol_version ();
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
static public TlsProtocolVersion DefaultMinTlsProtocolVersion => sec_protocol_options_get_default_min_tls_protocol_version ();
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern TlsProtocolVersion sec_protocol_options_get_default_max_tls_protocol_version ();
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
static public TlsProtocolVersion DefaultMaxTlsProtocolVersion => sec_protocol_options_get_default_max_tls_protocol_version ();
[DllImport (Constants.SecurityLibrary)]
@@ -392,24 +252,17 @@ public void SetTlsServerName (string serverName)
sec_protocol_options_set_tls_server_name (GetCheckedHandle (), serverNamePtr);
}
-#if NET
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use non-DHE cipher suites instead.")]
+ [ObsoletedOSPlatform ("macos", "Use non-DHE cipher suites instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use non-DHE cipher suites instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use non-DHE cipher suites instead.")]
- [ObsoletedOSPlatform ("maccatalyst13.1", "Use non-DHE cipher suites instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use non-DHE cipher suites instead.")]
- [Deprecated (PlatformName.iOS, 13, 0, message: "Use non-DHE cipher suites instead.")]
- [Deprecated (PlatformName.TvOS, 13, 0, message: "Use non-DHE cipher suites instead.")]
-#endif
+ [ObsoletedOSPlatform ("maccatalyst", "Use non-DHE cipher suites instead.")]
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_tls_diffie_hellman_parameters (IntPtr handle, IntPtr dispatchDataParameter);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -417,15 +270,10 @@ public void SetTlsServerName (string serverName)
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use non-DHE cipher suites instead.")]
+ [ObsoletedOSPlatform ("macos", "Use non-DHE cipher suites instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use non-DHE cipher suites instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use non-DHE cipher suites instead.")]
- [ObsoletedOSPlatform ("maccatalyst13.1", "Use non-DHE cipher suites instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use non-DHE cipher suites instead.")]
- [Deprecated (PlatformName.iOS, 13, 0, message: "Use non-DHE cipher suites instead.")]
- [Deprecated (PlatformName.TvOS, 13, 0, message: "Use non-DHE cipher suites instead.")]
-#endif
+ [ObsoletedOSPlatform ("maccatalyst", "Use non-DHE cipher suites instead.")]
public void SetTlsDiffieHellmanParameters (DispatchData parameters)
{
if (parameters is null)
@@ -440,6 +288,14 @@ public void SetTlsDiffieHellmanParameters (DispatchData parameters)
/// To be added.
/// To be added.
/// To be added.
+ [SupportedOSPlatform ("tvos")]
+ [SupportedOSPlatform ("macos")]
+ [SupportedOSPlatform ("ios")]
+ [SupportedOSPlatform ("maccatalyst")]
+ [ObsoletedOSPlatform ("macos", "Use non-DHE cipher suites instead.")]
+ [ObsoletedOSPlatform ("tvos13.0", "Use non-DHE cipher suites instead.")]
+ [ObsoletedOSPlatform ("ios13.0", "Use non-DHE cipher suites instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use non-DHE cipher suites instead.")]
public void AddPreSharedKey (DispatchData parameters)
{
if (parameters is null)
@@ -528,40 +384,25 @@ public void SetKeyUpdateCallback (SecProtocolKeyUpdate keyUpdate, DispatchQueue
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (keyUpdateQueue));
unsafe {
-#if NET
delegate* unmanaged trampoline = &Trampolines.SDSecProtocolKeyUpdate.Invoke;
using var block = new BlockLiteral (trampoline, keyUpdate, typeof (Trampolines.SDSecProtocolKeyUpdate), nameof (Trampolines.SDSecProtocolKeyUpdate.Invoke));
-#else
- using var block = new BlockLiteral ();
- block.SetupBlockUnsafe (Trampolines.SDSecProtocolKeyUpdate.Handler, keyUpdate);
-#endif
sec_protocol_options_set_key_update_block (Handle, &block, keyUpdateQueue.Handle);
GC.KeepAlive (keyUpdateQueue);
}
}
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern byte sec_protocol_options_are_equal (sec_protocol_options_t optionsA, sec_protocol_options_t optionsB);
// Equatable would be nice but would fail on earlier OS versions
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
public bool IsEqual (SecProtocolOptions other)
{
if (other is null)
@@ -571,15 +412,10 @@ public bool IsEqual (SecProtocolOptions other)
return result;
}
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
static public bool IsEqual (SecProtocolOptions optionsA, SecProtocolOptions optionsB)
{
if (optionsA is null)
@@ -592,27 +428,17 @@ static public bool IsEqual (SecProtocolOptions optionsA, SecProtocolOptions opti
return result;
}
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern void sec_protocol_options_set_tls_pre_shared_key_identity_hint (sec_protocol_options_t options, IntPtr /* dispatch_data */ psk_identity_hint);
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
public void SetTlsPreSharedKeyIdentityHint (DispatchData pskIdentityHint)
{
if (pskIdentityHint is null)
@@ -622,7 +448,6 @@ public void SetTlsPreSharedKeyIdentityHint (DispatchData pskIdentityHint)
}
#endif
-#if NET
#if !COREBUILD
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
@@ -696,6 +521,5 @@ public void SetPreSharedKeySelectionBlock (SecProtocolPreSharedKeySelection sele
}
}
#endif // !COREBUILD
-#endif // NET
}
}
diff --git a/src/Security/SecSharedCredential.cs b/src/Security/SecSharedCredential.cs
index 09915cf1f2c3..76d1d8f07337 100644
--- a/src/Security/SecSharedCredential.cs
+++ b/src/Security/SecSharedCredential.cs
@@ -18,20 +18,9 @@ public static partial class SecSharedCredential {
unsafe extern static void SecAddSharedWebCredential (IntPtr /* CFStringRef */ fqdn, IntPtr /* CFStringRef */ account, IntPtr /* CFStringRef */ password,
BlockLiteral* /* void (^completionHandler)( CFErrorRef error) ) */ completionHandler);
-#if !NET
- [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
- internal delegate void DActionArity1V12 (IntPtr block, IntPtr obj);
-#endif
-
// This class bridges native block invocations that call into C#
static internal class ActionTrampoline {
-#if !NET
- static internal readonly DActionArity1V12 Handler = Invoke;
-
- [MonoPInvokeCallback (typeof (DActionArity1V12))]
-#else
[UnmanagedCallersOnly]
-#endif
internal static unsafe void Invoke (IntPtr block, IntPtr obj)
{
var descriptor = (BlockLiteral*) block;
@@ -62,13 +51,8 @@ public static void AddSharedWebCredential (string domainName, string account, st
using var nsAccount = new NSString (account);
using var nsPassword = (NSString?) password;
-#if NET
delegate* unmanaged trampoline = &ActionTrampoline.Invoke;
using var block = new BlockLiteral (trampoline, handler, typeof (ActionTrampoline), nameof (ActionTrampoline.Invoke));
-#else
- using var block = new BlockLiteral ();
- block.SetupBlockUnsafe (ActionTrampoline.Handler, handler);
-#endif
SecAddSharedWebCredential (nsDomain.Handle, nsAccount.Handle, nsPassword.GetHandle (), &block);
GC.KeepAlive (nsDomain);
GC.KeepAlive (nsAccount);
@@ -76,38 +60,23 @@ public static void AddSharedWebCredential (string domainName, string account, st
}
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos11.0")]
+ [ObsoletedOSPlatform ("maccatalyst")]
+ [ObsoletedOSPlatform ("macos")]
[ObsoletedOSPlatform ("ios14.0")]
[UnsupportedOSPlatform ("tvos")]
-#else
- [Deprecated (PlatformName.iOS, 14,0)]
- [Deprecated (PlatformName.MacOSX, 11,0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe extern static void SecRequestSharedWebCredential (IntPtr /* CFStringRef */ fqdn, IntPtr /* CFStringRef */ account,
BlockLiteral* /* void (^completionHandler)( CFArrayRef credentials, CFErrorRef error) */ completionHandler);
-#if !NET
- [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
- internal delegate void ArrayErrorAction (IntPtr block, IntPtr array, IntPtr err);
-#endif
-
//
// This class bridges native block invocations that call into C# because we cannot use the decorator, we have to create
// it for our use here.
//
static internal class ArrayErrorActionTrampoline {
-#if !NET
- static internal readonly ArrayErrorAction Handler = Invoke;
-
- [MonoPInvokeCallback (typeof (ArrayErrorAction))]
-#else
[UnmanagedCallersOnly]
-#endif
internal static unsafe void Invoke (IntPtr block, IntPtr array, IntPtr err)
{
var descriptor = (BlockLiteral*) block;
@@ -117,15 +86,6 @@ internal static unsafe void Invoke (IntPtr block, IntPtr array, IntPtr err)
}
}
-#if !NET
- [Obsolete ("Use the overload accepting a 'SecSharedCredentialInfo' argument.")]
- public static void RequestSharedWebCredential (string domainName, string account, Action handler)
- {
- throw new InvalidOperationException ("Use correct delegate type");
- }
-#endif
-
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -134,13 +94,10 @@ public static void RequestSharedWebCredential (string domainName, string account
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos11.0", "Use 'ASAuthorizationPasswordRequest' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'ASAuthorizationPasswordRequest' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'ASAuthorizationPasswordRequest' instead.")]
[ObsoletedOSPlatform ("ios14.0", "Use 'ASAuthorizationPasswordRequest' instead.")]
[UnsupportedOSPlatform ("tvos")]
-#else
- [Deprecated (PlatformName.iOS, 14,0, message: "Use 'ASAuthorizationPasswordRequest' instead.")]
- [Deprecated (PlatformName.MacOSX, 11,0, message: "Use 'ASAuthorizationPasswordRequest' instead.")]
-#endif
[BindingImpl (BindingImplOptions.Optimizable)]
public static void RequestSharedWebCredential (string domainName, string account, Action handler)
{
@@ -157,13 +114,8 @@ public static void RequestSharedWebCredential (string domainName, string account
using var nsAccount = (NSString?) account;
unsafe {
-#if NET
delegate* unmanaged trampoline = &ArrayErrorActionTrampoline.Invoke;
using var block = new BlockLiteral (trampoline, handler, typeof (ArrayErrorActionTrampoline), nameof (ArrayErrorActionTrampoline.Invoke));
-#else
- using var block = new BlockLiteral ();
- block.SetupBlockUnsafe (ArrayErrorActionTrampoline.Handler, onComplete);
-#endif
SecRequestSharedWebCredential (nsDomain.GetHandle (), nsAccount.GetHandle (), &block);
GC.KeepAlive (nsDomain);
GC.KeepAlive (nsAccount);
diff --git a/src/Security/SecStatusCodeExtensions.cs b/src/Security/SecStatusCodeExtensions.cs
index e6860e70a184..7bc50112db9b 100644
--- a/src/Security/SecStatusCodeExtensions.cs
+++ b/src/Security/SecStatusCodeExtensions.cs
@@ -15,28 +15,22 @@
using Foundation;
namespace Security {
-#if NET
/// To be added.
/// To be added.
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
-#endif
public static class SecStatusCodeExtensions {
-
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
-#endif
[DllImport (Constants.SecurityLibrary)]
extern static /* CFStringRef */ IntPtr SecCopyErrorMessageString (
/* OSStatus */ SecStatusCode status,
/* void * */ IntPtr reserved); /* always null */
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -45,7 +39,6 @@ public static class SecStatusCodeExtensions {
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
-#endif
public static string GetStatusDescription (this SecStatusCode status)
{
var ret = SecCopyErrorMessageString (status, IntPtr.Zero);
diff --git a/src/Security/SecTrust.cs b/src/Security/SecTrust.cs
index 4007678a4475..b49fc3fa5248 100644
--- a/src/Security/SecTrust.cs
+++ b/src/Security/SecTrust.cs
@@ -42,16 +42,13 @@ public SecTrust (SecCertificate certificate, SecPolicy policy)
GC.KeepAlive (certificate);
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe extern static SecStatusCode /* OSStatus */ SecTrustCopyPolicies (IntPtr /* SecTrustRef */ trust, IntPtr* /* CFArrayRef* */ policies);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -59,7 +56,6 @@ public SecTrust (SecCertificate certificate, SecPolicy policy)
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
-#endif
public SecPolicy [] GetPolicies ()
{
IntPtr p = IntPtr.Zero;
@@ -119,25 +115,20 @@ public void SetPolicies (NSArray policies)
GC.KeepAlive (policies);
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe extern static SecStatusCode /* OSStatus */ SecTrustGetNetworkFetchAllowed (IntPtr /* SecTrustRef */ trust, byte* /* Boolean* */ allowFetch);
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
[DllImport (Constants.SecurityLibrary)]
extern static SecStatusCode /* OSStatus */ SecTrustSetNetworkFetchAllowed (IntPtr /* SecTrustRef */ trust, byte /* Boolean */ allowFetch);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -145,7 +136,6 @@ public void SetPolicies (NSArray policies)
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
public bool NetworkFetchAllowed {
get {
byte value;
@@ -164,16 +154,13 @@ public bool NetworkFetchAllowed {
}
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe extern static SecStatusCode /* OSStatus */ SecTrustCopyCustomAnchorCertificates (IntPtr /* SecTrustRef */ trust, IntPtr* /* CFArrayRef* */ anchors);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -181,7 +168,6 @@ public bool NetworkFetchAllowed {
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
-#endif
public SecCertificate [] GetCustomAnchorCertificates ()
{
IntPtr p;
@@ -194,30 +180,18 @@ public SecCertificate [] GetCustomAnchorCertificates ()
return NSArray.ArrayFromHandle (p);
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Evaluate (DispatchQueue, SecTrustWithErrorCallback)' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Evaluate (DispatchQueue, SecTrustWithErrorCallback)' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Evaluate (DispatchQueue, SecTrustWithErrorCallback)' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Evaluate (DispatchQueue, SecTrustWithErrorCallback)' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Evaluate (DispatchQueue, SecTrustWithErrorCallback)' instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'Evaluate (DispatchQueue, SecTrustWithErrorCallback)' instead.")]
- [Deprecated (PlatformName.iOS, 13, 0, message: "Use 'Evaluate (DispatchQueue, SecTrustWithErrorCallback)' instead.")]
- [Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'Evaluate (DispatchQueue, SecTrustWithErrorCallback)' instead.")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe extern static SecStatusCode /* OSStatus */ SecTrustEvaluateAsync (IntPtr /* SecTrustRef */ trust, IntPtr /* dispatch_queue_t */ queue, BlockLiteral* block);
-#if !NET
- internal delegate void TrustEvaluateHandler (IntPtr block, IntPtr trust, SecTrustResult trustResult);
- static readonly TrustEvaluateHandler evaluate = TrampolineEvaluate;
-
- [MonoPInvokeCallback (typeof (TrustEvaluateHandler))]
-#else
[UnmanagedCallersOnly]
-#endif
static void TrampolineEvaluate (IntPtr block, IntPtr trust, SecTrustResult trustResult)
{
var del = BlockLiteral.GetTarget (block);
@@ -227,19 +201,14 @@ static void TrampolineEvaluate (IntPtr block, IntPtr trust, SecTrustResult trust
}
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Evaluate (DispatchQueue, SecTrustWithErrorCallback)' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Evaluate (DispatchQueue, SecTrustWithErrorCallback)' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Evaluate (DispatchQueue, SecTrustWithErrorCallback)' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Evaluate (DispatchQueue, SecTrustWithErrorCallback)' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Evaluate (DispatchQueue, SecTrustWithErrorCallback)' instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'Evaluate (DispatchQueue, SecTrustWithErrorCallback)' instead.")]
- [Deprecated (PlatformName.iOS, 13, 0, message: "Use 'Evaluate (DispatchQueue, SecTrustWithErrorCallback)' instead.")]
- [Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'Evaluate (DispatchQueue, SecTrustWithErrorCallback)' instead.")]
-#endif
[BindingImpl (BindingImplOptions.Optimizable)]
public SecStatusCode Evaluate (DispatchQueue queue, SecTrustCallback handler)
{
@@ -250,39 +219,22 @@ public SecStatusCode Evaluate (DispatchQueue queue, SecTrustCallback handler)
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (handler));
unsafe {
-#if NET
delegate* unmanaged trampoline = &TrampolineEvaluate;
using var block = new BlockLiteral (trampoline, handler, typeof (SecTrust), nameof (TrampolineEvaluate));
-#else
- using var block = new BlockLiteral ();
- block.SetupBlockUnsafe (evaluate, handler);
-#endif
SecStatusCode status = SecTrustEvaluateAsync (Handle, queue.Handle, &block);
GC.KeepAlive (queue);
return status;
}
}
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe static extern SecStatusCode SecTrustEvaluateAsyncWithError (IntPtr /* SecTrustRef */ trust, IntPtr /* dispatch_queue_t */ queue, BlockLiteral* block);
-#if !NET
- internal delegate void TrustEvaluateErrorHandler (IntPtr block, IntPtr trust, byte result, IntPtr /* CFErrorRef _Nullable */ error);
- static readonly TrustEvaluateErrorHandler evaluate_error = TrampolineEvaluateError;
-
- [MonoPInvokeCallback (typeof (TrustEvaluateErrorHandler))]
-#else
[UnmanagedCallersOnly]
-#endif
static void TrampolineEvaluateError (IntPtr block, IntPtr trust, byte result, IntPtr /* CFErrorRef _Nullable */ error)
{
var del = BlockLiteral.GetTarget (block);
@@ -293,15 +245,10 @@ static void TrampolineEvaluateError (IntPtr block, IntPtr trust, byte result, In
}
}
-#if NET
[SupportedOSPlatform ("tvos13.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios13.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (13, 0)]
- [iOS (13, 0)]
-#endif
[BindingImpl (BindingImplOptions.Optimizable)]
public SecStatusCode Evaluate (DispatchQueue queue, SecTrustWithErrorCallback handler)
{
@@ -311,29 +258,21 @@ public SecStatusCode Evaluate (DispatchQueue queue, SecTrustWithErrorCallback ha
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (handler));
unsafe {
-#if NET
delegate* unmanaged trampoline = &TrampolineEvaluateError;
using var block = new BlockLiteral (trampoline, handler, typeof (SecTrust), nameof (TrampolineEvaluateError));
-#else
- using var block = new BlockLiteral ();
- block.SetupBlockUnsafe (evaluate_error, handler);
-#endif
SecStatusCode status = SecTrustEvaluateAsyncWithError (Handle, queue.Handle, &block);
GC.KeepAlive (queue);
return status;
}
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe extern static SecStatusCode /* OSStatus */ SecTrustGetTrustResult (IntPtr /* SecTrustRef */ trust, SecTrustResult* /* SecTrustResultType */ result);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -341,7 +280,6 @@ public SecStatusCode Evaluate (DispatchQueue queue, SecTrustWithErrorCallback ha
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
-#endif
public SecTrustResult GetTrustResult ()
{
SecTrustResult trust_result;
@@ -354,16 +292,13 @@ public SecTrustResult GetTrustResult ()
return trust_result;
}
-#if NET
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe static extern byte SecTrustEvaluateWithError (/* SecTrustRef */ IntPtr trust, /* CFErrorRef** */ IntPtr* error);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -372,7 +307,6 @@ public SecTrustResult GetTrustResult ()
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public bool Evaluate (out NSError? error)
{
IntPtr err;
@@ -384,16 +318,13 @@ public bool Evaluate (out NSError? error)
return result;
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
[DllImport (Constants.SecurityLibrary)]
extern static IntPtr /* CFDictionaryRef */ SecTrustCopyResult (IntPtr /* SecTrustRef */ trust);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -401,28 +332,23 @@ public bool Evaluate (out NSError? error)
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
public NSDictionary GetResult ()
{
return new NSDictionary (SecTrustCopyResult (Handle), true);
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
[DllImport (Constants.SecurityLibrary)]
extern static SecStatusCode /* OSStatus */ SecTrustSetOCSPResponse (IntPtr /* SecTrustRef */ trust, IntPtr /* CFTypeRef */ responseData);
// the API accept the handle for a single policy or an array of them
-#if NET
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
void SetOCSPResponse (IntPtr ocsp)
{
SecStatusCode result = SecTrustSetOCSPResponse (Handle, ocsp);
@@ -430,7 +356,6 @@ void SetOCSPResponse (IntPtr ocsp)
throw new InvalidOperationException (result.ToString ());
}
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -438,7 +363,6 @@ void SetOCSPResponse (IntPtr ocsp)
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
-#endif
public void SetOCSPResponse (NSData ocspResponse)
{
if (ocspResponse is null)
@@ -448,7 +372,6 @@ public void SetOCSPResponse (NSData ocspResponse)
GC.KeepAlive (ocspResponse);
}
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -456,7 +379,6 @@ public void SetOCSPResponse (NSData ocspResponse)
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
-#endif
public void SetOCSPResponse (IEnumerable ocspResponses)
{
if (ocspResponses is null)
@@ -466,7 +388,6 @@ public void SetOCSPResponse (IEnumerable ocspResponses)
SetOCSPResponse (array.Handle);
}
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -474,7 +395,6 @@ public void SetOCSPResponse (IEnumerable ocspResponses)
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
-#endif
public void SetOCSPResponse (NSArray ocspResponses)
{
if (ocspResponses is null)
@@ -484,16 +404,13 @@ public void SetOCSPResponse (NSArray ocspResponses)
GC.KeepAlive (ocspResponses);
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern SecStatusCode /* OSStatus */ SecTrustSetSignedCertificateTimestamps (/* SecTrustRef* */ IntPtr trust, /* CFArrayRef* */ IntPtr sctArray);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -502,7 +419,6 @@ public void SetOCSPResponse (NSArray ocspResponses)
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public SecStatusCode SetSignedCertificateTimestamps (IEnumerable sct)
{
if (sct is null)
@@ -512,7 +428,6 @@ public SecStatusCode SetSignedCertificateTimestamps (IEnumerable sct)
return SecTrustSetSignedCertificateTimestamps (Handle, array.Handle);
}
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -521,7 +436,6 @@ public SecStatusCode SetSignedCertificateTimestamps (IEnumerable sct)
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public SecStatusCode SetSignedCertificateTimestamps (NSArray sct)
{
SecStatusCode status = SecTrustSetSignedCertificateTimestamps (Handle, sct.GetHandle ());
diff --git a/src/Security/SecTrust2.cs b/src/Security/SecTrust2.cs
index 41bf7dce5d90..d2291735ae55 100644
--- a/src/Security/SecTrust2.cs
+++ b/src/Security/SecTrust2.cs
@@ -21,27 +21,16 @@
using Foundation;
using CoreFoundation;
-#if !NET
-using NativeHandle = System.IntPtr;
-#endif
-
namespace Security {
-
-#if NET
/// To be added.
/// To be added.
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
-#endif
public class SecTrust2 : NativeObject {
[Preserve (Conditional = true)]
-#if NET
internal SecTrust2 (NativeHandle handle, bool owns) : base (handle, owns) { }
-#else
- public SecTrust2 (NativeHandle handle, bool owns) : base (handle, owns) { }
-#endif
[DllImport (Constants.SecurityLibrary)]
extern static IntPtr sec_trust_create (IntPtr sectrustHandle);
diff --git a/src/Security/SecureTransport.cs b/src/Security/SecureTransport.cs
index 500a73a64186..5515a2d1ef94 100644
--- a/src/Security/SecureTransport.cs
+++ b/src/Security/SecureTransport.cs
@@ -403,176 +403,6 @@ public enum SslClientCertificateState {
Rejected,
}
-#if !NET
- // Security.framework/Headers/CipherSuite.h
- // 32 bits (uint32_t) on OSX, 16 bits (uint16_t) on iOS
- [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'TlsCipherSuite' instead.")]
- [Deprecated (PlatformName.iOS, 13, 0, message: "Use 'TlsCipherSuite' instead.")]
- [Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'TlsCipherSuite' instead.")]
-#if MONOMAC || __MACCATALYST__
- public enum SslCipherSuite : uint {
-#else
- public enum SslCipherSuite : ushort {
-#endif
- // DO NOT RENAME VALUES - they don't look good but we need them to keep compatibility with our System.dll code
- // it's how it's defined across most SSL/TLS implementation (from RFC)
-
- SSL_NULL_WITH_NULL_NULL = 0x0000, // value used before (not after) negotiation
- TLS_NULL_WITH_NULL_NULL = 0x0000,
-
- // Not the whole list (too much unneeed metadata) but only what's supported
- // FIXME needs to be expended with OSX 10.9
-
- SSL_RSA_WITH_NULL_MD5 = 0x0001,
- SSL_RSA_WITH_NULL_SHA = 0x0002,
- SSL_RSA_EXPORT_WITH_RC4_40_MD5 = 0x0003, // iOS 5.1 only
- SSL_RSA_WITH_RC4_128_MD5 = 0x0004,
- SSL_RSA_WITH_RC4_128_SHA = 0x0005,
- SSL_RSA_WITH_3DES_EDE_CBC_SHA = 0x000A,
- SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA = 0x0016,
- SSL_DH_anon_EXPORT_WITH_RC4_40_MD5 = 0x0017, // iOS 5.1 only
- SSL_DH_anon_WITH_RC4_128_MD5 = 0x0018,
- SSL_DH_anon_WITH_3DES_EDE_CBC_SHA = 0x001B,
-
- // TLS - identical values to SSL (above)
-
- TLS_RSA_WITH_NULL_MD5 = 0x0001,
- TLS_RSA_WITH_NULL_SHA = 0x0002,
- TLS_RSA_WITH_RC4_128_MD5 = 0x0004,
- TLS_RSA_WITH_RC4_128_SHA = 0x0005,
- TLS_RSA_WITH_3DES_EDE_CBC_SHA = 0x000A,
- TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA = 0x0016,
- TLS_DH_anon_WITH_RC4_128_MD5 = 0x0018,
- TLS_DH_anon_WITH_3DES_EDE_CBC_SHA = 0x001B,
-
- // TLS specific
-
- TLS_PSK_WITH_NULL_SHA = 0x002C,
- TLS_RSA_WITH_AES_128_CBC_SHA = 0x002F,
- TLS_DHE_RSA_WITH_AES_128_CBC_SHA = 0x0033,
- TLS_DH_anon_WITH_AES_128_CBC_SHA = 0x0034,
- TLS_RSA_WITH_AES_256_CBC_SHA = 0x0035,
- TLS_DHE_RSA_WITH_AES_256_CBC_SHA = 0x0039,
- TLS_DH_anon_WITH_AES_256_CBC_SHA = 0x003A,
- TLS_RSA_WITH_NULL_SHA256 = 0x003B,
- TLS_RSA_WITH_AES_128_CBC_SHA256 = 0x003C,
- TLS_RSA_WITH_AES_256_CBC_SHA256 = 0x003D,
- TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 = 0x0067,
- TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 = 0x006B,
- TLS_DH_anon_WITH_AES_128_CBC_SHA256 = 0x006C,
- TLS_DH_anon_WITH_AES_256_CBC_SHA256 = 0x006D,
- TLS_PSK_WITH_RC4_128_SHA = 0x008A,
- TLS_PSK_WITH_3DES_EDE_CBC_SHA = 0x008B,
- TLS_PSK_WITH_AES_128_CBC_SHA = 0x008C,
- TLS_PSK_WITH_AES_256_CBC_SHA = 0x008D,
-
- TLS_RSA_WITH_AES_128_GCM_SHA256 = 0x009C, // iOS 9+
- TLS_RSA_WITH_AES_256_GCM_SHA384 = 0x009D, // iOS 9+
- TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 = 0x009E, // iOS 9+
- TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 = 0x009F, // iOS 9+
-
- TLS_DH_DSS_WITH_AES_256_GCM_SHA384 = 0x00A5,
- TLS_DH_anon_WITH_AES_128_GCM_SHA256 = 0x00A6, // iOS 5.1 only
- TLS_DH_anon_WITH_AES_256_GCM_SHA384 = 0x00A7, // iOS 5.1 only
-
- /* RFC 5487 - PSK with SHA-256/384 and AES GCM */
- TLS_PSK_WITH_AES_128_GCM_SHA256 = 0x00A8,
- TLS_PSK_WITH_AES_256_GCM_SHA384 = 0x00A9,
- TLS_DHE_PSK_WITH_AES_128_GCM_SHA256 = 0x00AA,
- TLS_DHE_PSK_WITH_AES_256_GCM_SHA384 = 0x00AB,
- TLS_RSA_PSK_WITH_AES_128_GCM_SHA256 = 0x00AC,
- TLS_RSA_PSK_WITH_AES_256_GCM_SHA384 = 0x00AD,
-
- TLS_PSK_WITH_AES_128_CBC_SHA256 = 0x00AE,
- TLS_PSK_WITH_AES_256_CBC_SHA384 = 0x00AF,
- TLS_PSK_WITH_NULL_SHA256 = 0x00B0,
- TLS_PSK_WITH_NULL_SHA384 = 0x00B1,
-
- TLS_DHE_PSK_WITH_AES_128_CBC_SHA256 = 0x00B2,
- TLS_DHE_PSK_WITH_AES_256_CBC_SHA384 = 0x00B3,
- TLS_DHE_PSK_WITH_NULL_SHA256 = 0x00B4,
- TLS_DHE_PSK_WITH_NULL_SHA384 = 0x00B5,
-
- TLS_RSA_PSK_WITH_AES_128_CBC_SHA256 = 0x00B6,
- TLS_RSA_PSK_WITH_AES_256_CBC_SHA384 = 0x00B7,
- TLS_RSA_PSK_WITH_NULL_SHA256 = 0x00B8,
- TLS_RSA_PSK_WITH_NULL_SHA384 = 0x00B9,
-
- TLS_ECDH_ECDSA_WITH_NULL_SHA = 0xC001,
- TLS_ECDH_ECDSA_WITH_RC4_128_SHA = 0xC002,
- TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA = 0xC003,
- TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA = 0xC004,
- TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA = 0xC005,
- TLS_ECDHE_ECDSA_WITH_NULL_SHA = 0xC006,
- TLS_ECDHE_ECDSA_WITH_RC4_128_SHA = 0xC007,
- TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA = 0xC008,
- TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA = 0xC009,
- TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA = 0xC00A,
- TLS_ECDH_RSA_WITH_NULL_SHA = 0xC00B,
- TLS_ECDH_RSA_WITH_RC4_128_SHA = 0xC00C,
- TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA = 0xC00D,
- TLS_ECDH_RSA_WITH_AES_128_CBC_SHA = 0xC00E,
- TLS_ECDH_RSA_WITH_AES_256_CBC_SHA = 0xC00F,
- TLS_ECDHE_RSA_WITH_NULL_SHA = 0xC010,
- TLS_ECDHE_RSA_WITH_RC4_128_SHA = 0xC011,
- TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA = 0xC012,
- TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA = 0xC013,
- TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA = 0xC014,
-
- TLS_ECDH_anon_WITH_NULL_SHA = 0xC015,
- TLS_ECDH_anon_WITH_RC4_128_SHA = 0xC016,
- TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA = 0xC017,
- TLS_ECDH_anon_WITH_AES_128_CBC_SHA = 0xC018,
- TLS_ECDH_anon_WITH_AES_256_CBC_SHA = 0xC019,
-
- TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 = 0xC023,
- TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 = 0xC024,
- TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 = 0xC025,
- TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 = 0xC026,
- TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 = 0xC027,
- TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 = 0xC028,
- TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 = 0xC029,
- TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 = 0xC02A,
-
- TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 = 0xC02B, // iOS 9+
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 = 0xC02C, // iOS 9+
- TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 = 0xC02D, // iOS 9+
- TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 = 0xC02E, // iOS 9+
- TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 = 0xC02F, // iOS 9+
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 = 0xC030, // iOS 9+
- TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 = 0xC031, // iOS 9+
- TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 = 0xC032, // iOS 9+
-
- // rfc 5489
- TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA = 0xC035,
- TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA = 0xC036,
-
- // https://tools.ietf.org/html/rfc7905
- TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 = 0xCCA8, // Xcode 9+
- TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 = 0xCCA9, // Xcode 9+
-
- // rfc 7905
- TLS_PSK_WITH_CHACHA20_POLY1305_SHA256 = 0xCCAB,
-
- // https://tools.ietf.org/html/rfc5746 secure renegotiation
- TLS_EMPTY_RENEGOTIATION_INFO_SCSV = 0x00FF,
-
- /* TLS 1.3 */
- TLS_AES_128_GCM_SHA256 = 0x1301, // iOS 11+
- TLS_AES_256_GCM_SHA384 = 0x1302, // iOS 11+
- TLS_CHACHA20_POLY1305_SHA256 = 0x1303, // iOS 11+
- TLS_AES_128_CCM_SHA256 = 0x1304, // iOS 11+
- TLS_AES_128_CCM_8_SHA256 = 0x1305, // iOS 11+
-
- SSL_RSA_WITH_RC2_CBC_MD5 = 0xFF80,
- SSL_RSA_WITH_IDEA_CBC_MD5 = 0xFF81,
- SSL_RSA_WITH_DES_CBC_MD5 = 0xFF82,
- SSL_RSA_WITH_3DES_EDE_CBC_MD5 = 0xFF83,
- SSL_NO_SUCH_CIPHERSUITE = 0xFFFF,
-
- }
-#endif // !NET
-
[Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'TlsCipherSuiteGroup' instead.")]
[Deprecated (PlatformName.iOS, 13, 0, message: "Use 'TlsCipherSuiteGroup' instead.")]
[Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'TlsCipherSuiteGroup' instead.")]
diff --git a/src/Security/SslConnection.cs b/src/Security/SslConnection.cs
index b2e03760d709..e5ecb949186f 100644
--- a/src/Security/SslConnection.cs
+++ b/src/Security/SslConnection.cs
@@ -17,29 +17,16 @@
using ObjCRuntime;
namespace Security {
-
-#if !NET
- unsafe delegate SslStatus SslReadFunc (IntPtr connection, IntPtr data, /* size_t* */ nint* dataLength);
-
- unsafe delegate SslStatus SslWriteFunc (IntPtr connection, IntPtr data, /* size_t* */ nint* dataLength);
-#endif
-
-#if NET
/// Class that represents an SSL connection.
/// To be added.
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("macos10.15", Constants.UseNetworkInstead)]
+ [ObsoletedOSPlatform ("macos", Constants.UseNetworkInstead)]
[ObsoletedOSPlatform ("tvos13.0", Constants.UseNetworkInstead)]
[ObsoletedOSPlatform ("ios13.0", Constants.UseNetworkInstead)]
- [ObsoletedOSPlatform ("maccatalyst13.0", Constants.UseNetworkInstead)]
-#else
- [Deprecated (PlatformName.MacOSX, 10, 15, message: Constants.UseNetworkInstead)]
- [Deprecated (PlatformName.iOS, 13, 0, message: Constants.UseNetworkInstead)]
- [Deprecated (PlatformName.TvOS, 13, 0, message: Constants.UseNetworkInstead)]
-#endif
+ [ObsoletedOSPlatform ("maccatalyst", Constants.UseNetworkInstead)]
public abstract class SslConnection : IDisposable {
GCHandle handle;
@@ -50,12 +37,6 @@ protected SslConnection ()
{
handle = GCHandle.Alloc (this);
ConnectionId = GCHandle.ToIntPtr (handle);
-#if !NET
- unsafe {
- ReadFunc = Read;
- WriteFunc = Write;
- }
-#endif
}
~SslConnection ()
@@ -86,34 +67,21 @@ protected virtual void Dispose (bool disposing)
/// To be added.
public IntPtr ConnectionId { get; private set; }
-#if NET
unsafe internal delegate* unmanaged ReadFunc { get { return &Read; } }
unsafe internal delegate* unmanaged WriteFunc { get { return &Write; } }
-#else
- internal SslReadFunc ReadFunc { get; private set; }
- internal SslWriteFunc WriteFunc { get; private set; }
-#endif
public abstract SslStatus Read (IntPtr data, ref nint dataLength);
public abstract SslStatus Write (IntPtr data, ref nint dataLength);
-#if NET
[UnmanagedCallersOnly]
-#else
- [MonoPInvokeCallback (typeof (SslReadFunc))]
-#endif
unsafe static SslStatus Read (IntPtr connection, IntPtr data, nint* dataLength)
{
var c = (SslConnection) GCHandle.FromIntPtr (connection).Target!;
return c.Read (data, ref System.Runtime.CompilerServices.Unsafe.AsRef (dataLength));
}
-#if NET
[UnmanagedCallersOnly]
-#else
- [MonoPInvokeCallback (typeof (SslWriteFunc))]
-#endif
unsafe static SslStatus Write (IntPtr connection, IntPtr data, nint* dataLength)
{
var c = (SslConnection) GCHandle.FromIntPtr (connection).Target!;
@@ -122,14 +90,12 @@ unsafe static SslStatus Write (IntPtr connection, IntPtr data, nint* dataLength)
}
-#if NET
/// Class that allows reading and writing to an SSL stream connection.
/// To be added.
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
-#endif
// a concrete connection based on a managed Stream
public class SslStreamConnection : SslConnection {
diff --git a/src/Security/SslContext.cs b/src/Security/SslContext.cs
index b266e95feedb..7fcd12ad582b 100644
--- a/src/Security/SslContext.cs
+++ b/src/Security/SslContext.cs
@@ -21,27 +21,17 @@
using Foundation;
using ObjCRuntime;
-#if !NET
-using NativeHandle = System.IntPtr;
-#endif
-
namespace Security {
-#if NET
/// Class that encapsulates SSL session state..
/// To be added.
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Network.framework' instead.")]
- [ObsoletedOSPlatform ("maccatalyst13.0", "Use 'Network.framework' instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 10, 15, message: "Use 'Network.framework' instead.")]
- [Deprecated (PlatformName.iOS, 13, 0, message: "Use 'Network.framework' instead.")]
- [Deprecated (PlatformName.TvOS, 13, 0, message: "Use 'Network.framework' instead.")]
-#endif
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Network.framework' instead.")]
public class SslContext : NativeObject {
SslConnection? connection;
@@ -153,14 +143,10 @@ public SslProtocol NegotiatedProtocol {
extern static /* OSStatus */ SslStatus SSLSetConnection (/* SSLContextRef */ IntPtr context, /* SSLConnectionRef */ IntPtr connection);
[DllImport (Constants.SecurityLibrary)]
-#if NET
unsafe extern static /* OSStatus */ SslStatus SSLSetIOFuncs (
/* SSLContextRef */ IntPtr context,
/* SSLReadFunc */ delegate* unmanaged readFunc,
/* SSLWriteFunc */ delegate* unmanaged writeFunc);
-#else
- extern static /* OSStatus */ SslStatus SSLSetIOFuncs (/* SSLContextRef */ IntPtr context, /* SSLReadFunc */ SslReadFunc? readFunc, /* SSLWriteFunc */ SslWriteFunc? writeFunc);
-#endif
/// To be added.
/// To be added.
@@ -356,78 +342,6 @@ public unsafe SslStatus Write (byte [] data, out nint processed)
return result;
}
-
-#if !NET
- [DllImport (Constants.SecurityLibrary)]
- extern unsafe static /* OSStatus */ SslStatus SSLGetNumberSupportedCiphers (/* SSLContextRef */ IntPtr context, /* size_t* */ out nint numCiphers);
-
- [DllImport (Constants.SecurityLibrary)]
- extern unsafe static /* OSStatus */ SslStatus SSLGetSupportedCiphers (/* SSLContextRef */ IntPtr context, SslCipherSuite* ciphers, /* size_t* */ ref nint numCiphers);
-
- public unsafe IList? GetSupportedCiphers ()
- {
- nint n;
- result = SSLGetNumberSupportedCiphers (Handle, out n);
- if ((result != SslStatus.Success) || (n <= 0))
- return null;
-
- var ciphers = new SslCipherSuite [n];
- fixed (SslCipherSuite* p = ciphers) {
- result = SSLGetSupportedCiphers (Handle, p, ref n);
- if (result != SslStatus.Success)
- return null;
- }
- return new List (ciphers);
- }
-
- [DllImport (Constants.SecurityLibrary)]
- extern unsafe static /* OSStatus */ SslStatus SSLGetNumberEnabledCiphers (/* SSLContextRef */ IntPtr context, /* size_t* */ out nint numCiphers);
-
- [DllImport (Constants.SecurityLibrary)]
- extern unsafe static /* OSStatus */ SslStatus SSLGetEnabledCiphers (/* SSLContextRef */ IntPtr context, SslCipherSuite* ciphers, /* size_t* */ ref nint numCiphers);
-
- public unsafe IList? GetEnabledCiphers ()
- {
- nint n;
- result = SSLGetNumberEnabledCiphers (Handle, out n);
- if ((result != SslStatus.Success) || (n <= 0))
- return null;
-
- var ciphers = new SslCipherSuite [n];
- fixed (SslCipherSuite* p = ciphers) {
- result = SSLGetEnabledCiphers (Handle, p, ref n);
- if (result != SslStatus.Success)
- return null;
- }
- return new List (ciphers);
- }
-
- [DllImport (Constants.SecurityLibrary)]
- extern unsafe static /* OSStatus */ SslStatus SSLSetEnabledCiphers (/* SSLContextRef */ IntPtr context, SslCipherSuite* ciphers, /* size_t */ nint numCiphers);
-
- public unsafe SslStatus SetEnabledCiphers (IEnumerable ciphers)
- {
- if (ciphers is null)
- ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (ciphers));
-
- var array = ciphers.ToArray ();
- fixed (SslCipherSuite* p = array)
- result = SSLSetEnabledCiphers (Handle, p, array.Length);
- return result;
- }
-
- [DllImport (Constants.SecurityLibrary)]
- extern unsafe static /* OSStatus */ SslStatus SSLGetNegotiatedCipher (/* SSLContextRef */ IntPtr context, /* SslCipherSuite* */ out SslCipherSuite cipherSuite);
-
- public SslCipherSuite NegotiatedCipher {
- get {
- SslCipherSuite value;
- result = SSLGetNegotiatedCipher (Handle, out value);
- return value;
- }
- }
-#endif
-
[DllImport (Constants.SecurityLibrary)]
extern unsafe static /* OSStatus */ SslStatus SSLGetDatagramWriteSize (/* SSLContextRef */ IntPtr context, /* size_t* */ nint* bufSize);
@@ -619,22 +533,17 @@ public SslClientCertificateState ClientCertificateState {
}
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("macos10.11")]
- [ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
- [ObsoletedOSPlatform ("ios9.0", "The use of different RSA certificates for signing and encryption is no longer allowed.")]
-#else
- [Deprecated (PlatformName.iOS, 9, 0, message: "The use of different RSA certificates for signing and encryption is no longer allowed.")]
- [Deprecated (PlatformName.MacOSX, 10, 11)]
-#endif
+ [ObsoletedOSPlatform ("maccatalyst", "The use of different RSA certificates for signing and encryption is no longer allowed.")]
+ [ObsoletedOSPlatform ("macos", "The use of different RSA certificates for signing and encryption is no longer allowed.")]
+ [ObsoletedOSPlatform ("tvos", "The use of different RSA certificates for signing and encryption is no longer allowed.")]
+ [ObsoletedOSPlatform ("ios", "The use of different RSA certificates for signing and encryption is no longer allowed.")]
[DllImport (Constants.SecurityLibrary)]
extern unsafe static /* OSStatus */ SslStatus SSLSetEncryptionCertificate (/* SSLContextRef */ IntPtr context, /* CFArrayRef */ IntPtr certRefs);
-#if NET
/// To be added.
/// To be added.
/// Developers should not use this deprecated method. Export ciphers are not available anymore.
@@ -644,13 +553,10 @@ public SslClientCertificateState ClientCertificateState {
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("macos10.11", "Export ciphers are not available anymore.")]
- [ObsoletedOSPlatform ("tvos13.0", "Export ciphers are not available anymore.")]
- [ObsoletedOSPlatform ("ios9.0", "Export ciphers are not available anymore.")]
-#else
- [Deprecated (PlatformName.iOS, 9, 0, message: "Export ciphers are not available anymore.")]
- [Deprecated (PlatformName.MacOSX, 10, 11, message: "Export ciphers are not available anymore.")]
-#endif
+ [ObsoletedOSPlatform ("maccatalyst", "Export ciphers are not available anymore.")]
+ [ObsoletedOSPlatform ("macos", "Export ciphers are not available anymore.")]
+ [ObsoletedOSPlatform ("tvos", "Export ciphers are not available anymore.")]
+ [ObsoletedOSPlatform ("ios", "Export ciphers are not available anymore.")]
public SslStatus SetEncryptionCertificate (SecIdentity identify, IEnumerable certificates)
{
using (var array = Bundle (identify, certificates)) {
@@ -692,7 +598,6 @@ public static IntPtr GetTypeId ()
// Xcode 8 beta 1: the P/Invoke was removed completely.
#if !XAMCORE_5_0
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -701,10 +606,6 @@ public static IntPtr GetTypeId ()
[UnsupportedOSPlatform ("tvos")]
[UnsupportedOSPlatform ("ios")]
[UnsupportedOSPlatform ("macos")]
-#else
- [Unavailable (PlatformName.iOS, message: "'SetSessionStrengthPolicy' is not available anymore.")]
- [Unavailable (PlatformName.MacOSX, message: "'SetSessionStrengthPolicy' is not available anymore.")]
-#endif
[Obsolete ("'SetSessionStrengthPolicy' is not available anymore.")]
[EditorBrowsable (EditorBrowsableState.Never)]
public SslStatus SetSessionStrengthPolicy (SslSessionStrengthPolicy policyStrength)
@@ -714,19 +615,17 @@ public SslStatus SetSessionStrengthPolicy (SslSessionStrengthPolicy policyStreng
}
#endif // !XAMCORE_5_0
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Network.framework' instead.")]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern int SSLSetSessionConfig (IntPtr /* SSLContextRef* */ context, IntPtr /* CFStringRef* */ config);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -735,10 +634,10 @@ public SslStatus SetSessionStrengthPolicy (SslSessionStrengthPolicy policyStreng
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Network.framework' instead.")]
-#endif
[EditorBrowsable (EditorBrowsableState.Advanced)]
public int SetSessionConfig (NSString config)
{
@@ -750,7 +649,6 @@ public int SetSessionConfig (NSString config)
return result;
}
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -759,28 +657,26 @@ public int SetSessionConfig (NSString config)
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Network.framework' instead.")]
-#endif
public int SetSessionConfig (SslSessionConfig config)
{
return SetSessionConfig (config.GetConstant ()!);
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Network.framework' instead.")]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern int SSLReHandshake (IntPtr /* SSLContextRef* */ context);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -788,40 +684,37 @@ public int SetSessionConfig (SslSessionConfig config)
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Network.framework' instead.")]
-#endif
public int ReHandshake ()
{
return SSLReHandshake (Handle);
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Network.framework' instead.")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe static extern /* OSStatus */ SslStatus SSLCopyRequestedPeerName (IntPtr /* SSLContextRef* */ context, byte* /* char* */ peerName, nuint* /* size_t */ peerNameLen);
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Network.framework' instead.")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe static extern /* OSStatus */ SslStatus SSLCopyRequestedPeerNameLength (IntPtr /* SSLContextRef* */ context, nuint* /* size_t */ peerNameLen);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -829,10 +722,10 @@ public int ReHandshake ()
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Network.framework' instead.")]
-#endif
public string GetRequestedPeerName ()
{
var result = String.Empty;
@@ -849,19 +742,17 @@ public string GetRequestedPeerName ()
return result;
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Network.framework' instead.")]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern /* OSStatus */ int SSLSetSessionTicketsEnabled (IntPtr /* SSLContextRef */ context, byte /* Boolean */ enabled);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -870,28 +761,26 @@ public string GetRequestedPeerName ()
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Network.framework' instead.")]
-#endif
public int SetSessionTickets (bool enabled)
{
return SSLSetSessionTicketsEnabled (Handle, enabled.AsByte ());
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Network.framework' instead.")]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern /* OSStatus */ int SSLSetError (IntPtr /* SSLContextRef */ context, SecStatusCode /* OSStatus */ status);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -900,28 +789,26 @@ public int SetSessionTickets (bool enabled)
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Network.framework' instead.")]
-#endif
public int SetError (SecStatusCode status)
{
return SSLSetError (Handle, status);
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Network.framework' instead.")]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern /* OSStatus */ int SSLSetOCSPResponse (IntPtr /* SSLContextRef */ context, IntPtr /* CFDataRef __nonnull */ response);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -930,10 +817,10 @@ public int SetError (SecStatusCode status)
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Network.framework' instead.")]
-#endif
public int SetOcspResponse (NSData response)
{
if (response is null)
@@ -943,19 +830,17 @@ public int SetOcspResponse (NSData response)
return result;
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Network.framework' instead.")]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern /* OSStatus */ int SSLSetALPNProtocols (IntPtr /* SSLContextRef */ context, IntPtr /* CFArrayRef */ protocols);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -964,29 +849,27 @@ public int SetOcspResponse (NSData response)
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Network.framework' instead.")]
-#endif
public int SetAlpnProtocols (string [] protocols)
{
using (var array = NSArray.FromStrings (protocols))
return SSLSetALPNProtocols (Handle, array.Handle);
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Network.framework' instead.")]
-#endif
[DllImport (Constants.SecurityLibrary)]
unsafe static extern /* OSStatus */ int SSLCopyALPNProtocols (IntPtr /* SSLContextRef */ context, IntPtr* /* CFArrayRef* */ protocols);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -995,10 +878,10 @@ public int SetAlpnProtocols (string [] protocols)
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Network.framework' instead.")]
-#endif
public string? [] GetAlpnProtocols (out int error)
{
@@ -1011,7 +894,6 @@ public int SetAlpnProtocols (string [] protocols)
return CFArray.StringArrayFromHandle (protocols, true)!;
}
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -1019,10 +901,10 @@ public int SetAlpnProtocols (string [] protocols)
[SupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
- [ObsoletedOSPlatform ("macos10.15", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'Network.framework' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("tvos13.0", "Use 'Network.framework' instead.")]
[ObsoletedOSPlatform ("ios13.0", "Use 'Network.framework' instead.")]
-#endif
public string? [] GetAlpnProtocols ()
{
int error;
diff --git a/src/Security/Trust.cs b/src/Security/Trust.cs
index 62f8c5bde4e6..4f037f65fd7c 100644
--- a/src/Security/Trust.cs
+++ b/src/Security/Trust.cs
@@ -37,22 +37,11 @@
using ObjCRuntime;
using CoreFoundation;
using Foundation;
-#if NET
-#else
-using NativeHandle = System.IntPtr;
-#endif
namespace Security {
/// A trust level. A trust object combines a certificate with a policy or policies.
/// To be added.
public partial class SecTrust : NativeObject {
-#if !NET
- public SecTrust (NativeHandle handle)
- : base (handle, false)
- {
- }
-#endif
-
[Preserve (Conditional = true)]
internal SecTrust (NativeHandle handle, bool owns)
: base (handle, owns)
@@ -166,23 +155,17 @@ void Initialize (IntPtr certHandle, SecPolicy? policy)
InitializeHandle (handle);
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("tvos12.1", "Use 'SecTrust.Evaluate (out NSError)' instead.")]
- [ObsoletedOSPlatform ("macos10.14.1", "Use 'SecTrust.Evaluate (out NSError)' instead.")]
- [ObsoletedOSPlatform ("ios12.1", "Use 'SecTrust.Evaluate (out NSError)' instead.")]
-#else
- [Deprecated (PlatformName.iOS, 12, 1, message: "Use 'SecTrust.Evaluate (out NSError)' instead.")]
- [Deprecated (PlatformName.TvOS, 12, 1, message: "Use 'SecTrust.Evaluate (out NSError)' instead.")]
- [Deprecated (PlatformName.MacOSX, 10, 14, 1, message: "Use 'SecTrust.Evaluate (out NSError)' instead.")]
-#endif
+ [ObsoletedOSPlatform ("tvos", "Use 'SecTrust.Evaluate (out NSError)' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'SecTrust.Evaluate (out NSError)' instead.")]
+ [ObsoletedOSPlatform ("ios", "Use 'SecTrust.Evaluate (out NSError)' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'SecTrust.Evaluate (out NSError)' instead.")]
[DllImport (Constants.SecurityLibrary)]
unsafe extern static SecStatusCode /* OSStatus */ SecTrustEvaluate (IntPtr /* SecTrustRef */ trust, /* SecTrustResultType */ SecTrustResult* result);
-#if NET
/// Evaluate the trust of the certificate using the policy.
/// A code that describe if the certificate can be trusted and, if so, under which circumstances.
/// In general both Proceed and Unspecified means you can trust the certificate, other values means it should not be trusted.
@@ -190,14 +173,10 @@ void Initialize (IntPtr certHandle, SecPolicy? policy)
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("tvos12.1", "Use 'SecTrust.Evaluate (out NSError)' instead.")]
- [ObsoletedOSPlatform ("macos10.14.1", "Use 'SecTrust.Evaluate (out NSError)' instead.")]
- [ObsoletedOSPlatform ("ios12.1", "Use 'SecTrust.Evaluate (out NSError)' instead.")]
-#else
- [Deprecated (PlatformName.iOS, 12, 1, message: "Use 'SecTrust.Evaluate (out NSError)' instead.")]
- [Deprecated (PlatformName.TvOS, 12, 1, message: "Use 'SecTrust.Evaluate (out NSError)' instead.")]
- [Deprecated (PlatformName.MacOSX, 10, 14, 1, message: "Use 'SecTrust.Evaluate (out NSError)' instead.")]
-#endif
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'SecTrust.Evaluate (out NSError)' instead.")]
+ [ObsoletedOSPlatform ("tvos", "Use 'SecTrust.Evaluate (out NSError)' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'SecTrust.Evaluate (out NSError)' instead.")]
+ [ObsoletedOSPlatform ("ios", "Use 'SecTrust.Evaluate (out NSError)' instead.")]
public SecTrustResult Evaluate ()
{
SecTrustResult trust;
@@ -224,39 +203,25 @@ public int Count {
}
}
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("macos12.0")]
- [ObsoletedOSPlatform ("maccatalyst15.0")]
+ [ObsoletedOSPlatform ("macos")]
+ [ObsoletedOSPlatform ("maccatalyst")]
[ObsoletedOSPlatform ("tvos15.0")]
[ObsoletedOSPlatform ("ios15.0")]
-#else
- [Deprecated (PlatformName.MacOSX, 12, 0)]
- [Deprecated (PlatformName.iOS, 15, 0)]
- [Deprecated (PlatformName.MacCatalyst, 15, 0)]
- [Deprecated (PlatformName.TvOS, 15, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
extern static IntPtr /* SecCertificateRef */ SecTrustGetCertificateAtIndex (IntPtr /* SecTrustRef */ trust, nint /* CFIndex */ ix);
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("macos12.0", "Use the 'GetCertificateChain' method instead.")]
- [ObsoletedOSPlatform ("maccatalyst15.0", "Use the 'GetCertificateChain' method instead.")]
+ [ObsoletedOSPlatform ("macos", "Use the 'GetCertificateChain' method instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use the 'GetCertificateChain' method instead.")]
[ObsoletedOSPlatform ("tvos15.0", "Use the 'GetCertificateChain' method instead.")]
[ObsoletedOSPlatform ("ios15.0", "Use the 'GetCertificateChain' method instead.")]
-#else
- [Deprecated (PlatformName.MacOSX, 12, 0, message: "Use the 'GetCertificateChain' method instead.")]
- [Deprecated (PlatformName.iOS, 15, 0, message: "Use the 'GetCertificateChain' method instead.")]
- [Deprecated (PlatformName.MacCatalyst, 15, 0, message: "Use the 'GetCertificateChain' method instead.")]
- [Deprecated (PlatformName.TvOS, 15, 0, message: "Use the 'GetCertificateChain' method instead.")]
-#endif
public SecCertificate this [nint index] {
get {
if ((index < 0) || (index >= Count))
@@ -266,50 +231,31 @@ public SecCertificate this [nint index] {
}
}
-#if NET
[SupportedOSPlatform ("tvos15.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios15.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (15, 0)]
- [iOS (15, 0)]
- [MacCatalyst (15, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
static extern /* CFArrayRef */ IntPtr SecTrustCopyCertificateChain (/* SecTrustRef */ IntPtr trust);
-#if NET
[SupportedOSPlatform ("tvos15.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios15.0")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [TV (15, 0)]
- [iOS (15, 0)]
- [MacCatalyst (15, 0)]
-#endif
public SecCertificate [] GetCertificateChain ()
=> NSArray.ArrayFromHandle (SecTrustCopyCertificateChain (Handle));
-#if NET
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("macos11.0")]
+ [ObsoletedOSPlatform ("macos")]
[ObsoletedOSPlatform ("tvos14.0")]
[ObsoletedOSPlatform ("ios14.0")]
- [ObsoletedOSPlatform ("maccatalyst14.0")]
-#else
- [Deprecated (PlatformName.iOS, 14, 0)]
- [Deprecated (PlatformName.MacOSX, 11, 0)]
- [Deprecated (PlatformName.TvOS, 14, 0)]
-#endif
+ [ObsoletedOSPlatform ("maccatalyst")]
[DllImport (Constants.SecurityLibrary)]
extern static IntPtr /* SecKeyRef */ SecTrustCopyPublicKey (IntPtr /* SecTrustRef */ trust);
-#if NET
/// Get the public key of the evaluated certificate.
/// A SecKey instance of the certificate's public key.
///
@@ -318,57 +264,38 @@ public SecCertificate [] GetCertificateChain ()
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos")]
- [ObsoletedOSPlatform ("macos11.0", "Use 'GetKey' instead.")]
+ [ObsoletedOSPlatform ("maccatalyst", "Use 'GetKey' instead.")]
+ [ObsoletedOSPlatform ("macos", "Use 'GetKey' instead.")]
[ObsoletedOSPlatform ("tvos14.0", "Use 'GetKey' instead.")]
[ObsoletedOSPlatform ("ios14.0", "Use 'GetKey' instead.")]
-#else
- [Deprecated (PlatformName.iOS, 14, 0, message: "Use 'GetKey' instead.")]
- [Deprecated (PlatformName.MacOSX, 11, 0, message: "Use 'GetKey' instead.")]
- [Deprecated (PlatformName.TvOS, 14, 0, message: "Use 'GetKey' instead.")]
-#endif
public SecKey GetPublicKey ()
{
return new SecKey (SecTrustCopyPublicKey (GetCheckedHandle ()), true);
}
-#if NET
[SupportedOSPlatform ("ios14.0")]
[SupportedOSPlatform ("tvos14.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [iOS (14, 0)]
- [TV (14, 0)]
- [MacCatalyst (14, 0)]
-#endif
[DllImport (Constants.SecurityLibrary)]
extern static IntPtr /* SecKeyRef */ SecTrustCopyKey (IntPtr /* SecTrustRef */ trust);
-#if NET
[SupportedOSPlatform ("ios14.0")]
[SupportedOSPlatform ("tvos14.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("maccatalyst")]
-#else
- [iOS (14, 0)]
- [TV (14, 0)]
- [MacCatalyst (14, 0)]
-#endif
public SecKey GetKey ()
{
return new SecKey (SecTrustCopyKey (GetCheckedHandle ()), true);
}
-#if NET
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
[DllImport (Constants.SecurityLibrary)]
extern static IntPtr /* CFDataRef */ SecTrustCopyExceptions (IntPtr /* SecTrustRef */ trust);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -376,22 +303,18 @@ public SecKey GetKey ()
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
public NSData? GetExceptions ()
{
return Runtime.GetNSObject (SecTrustCopyExceptions (GetCheckedHandle ()), true);
}
-#if NET
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
[DllImport (Constants.SecurityLibrary)]
extern static byte SecTrustSetExceptions (IntPtr /* SecTrustRef */ trust, IntPtr /* __nullable CFDataRef */ exceptions);
-#if NET
/// To be added.
/// To be added.
/// To be added.
@@ -400,7 +323,6 @@ public SecKey GetKey ()
[SupportedOSPlatform ("ios")]
[SupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("tvos")]
-#endif
public bool SetExceptions (NSData data)
{
bool result = SecTrustSetExceptions (GetCheckedHandle (), data.GetHandle ()) != 0;
diff --git a/tests/cecil-tests/ApiAvailabilityTest.KnownFailures.cs b/tests/cecil-tests/ApiAvailabilityTest.KnownFailures.cs
index b4adfa199859..254c14664a7a 100644
--- a/tests/cecil-tests/ApiAvailabilityTest.KnownFailures.cs
+++ b/tests/cecil-tests/ApiAvailabilityTest.KnownFailures.cs
@@ -32,28 +32,13 @@ public partial class ApiAvailabilityTest {
"/src/Foundation/NSUrlSessionHandler.cs has 12 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'NSUrlSessionHandler.ClientCertificateOptions' is unsupported on: 'ios' all versions, 'maccatalyst' all versions, 'macOS/OSX' all versions, 'tvos' all versions. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)",
"/src/Foundation/NSUrlSessionHandler.cs has 20 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'NSUrlSessionConfiguration.TLSMinimumSupportedProtocol' is obsoleted on: 'ios' 13.0 and later (Use 'TlsMinimumSupportedProtocolVersion' instead.), 'maccatalyst' 13.0 and later (Use 'TlsMinimumSupportedProtocolVersion' instead.), 'macOS/OSX' 10.15 and later (Use 'TlsMinimumSupportedProtocolVersion' instead.), 'tvos' 13.0 and later (Use 'TlsMinimumSupportedProtocolVersion' instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
"/src/Foundation/NSUrlSessionHandler.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecTrust.GetCertificateChain()' is supported on: 'ios' 15.0 and later, 'tvos' 15.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)",
- "/src/Foundation/NSUrlSessionHandler.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecTrust.this[nint]' is obsoleted on: 'ios' 15.0 and later (Use the 'GetCertificateChain' method instead.), 'maccatalyst' 15.0 and later (Use the 'GetCertificateChain' method instead.), 'macOS/OSX' 12.0 and later (Use the 'GetCertificateChain' method instead.), 'tvos' 15.0 and later (Use the 'GetCertificateChain' method instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
+ "/src/Foundation/NSUrlSessionHandler.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecTrust.this[nint]' is obsoleted on: 'ios' 15.0 and later (Use the 'GetCertificateChain' method instead.), 'maccatalyst' all versions, 'macOS/OSX' all versions, 'tvos' 15.0 and later (Use the 'GetCertificateChain' method instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
"/src/Foundation/NSUrlSessionHandler.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SslProtocol.Ssl_3_0' is obsoleted on: 'ios' 13.0 and later (Use 'TlsProtocolVersion' instead.), 'maccatalyst' 13.0 and later (Use 'TlsProtocolVersion' instead.), 'macOS/OSX' 10.15 and later (Use 'TlsProtocolVersion' instead.), 'tvos' 13.0 and later (Use 'TlsProtocolVersion' instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
"/src/Foundation/NSUrlSessionHandler.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SslProtocol.Tls_1_0' is obsoleted on: 'ios' 13.0 and later (Use 'TlsProtocolVersion' instead.), 'maccatalyst' 13.0 and later (Use 'TlsProtocolVersion' instead.), 'macOS/OSX' 10.15 and later (Use 'TlsProtocolVersion' instead.), 'tvos' 13.0 and later (Use 'TlsProtocolVersion' instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
"/src/Foundation/NSUrlSessionHandler.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SslProtocol.Tls_1_1' is obsoleted on: 'ios' 13.0 and later (Use 'TlsProtocolVersion' instead.), 'maccatalyst' 13.0 and later (Use 'TlsProtocolVersion' instead.), 'macOS/OSX' 10.15 and later (Use 'TlsProtocolVersion' instead.), 'tvos' 13.0 and later (Use 'TlsProtocolVersion' instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
"/src/Foundation/NSUrlSessionHandler.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SslProtocol.Tls_1_2' is obsoleted on: 'ios' 13.0 and later (Use 'TlsProtocolVersion' instead.), 'maccatalyst' 13.0 and later (Use 'TlsProtocolVersion' instead.), 'macOS/OSX' 10.15 and later (Use 'TlsProtocolVersion' instead.), 'tvos' 13.0 and later (Use 'TlsProtocolVersion' instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
"/src/Foundation/NSUrlSessionHandler.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SslProtocol.Tls_1_3' is obsoleted on: 'ios' 13.0 and later (Use 'TlsProtocolVersion' instead.), 'maccatalyst' 13.0 and later (Use 'TlsProtocolVersion' instead.), 'macOS/OSX' 10.15 and later (Use 'TlsProtocolVersion' instead.), 'tvos' 13.0 and later (Use 'TlsProtocolVersion' instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
"/src/GameController/GCExtendedGamepadSnapshot.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'GCExtendedGamepadSnapShotDataV100' is obsoleted on: 'ios' 12.2 and later (Use 'GCExtendedGamepadSnapshotData' instead.), 'maccatalyst' 12.2 and later (Use 'GCExtendedGamepadSnapshotData' instead.), 'macOS/OSX' 10.14.4 and later (Use 'GCExtendedGamepadSnapshotData' instead.), 'tvos' 12.2 and later (Use 'GCExtendedGamepadSnapshotData' instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
- "/src/Security/Certificate.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecKey.GenerateKeyPair(NSDictionary, out SecKey?, out SecKey?)' is obsoleted on: 'ios' 15.0 and later (Use 'CreateRandomKey' instead.), 'maccatalyst' 15.0 and later (Use 'CreateRandomKey' instead.), 'macOS/OSX' 12.0 and later (Use 'CreateRandomKey' instead.), 'tvos' 15.0 and later (Use 'CreateRandomKey' instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
- "/src/Security/Certificate.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecKey.SecKeyDecrypt(nint, SecPadding, nint, nint, nint, nint*)' is obsoleted on: 'ios' 15.0 and later (Use 'SecKeyCreateDecryptedData' instead.), 'maccatalyst' 15.0 and later (Use 'SecKeyCreateDecryptedData' instead.), 'tvos' 15.0 and later (Use 'SecKeyCreateDecryptedData' instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
- "/src/Security/Certificate.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecKey.SecKeyEncrypt(nint, SecPadding, nint, nint, nint, nint*)' is obsoleted on: 'ios' 15.0 and later (Use 'SecKeyCreateEncryptedData' instead.), 'maccatalyst' 15.0 and later (Use 'SecKeyCreateEncryptedData' instead.), 'tvos' 15.0 and later (Use 'SecKeyCreateEncryptedData' instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
- "/src/Security/Certificate.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecKey.SecKeyRawSign(nint, SecPadding, nint, nint, nint, nint*)' is obsoleted on: 'ios' 15.0 and later (Use 'SecKeyCreateSignature' instead.), 'maccatalyst' 15.0 and later (Use 'SecKeyCreateSignature' instead.), 'tvos' 15.0 and later (Use 'SecKeyCreateSignature' instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
- "/src/Security/Certificate.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecKey.SecKeyRawVerify(nint, SecPadding, nint, nint, nint, nint)' is obsoleted on: 'ios' 15.0 and later (Use 'SecKeyVerifySignature' instead.), 'maccatalyst' 15.0 and later (Use 'SecKeyVerifySignature' instead.), 'tvos' 15.0 and later (Use 'SecKeyVerifySignature' instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
- "/src/Security/Items.cs has 1 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecKeyChain.SecKeychainAddGenericPassword(nint, int, byte[]?, int, byte[]?, int, byte[], nint)' is obsoleted on: 'macOS/OSX' 10.10 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
- "/src/Security/Items.cs has 1 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecKeyChain.SecKeychainAddInternetPassword(nint, int, byte[]?, int, byte[]?, int, byte[]?, int, byte[]?, short, nint, nint, int, byte[], nint)' is obsoleted on: 'macOS/OSX' 10.10 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
- "/src/Security/Items.cs has 1 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecKeyChain.SecKeychainFindGenericPassword(nint, int, byte*, int, byte*, int*, nint*, nint)' is obsoleted on: 'macOS/OSX' 10.10 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
- "/src/Security/Items.cs has 1 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecKeyChain.SecKeychainFindInternetPassword(nint, int, byte*, int, byte*, int, byte*, int, byte*, short, nint, nint, int*, nint*, nint)' is obsoleted on: 'macOS/OSX' 10.10 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
- "/src/Security/Items.cs has 2 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecKeyChain.SecKeychainItemFreeContent(nint, nint)' is obsoleted on: 'macOS/OSX' 10.10 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
- "/src/Security/Items.cs has 6 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecItem.UseOperationPrompt.get' is obsoleted on: 'ios' 14.0 and later (Use 'LAContext.InteractionNotAllowed' instead.), 'maccatalyst' 14.0 and later (Use 'LAContext.InteractionNotAllowed' instead.), 'macOS/OSX' 11.0 and later (Use 'LAContext.InteractionNotAllowed' instead.), 'tvos' 14.0 and later (Use 'LAContext.InteractionNotAllowed' instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
- "/src/Security/Items.cs has 6 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecItem.UseOperationPrompt' is obsoleted on: 'ios' 14.0 and later (Use 'LAContext.InteractionNotAllowed' instead.), 'maccatalyst' 14.0 and later (Use 'LAContext.InteractionNotAllowed' instead.), 'macOS/OSX' 11.0 and later (Use 'LAContext.InteractionNotAllowed' instead.), 'tvos' 14.0 and later (Use 'LAContext.InteractionNotAllowed' instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
- "/src/Security/Items.cs has 8 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecAccessible.Always' is obsoleted on: 'ios' 12.0 and later (Use 'AfterFirstUnlock' or a better suited option instead.), 'maccatalyst' 12.0 and later (Use 'AfterFirstUnlock' or a better suited option instead.), 'macOS/OSX' 10.14 and later (Use 'AfterFirstUnlock' or a better suited option instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
- "/src/Security/Items.cs has 8 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecAccessible.AlwaysThisDeviceOnly' is obsoleted on: 'ios' 12.0 and later (Use 'AfterFirstUnlockThisDeviceOnly' or a better suited option instead.), 'maccatalyst' 12.0 and later (Use 'AfterFirstUnlockThisDeviceOnly' or a better suited option instead.), 'macOS/OSX' 10.14 and later (Use 'AfterFirstUnlockThisDeviceOnly' or a better suited option instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
- "/src/Security/SecProtocolOptions.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SecProtocolOptions.sec_protocol_options_set_tls_diffie_hellman_parameters(nint, nint)' is obsoleted on: 'ios' 13.0 and later (Use non-DHE cipher suites instead.), 'maccatalyst' 13.0 and later (Use non-DHE cipher suites instead.), 'macOS/OSX' 10.15 and later (Use non-DHE cipher suites instead.), 'tvos' 13.0 and later (Use non-DHE cipher suites instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
"/src/SpriteKit/SKUniform.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SKUniform.InitWithNameFloatVector2(string, Vector2)' is obsoleted on: 'ios' 10.0 and later, 'maccatalyst' 10.0 and later, 'macOS/OSX' 10.12 and later, 'tvos' 10.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
"/src/SpriteKit/SKUniform.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SKUniform.InitWithNameFloatVector3(string, Vector3)' is obsoleted on: 'ios' 10.0 and later, 'maccatalyst' 10.0 and later, 'macOS/OSX' 10.12 and later, 'tvos' 10.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
"/src/SpriteKit/SKUniform.cs has 4 occurrences of This call site is reachable on: 'ios' 12.2 and later, 'maccatalyst' 12.2 and later, 'macOS/OSX' 12.0 and later, 'tvos' 12.2 and later. 'SKUniform.InitWithNameFloatVector4(string, Vector4)' is obsoleted on: 'ios' 10.0 and later, 'maccatalyst' 10.0 and later, 'macOS/OSX' 10.12 and later, 'tvos' 10.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)",
diff --git a/tests/cecil-tests/ApiAvailabilityTest.cs b/tests/cecil-tests/ApiAvailabilityTest.cs
index e382b15ccc1a..520ef3726772 100644
--- a/tests/cecil-tests/ApiAvailabilityTest.cs
+++ b/tests/cecil-tests/ApiAvailabilityTest.cs
@@ -69,7 +69,7 @@ public void Warnings ()
} finally {
Console.WriteLine ($"There's a total of {totalWarnings} warnings.");
}
- Assert.AreEqual (445, totalWarnings, "Total warnings"); // this is just to see how the warning count changes as issues are fixed.
+ Assert.AreEqual (387, totalWarnings, "Total warnings"); // this is just to see how the warning count changes as issues are fixed.
}
public record ObsoletedFailure : IComparable {
@@ -228,31 +228,6 @@ public void FindMissingObsoleteAttributes ()
"MobileCoreServices.UTType.IsDynamic(System.String)",
"PassKit.PKShareablePassMetadata..ctor(System.String, System.String, CoreGraphics.CGImage, System.String, System.String, System.String, System.String, System.String, System.Boolean)",
"PassKit.PKShareablePassMetadata..ctor(System.String, System.String, System.String, CoreGraphics.CGImage, System.String, System.String)",
- "Security.Authorization.ExecuteWithPrivileges(System.String, Security.AuthorizationFlags, System.String[])",
- "Security.SecAccessible Security.SecAccessible::Always",
- "Security.SecAccessible Security.SecAccessible::AlwaysThisDeviceOnly",
- "Security.SecCertificate.GetSerialNumber()",
- "Security.SecKey.Decrypt(Security.SecPadding, System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr&)",
- "Security.SecKey.Encrypt(Security.SecPadding, System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr&)",
- "Security.SecKey.RawSign(Security.SecPadding, System.IntPtr, System.Int32, out System.Byte[]&)",
- "Security.SecKey.RawVerify(Security.SecPadding, System.IntPtr, System.Int32, System.IntPtr, System.Int32)",
- "Security.SecProtocolOptions.AddTlsCipherSuiteGroup(Security.SslCipherSuiteGroup)",
- "Security.SecSharedCredential.RequestSharedWebCredential(System.String, System.String, System.Action`2)",
- "Security.SecTrust.Evaluate()",
- "Security.SecTrust.Evaluate(CoreFoundation.DispatchQueue, Security.SecTrustCallback)",
- "Security.SecTrust.GetPublicKey()",
- "Security.SslContext.GetAlpnProtocols()",
- "Security.SslContext.GetAlpnProtocols(out System.Int32&)",
- "Security.SslContext.GetRequestedPeerName()",
- "Security.SslContext.ReHandshake()",
- "Security.SslContext.SetAlpnProtocols(System.String[])",
- "Security.SslContext.SetEncryptionCertificate(Security.SecIdentity, System.Collections.Generic.IEnumerable`1)",
- "Security.SslContext.SetError(Security.SecStatusCode)",
- "Security.SslContext.SetOcspResponse(Foundation.NSData)",
- "Security.SslContext.SetSessionConfig(Foundation.NSString)",
- "Security.SslContext.SetSessionConfig(Security.SslSessionConfig)",
- "Security.SslContext.SetSessionTickets(System.Boolean)",
- "Security.SslProtocol Security.SecProtocolMetadata::NegotiatedProtocolVersion()",
"Speech.SFVoiceAnalytics Speech.SFTranscriptionSegment::VoiceAnalytics()",
"System.Boolean AVFoundation.AVCaptureConnection::SupportsVideoMaxFrameDuration()",
"System.Boolean AVFoundation.AVCaptureConnection::SupportsVideoMinFrameDuration()",
@@ -261,7 +236,6 @@ public void FindMissingObsoleteAttributes ()
"System.Boolean AVFoundation.AVCaptureResolvedPhotoSettings::DualCameraFusionEnabled()",
"System.Boolean CoreGraphics.CGColorSpace::IsHdr()",
"System.Boolean NetworkExtension.NEFilterProviderConfiguration::FilterBrowsers()",
- "System.Boolean Security.SecRecord::UseNoAuthenticationUI()",
"System.Double Speech.SFTranscription::AveragePauseDuration()",
"System.Double Speech.SFTranscription::SpeakingRate()",
"System.String PassKit.PKAddShareablePassConfiguration::ProvisioningPolicyIdentifier()",
diff --git a/tests/xtro-sharpie/api-annotations-dotnet/macOS-Security.ignore b/tests/xtro-sharpie/api-annotations-dotnet/macOS-Security.ignore
index 8120732dc912..d93f9bedbf27 100644
--- a/tests/xtro-sharpie/api-annotations-dotnet/macOS-Security.ignore
+++ b/tests/xtro-sharpie/api-annotations-dotnet/macOS-Security.ignore
@@ -1,4 +1,5 @@
## Not declared in header for macOS unlike iOS but in Security.framework anyway (via nm)
+## These P/Invokes have been removed in XAMCORE_5_0
!unknown-pinvoke! SecKeyDecrypt bound
!unknown-pinvoke! SecKeyEncrypt bound
!unknown-pinvoke! SecKeyRawSign bound