gloox
1.0
Main Page
Related Pages
Namespaces
Classes
Files
File List
src
tlsbase.h
1
/*
2
Copyright (c) 2007-2009 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
112
virtual
void
setCACerts(
const
StringList
& cacerts ) = 0;
113
118
virtual
const
CertInfo
&
fetchTLSInfo
()
const
{
return
m_certInfo; }
119
131
virtual
void
setClientCert(
const
std::string& clientKey,
const
std::string& clientCerts ) = 0;
132
133
protected
:
134
TLSHandler
* m_handler;
135
StringList
m_cacerts;
136
std::string m_clientKey;
137
std::string m_clientCerts;
138
std::string m_server;
139
CertInfo
m_certInfo;
140
util::Mutex
m_mutex;
141
bool
m_secure;
142
bool
m_valid;
143
bool
m_initLib;
144
145
};
146
147
}
148
149
#endif // TLSBASE_H__
Generated on Thu Jun 27 2013 13:02:36 for gloox by
1.8.1.2