gloox
1.0.9
Main Page
Related Pages
Namespaces
Classes
Files
File List
src
tlsbase.h
1
/*
2
Copyright (c) 2007-2013 by Jakob Schroeter <js@camaya.net>
3
This file is part of the gloox library. http://camaya.net/gloox
4
5
This software is distributed under a license. The full license
6
agreement can be found in the file LICENSE in this distribution.
7
This software may not be copied, modified, sold or distributed
8
other than expressed in the named license agreement.
9
10
This software is distributed without any warranty.
11
*/
12
13
14
15
#ifndef TLSBASE_H__
16
#define TLSBASE_H__
17
18
#include "gloox.h"
19
#include "mutex.h"
20
#include "tlshandler.h"
21
22
namespace
gloox
23
{
24
31
class
GLOOX_API
TLSBase
32
{
33
public
:
39
TLSBase
(
TLSHandler
* th,
const
std::string server )
40
: m_handler( th ), m_server( server ), m_secure( false ), m_valid( false ), m_initLib( true )
41
{}
42
46
virtual
~TLSBase
() {}
47
57
virtual
bool
init(
const
std::string& clientKey =
EmptyString
,
58
const
std::string& clientCerts =
EmptyString
,
59
const
StringList
& cacerts =
StringList
() ) = 0;
60
68
void
setInitLib
(
bool
init ) { m_initLib = init; }
69
76
virtual
bool
encrypt(
const
std::string& data ) = 0;
77
85
virtual
int
decrypt(
const
std::string& data ) = 0;
86
90
virtual
void
cleanup() = 0;
91
99
virtual
bool
handshake() = 0;
100
105
virtual
bool
isSecure
()
const
{
return
m_secure; }
106
111
virtual
bool
hasChannelBinding
()
const
{
return
false
; }
112
117
virtual
const
std::string
channelBinding
()
const
{
return
EmptyString
; }
118
124
virtual
void
setCACerts(
const
StringList
& cacerts ) = 0;
125
130
virtual
const
CertInfo
&
fetchTLSInfo
()
const
{
return
m_certInfo; }
131
143
virtual
void
setClientCert(
const
std::string& clientKey,
const
std::string& clientCerts ) = 0;
144
145
protected
:
146
TLSHandler
* m_handler;
147
StringList
m_cacerts;
148
std::string m_clientKey;
149
std::string m_clientCerts;
150
std::string m_server;
151
CertInfo
m_certInfo;
152
util::Mutex
m_mutex;
153
bool
m_secure;
154
bool
m_valid;
155
bool
m_initLib;
156
157
};
158
159
}
160
161
#endif // TLSBASE_H__
Generated on Tue Oct 15 2013 19:25:21 for gloox by
1.8.1.2