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

Side by Side Diff: chrome/browser/renderer_host/x509_user_cert_resource_handler.cc

Issue 2668005: Bring the handling of <keygen> and support for the application/x-x509-user-ce... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Whitespace/style Created 10 years, 6 months 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
« no previous file with comments | « base/crypto/scoped_capi_types.h ('k') | chrome/browser/ssl/ssl_host_state_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/browser/renderer_host/x509_user_cert_resource_handler.h" 5 #include "chrome/browser/renderer_host/x509_user_cert_resource_handler.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/chrome_thread.h" 9 #include "chrome/browser/chrome_thread.h"
10 #include "chrome/browser/download/download_file.h" 10 #include "chrome/browser/download/download_file.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 const URLRequestStatus& urs, 92 const URLRequestStatus& urs,
93 const std::string& sec_info) { 93 const std::string& sec_info) {
94 if (urs.status() != URLRequestStatus::SUCCESS) 94 if (urs.status() != URLRequestStatus::SUCCESS)
95 return false; 95 return false;
96 96
97 // TODO(gauravsh): Verify that 'request_id' was actually a keygen form post 97 // TODO(gauravsh): Verify that 'request_id' was actually a keygen form post
98 // and only then import the certificate. 98 // and only then import the certificate.
99 AssembleResource(); 99 AssembleResource();
100 scoped_refptr<net::X509Certificate> cert = 100 scoped_refptr<net::X509Certificate> cert =
101 net::X509Certificate::CreateFromBytes(resource_buffer_->data(), 101 net::X509Certificate::CreateFromBytes(resource_buffer_->data(),
102 content_length_); 102 content_length_, net::X509Certificate::FORMAT_AUTO);
103 // The handler will run the UI and delete itself when it's finished. 103 // The handler will run the UI and delete itself when it's finished.
104 new SSLAddCertHandler(request_, cert); 104 new SSLAddCertHandler(request_, cert);
105 return true; 105 return true;
106 } 106 }
107 107
108 void X509UserCertResourceHandler::OnRequestClosed() { 108 void X509UserCertResourceHandler::OnRequestClosed() {
109 } 109 }
110 110
111 void X509UserCertResourceHandler::AssembleResource() { 111 void X509UserCertResourceHandler::AssembleResource() {
112 size_t bytes_copied = 0; 112 size_t bytes_copied = 0;
113 resource_buffer_ = new net::IOBuffer(content_length_); 113 resource_buffer_ = new net::IOBuffer(content_length_);
114 114
115 for (size_t i = 0; i < buffer_->contents.size(); ++i) { 115 for (size_t i = 0; i < buffer_->contents.size(); ++i) {
116 net::IOBuffer* data = buffer_->contents[i].first; 116 net::IOBuffer* data = buffer_->contents[i].first;
117 const int data_len = buffer_->contents[i].second; 117 const int data_len = buffer_->contents[i].second;
118 DCHECK(bytes_copied + data_len <= content_length_); 118 DCHECK(bytes_copied + data_len <= content_length_);
119 memcpy(resource_buffer_->data() + bytes_copied, data->data(), data_len); 119 memcpy(resource_buffer_->data() + bytes_copied, data->data(), data_len);
120 bytes_copied += data_len; 120 bytes_copied += data_len;
121 } 121 }
122 } 122 }
OLDNEW
« no previous file with comments | « base/crypto/scoped_capi_types.h ('k') | chrome/browser/ssl/ssl_host_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698