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

Side by Side Diff: webrtc/base/sslidentity.cc

Issue 1189583002: Support generation of EC keys using P256 curve and support ECDSA certs. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase, glue to hbos's changes Created 5 years, 4 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
« no previous file with comments | « webrtc/base/sslidentity.h ('k') | webrtc/base/sslidentity_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 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 19 matching lines...) Expand all
30 #elif SSL_USE_NSS // !SSL_USE_SCHANNEL && !SSL_USE_OPENSSL 30 #elif SSL_USE_NSS // !SSL_USE_SCHANNEL && !SSL_USE_OPENSSL
31 31
32 #include "webrtc/base/nssidentity.h" 32 #include "webrtc/base/nssidentity.h"
33 33
34 #endif // SSL_USE_SCHANNEL 34 #endif // SSL_USE_SCHANNEL
35 35
36 namespace rtc { 36 namespace rtc {
37 37
38 const char kPemTypeCertificate[] = "CERTIFICATE"; 38 const char kPemTypeCertificate[] = "CERTIFICATE";
39 const char kPemTypeRsaPrivateKey[] = "RSA PRIVATE KEY"; 39 const char kPemTypeRsaPrivateKey[] = "RSA PRIVATE KEY";
40 const char kPemTypeEcPrivateKey[] = "EC PRIVATE KEY";
40 41
41 bool SSLIdentity::PemToDer(const std::string& pem_type, 42 bool SSLIdentity::PemToDer(const std::string& pem_type,
42 const std::string& pem_string, 43 const std::string& pem_string,
43 std::string* der) { 44 std::string* der) {
44 // Find the inner body. We need this to fulfill the contract of 45 // Find the inner body. We need this to fulfill the contract of
45 // returning pem_length. 46 // returning pem_length.
46 size_t header = pem_string.find("-----BEGIN " + pem_type + "-----"); 47 size_t header = pem_string.find("-----BEGIN " + pem_type + "-----");
47 if (header == std::string::npos) 48 if (header == std::string::npos)
48 return false; 49 return false;
49 50
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 SSLCertChain::~SSLCertChain() { 102 SSLCertChain::~SSLCertChain() {
102 std::for_each(certs_.begin(), certs_.end(), DeleteCert); 103 std::for_each(certs_.begin(), certs_.end(), DeleteCert);
103 } 104 }
104 105
105 #if SSL_USE_SCHANNEL 106 #if SSL_USE_SCHANNEL
106 107
107 SSLCertificate* SSLCertificate::FromPEMString(const std::string& pem_string) { 108 SSLCertificate* SSLCertificate::FromPEMString(const std::string& pem_string) {
108 return NULL; 109 return NULL;
109 } 110 }
110 111
111 SSLIdentity* SSLIdentity::Generate(const std::string& common_name) { 112 SSLIdentity* SSLIdentity::Generate(const std::string& common_name,
113 KeyType key_type) {
112 return NULL; 114 return NULL;
113 } 115 }
114 116
115 SSLIdentity* GenerateForTest(const SSLIdentityParams& params) { 117 SSLIdentity* GenerateForTest(const SSLIdentityParams& params) {
116 return NULL; 118 return NULL;
117 } 119 }
118 120
119 SSLIdentity* SSLIdentity::FromPEMStrings(const std::string& private_key, 121 SSLIdentity* SSLIdentity::FromPEMStrings(const std::string& private_key,
120 const std::string& certificate) { 122 const std::string& certificate) {
121 return NULL; 123 return NULL;
122 } 124 }
123 125
124 #elif SSL_USE_OPENSSL // !SSL_USE_SCHANNEL 126 #elif SSL_USE_OPENSSL // !SSL_USE_SCHANNEL
125 127
126 SSLCertificate* SSLCertificate::FromPEMString(const std::string& pem_string) { 128 SSLCertificate* SSLCertificate::FromPEMString(const std::string& pem_string) {
127 return OpenSSLCertificate::FromPEMString(pem_string); 129 return OpenSSLCertificate::FromPEMString(pem_string);
128 } 130 }
129 131
130 SSLIdentity* SSLIdentity::Generate(const std::string& common_name) { 132 SSLIdentity* SSLIdentity::Generate(const std::string& common_name,
131 return OpenSSLIdentity::Generate(common_name); 133 KeyType key_type) {
134 return OpenSSLIdentity::Generate(common_name, key_type);
132 } 135 }
133 136
134 SSLIdentity* SSLIdentity::GenerateForTest(const SSLIdentityParams& params) { 137 SSLIdentity* SSLIdentity::GenerateForTest(const SSLIdentityParams& params) {
135 return OpenSSLIdentity::GenerateForTest(params); 138 return OpenSSLIdentity::GenerateForTest(params);
136 } 139 }
137 140
138 SSLIdentity* SSLIdentity::FromPEMStrings(const std::string& private_key, 141 SSLIdentity* SSLIdentity::FromPEMStrings(const std::string& private_key,
139 const std::string& certificate) { 142 const std::string& certificate) {
140 return OpenSSLIdentity::FromPEMStrings(private_key, certificate); 143 return OpenSSLIdentity::FromPEMStrings(private_key, certificate);
141 } 144 }
142 145
143 #elif SSL_USE_NSS // !SSL_USE_OPENSSL && !SSL_USE_SCHANNEL 146 #elif SSL_USE_NSS // !SSL_USE_OPENSSL && !SSL_USE_SCHANNEL
144 147
145 SSLCertificate* SSLCertificate::FromPEMString(const std::string& pem_string) { 148 SSLCertificate* SSLCertificate::FromPEMString(const std::string& pem_string) {
146 return NSSCertificate::FromPEMString(pem_string); 149 return NSSCertificate::FromPEMString(pem_string);
147 } 150 }
148 151
149 SSLIdentity* SSLIdentity::Generate(const std::string& common_name) { 152 SSLIdentity* SSLIdentity::Generate(const std::string& common_name,
150 return NSSIdentity::Generate(common_name); 153 KeyType key_type) {
154 return NSSIdentity::Generate(common_name, key_type);
151 } 155 }
152 156
153 SSLIdentity* SSLIdentity::GenerateForTest(const SSLIdentityParams& params) { 157 SSLIdentity* SSLIdentity::GenerateForTest(const SSLIdentityParams& params) {
154 return NSSIdentity::GenerateForTest(params); 158 return NSSIdentity::GenerateForTest(params);
155 } 159 }
156 160
157 SSLIdentity* SSLIdentity::FromPEMStrings(const std::string& private_key, 161 SSLIdentity* SSLIdentity::FromPEMStrings(const std::string& private_key,
158 const std::string& certificate) { 162 const std::string& certificate) {
159 return NSSIdentity::FromPEMStrings(private_key, certificate); 163 return NSSIdentity::FromPEMStrings(private_key, certificate);
160 } 164 }
161 165
162 #else // !SSL_USE_OPENSSL && !SSL_USE_SCHANNEL && !SSL_USE_NSS 166 #else // !SSL_USE_OPENSSL && !SSL_USE_SCHANNEL && !SSL_USE_NSS
163 167
164 #error "No SSL implementation" 168 #error "No SSL implementation"
165 169
166 #endif // SSL_USE_SCHANNEL 170 #endif // SSL_USE_SCHANNEL
167 171
168 } // namespace rtc 172 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/sslidentity.h ('k') | webrtc/base/sslidentity_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698