1 #if MONO_FEATURE_APPLETLS || MONO_FEATURE_APPLE_X509
3 using System
.Runtime
.InteropServices
;
4 using MX
= Mono
.Security
.X509
;
5 using XamMac
.CoreFoundation
;
7 namespace System
.Security
.Cryptography
.X509Certificates
9 static partial class X509Helper
11 public static X509CertificateImpl
InitFromHandleApple (IntPtr handle
)
13 return new X509CertificateImplApple (handle
, false);
16 static X509CertificateImpl
ImportApple (byte[] rawData
)
18 var handle
= CFHelpers
.CreateCertificateFromData (rawData
);
19 if (handle
!= IntPtr
.Zero
)
20 return new X509CertificateImplApple (handle
, true);
22 MX
.X509Certificate x509
;
24 x509
= new MX
.X509Certificate (rawData
);
25 } catch (Exception e
) {
27 x509
= ImportPkcs12 (rawData
, null);
29 string msg
= Locale
.GetText ("Unable to decode certificate.");
30 // inner exception is the original (not second) exception
31 throw new CryptographicException (msg
, e
);
35 return new X509CertificateImplMono (x509
);