| OLD | NEW |
| 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 20 matching lines...) Expand all Loading... |
| 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 | 40 |
| 41 static const std::string key_type_names[] { "KT_RSA", "KT_ECDSA" }; |
| 42 |
| 43 std::string KeyTypeToString(KeyType key_type) { |
| 44 return key_type_names[key_type]; |
| 45 } |
| 46 |
| 41 bool SSLIdentity::PemToDer(const std::string& pem_type, | 47 bool SSLIdentity::PemToDer(const std::string& pem_type, |
| 42 const std::string& pem_string, | 48 const std::string& pem_string, |
| 43 std::string* der) { | 49 std::string* der) { |
| 44 // Find the inner body. We need this to fulfill the contract of | 50 // Find the inner body. We need this to fulfill the contract of |
| 45 // returning pem_length. | 51 // returning pem_length. |
| 46 size_t header = pem_string.find("-----BEGIN " + pem_type + "-----"); | 52 size_t header = pem_string.find("-----BEGIN " + pem_type + "-----"); |
| 47 if (header == std::string::npos) | 53 if (header == std::string::npos) |
| 48 return false; | 54 return false; |
| 49 | 55 |
| 50 size_t body = pem_string.find("\n", header); | 56 size_t body = pem_string.find("\n", header); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 return NSSIdentity::FromPEMStrings(private_key, certificate); | 165 return NSSIdentity::FromPEMStrings(private_key, certificate); |
| 160 } | 166 } |
| 161 | 167 |
| 162 #else // !SSL_USE_OPENSSL && !SSL_USE_SCHANNEL && !SSL_USE_NSS | 168 #else // !SSL_USE_OPENSSL && !SSL_USE_SCHANNEL && !SSL_USE_NSS |
| 163 | 169 |
| 164 #error "No SSL implementation" | 170 #error "No SSL implementation" |
| 165 | 171 |
| 166 #endif // SSL_USE_SCHANNEL | 172 #endif // SSL_USE_SCHANNEL |
| 167 | 173 |
| 168 } // namespace rtc | 174 } // namespace rtc |
| OLD | NEW |