コード例 #1
0
ファイル: AppleTlsContext.cs プロジェクト: u3dkbe/mono
        CFArray Bundle(SecIdentity identity, IEnumerable <SecCertificate> certificates)
        {
            if (identity == null)
            {
                throw new ArgumentNullException("identity");
            }
            int i = 0;

            int n = 0;

            if (certificates != null)
            {
                foreach (var obj in certificates)
                {
                    n++;
                }
            }

            var ptrs = new IntPtr [n + 1];

            ptrs [0] = identity.Handle;
            foreach (var certificate in certificates)
            {
                ptrs [++i] = certificate.Handle;
            }
            return(CFArray.CreateArray(ptrs));
        }
コード例 #2
0
ファイル: Trust.cs プロジェクト: SickheadGames/BRUTE.mono
        void Initialize(SafeSecCertificateHandle[] array, SecPolicy policy)
        {
            var handles = new IntPtr [array.Length];

            for (int i = 0; i < array.Length; i++)
            {
                handles [i] = array [i].DangerousGetHandle();
            }
            using (var certs = CFArray.CreateArray(handles)) {
                Initialize(certs.Handle, policy);
            }
        }
コード例 #3
0
ファイル: Trust.cs プロジェクト: SickheadGames/BRUTE.mono
        public SecStatusCode SetAnchorCertificates(SafeSecCertificateHandle[] array)
        {
            if (array == null)
            {
                return(SecTrustSetAnchorCertificates(handle, IntPtr.Zero));
            }
            var handles = new IntPtr [array.Length];

            for (int i = 0; i < array.Length; i++)
            {
                handles [i] = array [i].DangerousGetHandle();
            }
            using (var certs = CFArray.CreateArray(handles)) {
                return(SecTrustSetAnchorCertificates(handle, certs.Handle));
            }
        }
コード例 #4
0
        CFArray Bundle(SafeSecIdentityHandle identity, IList <SafeSecCertificateHandle> certificates)
        {
            if (identity == null || identity.IsInvalid)
            {
                throw new ArgumentNullException(nameof(identity));
            }
            if (certificates == null)
            {
                throw new ArgumentNullException(nameof(certificates));
            }

            var ptrs = new IntPtr [certificates.Count + 1];

            ptrs [0] = identity.DangerousGetHandle();
            for (int i = 0; i < certificates.Count; i++)
            {
                ptrs [i + 1] = certificates [i].DangerousGetHandle();
            }
            return(CFArray.CreateArray(ptrs));
        }
コード例 #5
0
 void Initialize(SecCertificate[] array, SecPolicy policy)
 {
     using (var certs = CFArray.CreateArray(array)) {
         Initialize(certs.Handle, policy);
     }
 }