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

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

Issue 1363543002: IntKeyTypeFamilyToKeyType (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 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') | no next file » | 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 21 matching lines...) Expand all
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 const char kPemTypeEcPrivateKey[] = "EC PRIVATE KEY";
41 41
42 KeyType IntKeyTypeFamilyToKeyType(int key_type_family) {
43 return static_cast<KeyType>(key_type_family);
44 }
45
42 bool SSLIdentity::PemToDer(const std::string& pem_type, 46 bool SSLIdentity::PemToDer(const std::string& pem_type,
43 const std::string& pem_string, 47 const std::string& pem_string,
44 std::string* der) { 48 std::string* der) {
45 // Find the inner body. We need this to fulfill the contract of 49 // Find the inner body. We need this to fulfill the contract of
46 // returning pem_length. 50 // returning pem_length.
47 size_t header = pem_string.find("-----BEGIN " + pem_type + "-----"); 51 size_t header = pem_string.find("-----BEGIN " + pem_type + "-----");
48 if (header == std::string::npos) 52 if (header == std::string::npos)
49 return false; 53 return false;
50 54
51 size_t body = pem_string.find("\n", header); 55 size_t body = pem_string.find("\n", header);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 return NSSIdentity::FromPEMStrings(private_key, certificate); 167 return NSSIdentity::FromPEMStrings(private_key, certificate);
164 } 168 }
165 169
166 #else // !SSL_USE_OPENSSL && !SSL_USE_SCHANNEL && !SSL_USE_NSS 170 #else // !SSL_USE_OPENSSL && !SSL_USE_SCHANNEL && !SSL_USE_NSS
167 171
168 #error "No SSL implementation" 172 #error "No SSL implementation"
169 173
170 #endif // SSL_USE_SCHANNEL 174 #endif // SSL_USE_SCHANNEL
171 175
172 } // namespace rtc 176 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/sslidentity.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698