blob: 497805200ca91f83108e7270ca4d3bfa4aea6613 [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001/*
2 * libjingle
3 * Copyright 2004, Google Inc.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28// Handling of certificates and keypairs for SSLStreamAdapter's peer mode.
29#if HAVE_CONFIG_H
30#include "config.h"
31#endif // HAVE_CONFIG_H
32
33#include "talk/base/sslidentity.h"
34
35#include <string>
36
37#include "talk/base/sslconfig.h"
38
39#if SSL_USE_SCHANNEL
40
41#elif SSL_USE_OPENSSL // !SSL_USE_SCHANNEL
42
43#include "talk/base/opensslidentity.h"
44
45#elif SSL_USE_NSS // !SSL_USE_SCHANNEL && !SSL_USE_OPENSSL
46
47#include "talk/base/nssidentity.h"
48
49#endif // SSL_USE_SCHANNEL
50
51namespace talk_base {
52
53#if SSL_USE_SCHANNEL
54
55SSLCertificate* SSLCertificate::FromPEMString(const std::string& pem_string) {
56 return NULL;
57}
58
59SSLIdentity* SSLIdentity::Generate(const std::string& common_name) {
60 return NULL;
61}
62
63SSLIdentity* SSLIdentity::FromPEMStrings(const std::string& private_key,
64 const std::string& certificate) {
65 return NULL;
66}
67
68#elif SSL_USE_OPENSSL // !SSL_USE_SCHANNEL
69
70SSLCertificate* SSLCertificate::FromPEMString(const std::string& pem_string) {
71 return OpenSSLCertificate::FromPEMString(pem_string);
72}
73
74SSLIdentity* SSLIdentity::Generate(const std::string& common_name) {
75 return OpenSSLIdentity::Generate(common_name);
76}
77
78SSLIdentity* SSLIdentity::FromPEMStrings(const std::string& private_key,
79 const std::string& certificate) {
80 return OpenSSLIdentity::FromPEMStrings(private_key, certificate);
81}
82
83#elif SSL_USE_NSS // !SSL_USE_OPENSSL && !SSL_USE_SCHANNEL
84
85SSLCertificate* SSLCertificate::FromPEMString(const std::string& pem_string) {
86 return NSSCertificate::FromPEMString(pem_string);
87}
88
89SSLIdentity* SSLIdentity::Generate(const std::string& common_name) {
90 return NSSIdentity::Generate(common_name);
91}
92
93SSLIdentity* SSLIdentity::FromPEMStrings(const std::string& private_key,
94 const std::string& certificate) {
95 return NSSIdentity::FromPEMStrings(private_key, certificate);
96}
97
98#else // !SSL_USE_OPENSSL && !SSL_USE_SCHANNEL && !SSL_USE_NSS
99
100#error "No SSL implementation"
101
102#endif // SSL_USE_SCHANNEL
103
104} // namespace talk_base