OLD | NEW |
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 case errSecNoPolicyModule: | 49 case errSecNoPolicyModule: |
50 return ERR_NOT_IMPLEMENTED; | 50 return ERR_NOT_IMPLEMENTED; |
51 case errSecAuthFailed: | 51 case errSecAuthFailed: |
52 return ERR_ACCESS_DENIED; | 52 return ERR_ACCESS_DENIED; |
53 default: | 53 default: |
54 LOG(ERROR) << "Unknown error " << status << " mapped to ERR_FAILED"; | 54 LOG(ERROR) << "Unknown error " << status << " mapped to ERR_FAILED"; |
55 return ERR_FAILED; | 55 return ERR_FAILED; |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
59 int CertStatusFromOSStatus(OSStatus status) { | 59 CertStatus CertStatusFromOSStatus(OSStatus status) { |
60 switch (status) { | 60 switch (status) { |
61 case noErr: | 61 case noErr: |
62 return 0; | 62 return 0; |
63 | 63 |
64 case CSSMERR_TP_INVALID_ANCHOR_CERT: | 64 case CSSMERR_TP_INVALID_ANCHOR_CERT: |
65 case CSSMERR_TP_NOT_TRUSTED: | 65 case CSSMERR_TP_NOT_TRUSTED: |
66 case CSSMERR_TP_INVALID_CERT_AUTHORITY: | 66 case CSSMERR_TP_INVALID_CERT_AUTHORITY: |
67 return CERT_STATUS_AUTHORITY_INVALID; | 67 return CERT_STATUS_AUTHORITY_INVALID; |
68 | 68 |
69 case CSSMERR_TP_CERT_EXPIRED: | 69 case CSSMERR_TP_CERT_EXPIRED: |
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1358 CSSM_DATA cert_data; | 1358 CSSM_DATA cert_data; |
1359 OSStatus status = SecCertificateGetData(cert_handle, &cert_data); | 1359 OSStatus status = SecCertificateGetData(cert_handle, &cert_data); |
1360 if (status) | 1360 if (status) |
1361 return false; | 1361 return false; |
1362 | 1362 |
1363 return pickle->WriteData(reinterpret_cast<char*>(cert_data.Data), | 1363 return pickle->WriteData(reinterpret_cast<char*>(cert_data.Data), |
1364 cert_data.Length); | 1364 cert_data.Length); |
1365 } | 1365 } |
1366 | 1366 |
1367 } // namespace net | 1367 } // namespace net |
OLD | NEW |