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)); }
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); } }
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)); } }
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)); }
void Initialize(SecCertificate[] array, SecPolicy policy) { using (var certs = CFArray.CreateArray(array)) { Initialize(certs.Handle, policy); } }