Index: net/base/x509_util_mac.cc |
diff --git a/net/base/x509_util_mac.cc b/net/base/x509_util_mac.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c381e0869c53fca86afff4ce99fb5c828480e0ee |
--- /dev/null |
+++ b/net/base/x509_util_mac.cc |
@@ -0,0 +1,31 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "net/base/x509_util_mac.h" |
+ |
+#include "net/base/x509_certificate.h" |
+ |
+namespace net { |
+ |
+namespace x509_util { |
+ |
+CFArrayRef CreateOSCertChainForCert(const X509Certificate* cert) { |
+ CFMutableArrayRef cert_list = |
+ CFArrayCreateMutable(kCFAllocatorDefault, 0, |
+ &kCFTypeArrayCallBacks); |
+ if (!cert_list) |
+ return NULL; |
+ |
+ CFArrayAppendValue(cert_list, cert->os_cert_handle()); |
+ const X509Certificate::OSCertHandles& intermediates = |
+ cert->GetIntermediateCertificates(); |
+ for (size_t i = 0; i < intermediates.size(); ++i) |
+ CFArrayAppendValue(cert_list, intermediates[i]); |
+ |
+ return cert_list; |
+} |
+ |
+} // namespace x509_util |
+ |
+} // namespace net |