Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(722)

Side by Side Diff: net/base/x509_certificate_mac.cc

Issue 8414047: Make X509Certificate::GetDEREncoded a static function taking an OSCertHandle (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Errant comment Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/x509_certificate.h" 5 #include "net/base/x509_certificate.h"
6 6
7 #include <CommonCrypto/CommonDigest.h> 7 #include <CommonCrypto/CommonDigest.h>
8 #include <CoreServices/CoreServices.h> 8 #include <CoreServices/CoreServices.h>
9 #include <Security/Security.h> 9 #include <Security/Security.h>
10 #include <time.h> 10 #include <time.h>
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 } 961 }
962 } 962 }
963 } 963 }
964 964
965 AppendPublicKeyHashes(completed_chain, &verify_result->public_key_hashes); 965 AppendPublicKeyHashes(completed_chain, &verify_result->public_key_hashes);
966 verify_result->is_issued_by_known_root = IsIssuedByKnownRoot(completed_chain); 966 verify_result->is_issued_by_known_root = IsIssuedByKnownRoot(completed_chain);
967 967
968 return OK; 968 return OK;
969 } 969 }
970 970
971 bool X509Certificate::GetDEREncoded(std::string* encoded) { 971 // static
972 encoded->clear(); 972 bool X509Certificate::GetDEREncoded(X509Certificate::OSCertHandle cert_handle,
973 std::string* encoded) {
973 CSSM_DATA der_data; 974 CSSM_DATA der_data;
974 if (SecCertificateGetData(cert_handle_, &der_data) == noErr) { 975 if (SecCertificateGetData(cert_handle, &der_data) != noErr)
975 encoded->append(reinterpret_cast<char*>(der_data.Data), 976 return false;
976 der_data.Length); 977 encoded->assign(reinterpret_cast<char*>(der_data.Data),
977 return true; 978 der_data.Length);
978 } 979 return true;
979 return false;
980 } 980 }
981 981
982 // static 982 // static
983 bool X509Certificate::IsSameOSCert(X509Certificate::OSCertHandle a, 983 bool X509Certificate::IsSameOSCert(X509Certificate::OSCertHandle a,
984 X509Certificate::OSCertHandle b) { 984 X509Certificate::OSCertHandle b) {
985 DCHECK(a && b); 985 DCHECK(a && b);
986 if (a == b) 986 if (a == b)
987 return true; 987 return true;
988 if (CFEqual(a, b)) 988 if (CFEqual(a, b))
989 return true; 989 return true;
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 CSSM_DATA cert_data; 1365 CSSM_DATA cert_data;
1366 OSStatus status = SecCertificateGetData(cert_handle, &cert_data); 1366 OSStatus status = SecCertificateGetData(cert_handle, &cert_data);
1367 if (status) 1367 if (status)
1368 return false; 1368 return false;
1369 1369
1370 return pickle->WriteData(reinterpret_cast<char*>(cert_data.Data), 1370 return pickle->WriteData(reinterpret_cast<char*>(cert_data.Data),
1371 cert_data.Length); 1371 cert_data.Length);
1372 } 1372 }
1373 1373
1374 } // namespace net 1374 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698