| 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 CERT_STATUS_NO_ERROR; |
| 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: |
| 70 case CSSMERR_TP_CERT_NOT_VALID_YET: | 70 case CSSMERR_TP_CERT_NOT_VALID_YET: |
| 71 // "Expired" and "not yet valid" collapse into a single status. | 71 // "Expired" and "not yet valid" collapse into a single status. |
| 72 return CERT_STATUS_DATE_INVALID; | 72 return CERT_STATUS_DATE_INVALID; |
| (...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 CSSM_DATA cert_data; | 1338 CSSM_DATA cert_data; |
| 1339 OSStatus status = SecCertificateGetData(cert_handle, &cert_data); | 1339 OSStatus status = SecCertificateGetData(cert_handle, &cert_data); |
| 1340 if (status) | 1340 if (status) |
| 1341 return false; | 1341 return false; |
| 1342 | 1342 |
| 1343 return pickle->WriteData(reinterpret_cast<char*>(cert_data.Data), | 1343 return pickle->WriteData(reinterpret_cast<char*>(cert_data.Data), |
| 1344 cert_data.Length); | 1344 cert_data.Length); |
| 1345 } | 1345 } |
| 1346 | 1346 |
| 1347 } // namespace net | 1347 } // namespace net |
| OLD | NEW |