| 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 "chrome/common/net/x509_certificate_model.h" | 5 #include "chrome/common/net/x509_certificate_model.h" |
| 6 | 6 |
| 7 #include <openssl/obj_mac.h> | 7 #include <openssl/obj_mac.h> |
| 8 #include <openssl/sha.h> | 8 #include <openssl/sha.h> |
| 9 #include <openssl/x509v3.h> | 9 #include <openssl/x509v3.h> |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 namespace x509_certificate_model { | 42 namespace x509_certificate_model { |
| 43 | 43 |
| 44 using net::X509Certificate; | 44 using net::X509Certificate; |
| 45 | 45 |
| 46 std::string GetCertNameOrNickname(X509Certificate::OSCertHandle cert_handle) { | 46 std::string GetCertNameOrNickname(X509Certificate::OSCertHandle cert_handle) { |
| 47 // TODO(bulach): implement me. | 47 // TODO(bulach): implement me. |
| 48 return ""; | 48 return ""; |
| 49 } | 49 } |
| 50 | 50 |
| 51 std::string GetNickname(X509Certificate::OSCertHandle cert_handle) { | |
| 52 // TODO(jamescook): implement me. | |
| 53 return ""; | |
| 54 } | |
| 55 | |
| 56 std::string GetTokenName(X509Certificate::OSCertHandle cert_handle) { | 51 std::string GetTokenName(X509Certificate::OSCertHandle cert_handle) { |
| 57 // TODO(bulach): implement me. | 52 // TODO(bulach): implement me. |
| 58 return ""; | 53 return ""; |
| 59 } | 54 } |
| 60 | 55 |
| 61 std::string GetVersion(net::X509Certificate::OSCertHandle cert_handle) { | 56 std::string GetVersion(net::X509Certificate::OSCertHandle cert_handle) { |
| 62 unsigned long version = X509_get_version(cert_handle); | 57 unsigned long version = X509_get_version(cert_handle); |
| 63 if (version != ULONG_MAX) | 58 if (version != ULONG_MAX) |
| 64 return base::UintToString(version + 1); | 59 return base::UintToString(version + 1); |
| 65 return ""; | 60 return ""; |
| 66 } | 61 } |
| 67 | 62 |
| 68 net::CertType GetType(X509Certificate::OSCertHandle os_cert) { | 63 net::CertType GetType(X509Certificate::OSCertHandle os_cert) { |
| 69 // TODO(bulach): implement me. | 64 // TODO(bulach): implement me. |
| 70 return net::OTHER_CERT; | 65 return net::OTHER_CERT; |
| 71 } | 66 } |
| 72 | 67 |
| 73 std::string GetEmailAddress(X509Certificate::OSCertHandle os_cert) { | |
| 74 // TODO(bulach): implement me. | |
| 75 return ""; | |
| 76 } | |
| 77 | |
| 78 void GetUsageStrings(X509Certificate::OSCertHandle cert_handle, | 68 void GetUsageStrings(X509Certificate::OSCertHandle cert_handle, |
| 79 std::vector<std::string>* usages) { | 69 std::vector<std::string>* usages) { |
| 80 // TODO(bulach): implement me. | 70 // TODO(bulach): implement me. |
| 81 } | 71 } |
| 82 | 72 |
| 83 std::string GetKeyUsageString(X509Certificate::OSCertHandle cert_handle) { | |
| 84 // TODO(bulach): implement me. | |
| 85 return ""; | |
| 86 } | |
| 87 | |
| 88 std::string GetSerialNumberHexified( | 73 std::string GetSerialNumberHexified( |
| 89 X509Certificate::OSCertHandle cert_handle, | 74 X509Certificate::OSCertHandle cert_handle, |
| 90 const std::string& alternative_text) { | 75 const std::string& alternative_text) { |
| 91 ASN1_INTEGER* num = X509_get_serialNumber(cert_handle); | 76 ASN1_INTEGER* num = X509_get_serialNumber(cert_handle); |
| 92 const char kSerialNumberSeparator = ':'; | 77 const char kSerialNumberSeparator = ':'; |
| 93 std::string hex_string = ProcessRawBytesWithSeparators( | 78 std::string hex_string = ProcessRawBytesWithSeparators( |
| 94 num->data, num->length, kSerialNumberSeparator, kSerialNumberSeparator); | 79 num->data, num->length, kSerialNumberSeparator, kSerialNumberSeparator); |
| 95 return AlternativeWhenEmpty(hex_string, alternative_text); | 80 return AlternativeWhenEmpty(hex_string, alternative_text); |
| 96 } | 81 } |
| 97 | 82 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 } | 145 } |
| 161 | 146 |
| 162 std::string GetIssuerName(net::X509Certificate::OSCertHandle cert_handle) { | 147 std::string GetIssuerName(net::X509Certificate::OSCertHandle cert_handle) { |
| 163 return GetKeyValuesFromName(X509_get_issuer_name(cert_handle)); | 148 return GetKeyValuesFromName(X509_get_issuer_name(cert_handle)); |
| 164 } | 149 } |
| 165 | 150 |
| 166 std::string GetSubjectName(net::X509Certificate::OSCertHandle cert_handle) { | 151 std::string GetSubjectName(net::X509Certificate::OSCertHandle cert_handle) { |
| 167 return GetKeyValuesFromName(X509_get_subject_name(cert_handle)); | 152 return GetKeyValuesFromName(X509_get_subject_name(cert_handle)); |
| 168 } | 153 } |
| 169 | 154 |
| 170 void GetEmailAddresses(net::X509Certificate::OSCertHandle cert_handle, | |
| 171 std::vector<std::string>* email_addresses) { | |
| 172 // TODO(bulach): implement me. | |
| 173 } | |
| 174 | |
| 175 void GetNicknameStringsFromCertList( | |
| 176 const std::vector<scoped_refptr<net::X509Certificate> >& certs, | |
| 177 const std::string& cert_expired, | |
| 178 const std::string& cert_not_yet_valid, | |
| 179 std::vector<std::string>* nick_names) { | |
| 180 // TODO(bulach): implement me. | |
| 181 } | |
| 182 | |
| 183 void GetExtensions( | 155 void GetExtensions( |
| 184 const std::string& critical_label, | 156 const std::string& critical_label, |
| 185 const std::string& non_critical_label, | 157 const std::string& non_critical_label, |
| 186 net::X509Certificate::OSCertHandle cert_handle, | 158 net::X509Certificate::OSCertHandle cert_handle, |
| 187 Extensions* extensions) { | 159 Extensions* extensions) { |
| 188 // TODO(bulach): implement me. | 160 // TODO(bulach): implement me. |
| 189 } | 161 } |
| 190 | 162 |
| 191 std::string HashCertSHA256(net::X509Certificate::OSCertHandle cert_handle) { | 163 std::string HashCertSHA256(net::X509Certificate::OSCertHandle cert_handle) { |
| 192 unsigned char sha256_data[SHA256_DIGEST_LENGTH] = {0}; | 164 unsigned char sha256_data[SHA256_DIGEST_LENGTH] = {0}; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 // TODO(bulach): implement me. | 225 // TODO(bulach): implement me. |
| 254 return ""; | 226 return ""; |
| 255 } | 227 } |
| 256 | 228 |
| 257 std::string ProcessRawBitsSignatureWrap( | 229 std::string ProcessRawBitsSignatureWrap( |
| 258 net::X509Certificate::OSCertHandle cert_handle) { | 230 net::X509Certificate::OSCertHandle cert_handle) { |
| 259 // TODO(bulach): implement me. | 231 // TODO(bulach): implement me. |
| 260 return ""; | 232 return ""; |
| 261 } | 233 } |
| 262 | 234 |
| 263 void RegisterDynamicOids() { | |
| 264 } | |
| 265 | |
| 266 } // namespace x509_certificate_model | 235 } // namespace x509_certificate_model |
| OLD | NEW |