OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_util.h" | 5 #include "net/base/x509_util.h" |
6 #include "net/base/x509_util_nss.h" | 6 #include "net/base/x509_util_nss.h" |
7 | 7 |
8 #include <cert.h> | 8 #include <cert.h> |
9 #include <cryptohi.h> | 9 #include <cryptohi.h> |
10 #include <pk11pub.h> | 10 #include <pk11pub.h> |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 if ((cert_handle = CERT_StartCertExtensions(cert)) == NULL) { | 189 if ((cert_handle = CERT_StartCertExtensions(cert)) == NULL) { |
190 LOG(ERROR) << "Unable to get opaque handle for adding extensions"; | 190 LOG(ERROR) << "Unable to get opaque handle for adding extensions"; |
191 CERT_DestroyCertificate(cert); | 191 CERT_DestroyCertificate(cert); |
192 return false; | 192 return false; |
193 } | 193 } |
194 | 194 |
195 // Create SECItem for IA5String encoding. | 195 // Create SECItem for IA5String encoding. |
196 SECItem domain_string_item = { | 196 SECItem domain_string_item = { |
197 siAsciiString, | 197 siAsciiString, |
198 (unsigned char*)domain.data(), | 198 (unsigned char*)domain.data(), |
199 domain.size() | 199 static_cast<unsigned>(domain.size()) |
200 }; | 200 }; |
201 | 201 |
202 // IA5Encode and arena allocate SECItem | 202 // IA5Encode and arena allocate SECItem |
203 SECItem* asn1_domain_string = SEC_ASN1EncodeItem( | 203 SECItem* asn1_domain_string = SEC_ASN1EncodeItem( |
204 cert->arena, NULL, &domain_string_item, | 204 cert->arena, NULL, &domain_string_item, |
205 SEC_ASN1_GET(SEC_IA5StringTemplate)); | 205 SEC_ASN1_GET(SEC_IA5StringTemplate)); |
206 if (asn1_domain_string == NULL) { | 206 if (asn1_domain_string == NULL) { |
207 LOG(ERROR) << "Unable to get ASN1 encoding for domain in domain_bound_cert" | 207 LOG(ERROR) << "Unable to get ASN1 encoding for domain in domain_bound_cert" |
208 " extension"; | 208 " extension"; |
209 CERT_DestroyCertificate(cert); | 209 CERT_DestroyCertificate(cert); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 domain, | 283 domain, |
284 serial_number, | 284 serial_number, |
285 not_valid_before, | 285 not_valid_before, |
286 not_valid_after, | 286 not_valid_after, |
287 der_cert); | 287 der_cert); |
288 } | 288 } |
289 | 289 |
290 } // namespace x509_util | 290 } // namespace x509_util |
291 | 291 |
292 } // namespace net | 292 } // namespace net |
OLD | NEW |