/
WSslInfo.C
53 lines (39 loc) · 1.11 KB
/
WSslInfo.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* Copyright (C) 2012 Emweb bvba, Leuven, Belgium.
*
* See the LICENSE file for terms of use.
*/
#include "Wt/WSslInfo"
#include "Wt/WLogger"
#include "Wt/Utils"
#include <sstream>
#include <stdexcept>
#ifdef WT_WITH_SSL
namespace Wt {
LOGGER("WSslInfo");
WSslInfo::WSslInfo(const WSslCertificate &clientCertificate,
const std::vector<WSslCertificate> &clientCertificateChain,
WValidator::Result clientVerificationResult)
: clientCertificate_(clientCertificate),
clientCertificateChain_(clientCertificateChain),
clientVerificationResult_(clientVerificationResult)
{
LOG_DEBUG("WSslInfo fields: " << gdb());
}
std::string WSslInfo::gdb() const
{
std::stringstream ss;
ss << "client certificate:\n";
clientCertificate_.gdb();
for (unsigned i = 0; i < clientCertificateChain_.size(); ++i) {
ss << "client cert chain " << i << " :\n";
clientCertificateChain_[i].gdb();
}
ss
<< "valid: " << (clientVerificationResult_.state() == WValidator::Valid)
<< std::endl
<< "validity info: " << clientVerificationResult_.message() << std::endl;
return ss.str();
}
}
#endif