public SecTrust(SecCertificate certificate, SecPolicy policy) { if (certificate == null) { throw new ArgumentNullException("certificate"); } Initialize(certificate.Handle, policy); }
public void SetPolicy(SecPolicy policy) { if (policy == null) { throw new ArgumentNullException("policy"); } SetPolicies(policy.Handle); }
void Initialize(IntPtr certHandle, SecPolicy policy) { SecStatusCode result = SecTrustCreateWithCertificates(certHandle, policy == null ? IntPtr.Zero : policy.Handle, out handle); if (result != SecStatusCode.Success) { throw new ArgumentException(result.ToString()); } }
public SecTrust(X509Certificate2 certificate, SecPolicy policy) { if (certificate == null) { throw new ArgumentNullException("certificate"); } using (SecCertificate cert = new SecCertificate(certificate)) { Initialize(cert.Handle, policy); } }
static public SecPolicy CreateSslPolicy(bool server, string hostName) { NSString host = hostName == null ? null : new NSString(hostName); IntPtr handle = host == null ? IntPtr.Zero : host.Handle; SecPolicy policy = new SecPolicy(SecPolicyCreateSSL(server, handle), true); if (host != null) { host.Dispose(); } return(policy); }
public SecTrust(X509CertificateCollection certificates, SecPolicy policy) { if (certificates == null) { throw new ArgumentNullException("certificates"); } SecCertificate[] array = new SecCertificate [certificates.Count]; int i = 0; foreach (var certificate in certificates) { array [i++] = new SecCertificate(certificate); } Initialize(array, policy); }
void Initialize(SecCertificate[] array, SecPolicy policy) { using (var certs = CFArray.FromNativeObjects(array)) { Initialize(certs.Handle, policy); } }