-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsslmitmcom.hpp
More file actions
75 lines (53 loc) · 2.2 KB
/
sslmitmcom.hpp
File metadata and controls
75 lines (53 loc) · 2.2 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
Socle - Socket Library Ecosystem
Copyright (c) 2014, Ales Stibal <astib@mag0.net>, All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library.
*/
#ifndef __SSLMITMCOM_HPP__
#define __SSLMITMCOM_HPP__
#include <sslcom.hpp>
struct SpoofOptions {
std::string sni;
bool self_signed = false; // set to true if we should deliberately make a mistake
std::vector<std::string> sans;
};
template <class SSLProto>
class baseSSLMitmCom : public SSLProto {
public:
using verify_status_t = SSLCom::verify_status_t;
virtual ~baseSSLMitmCom() = default;
bool check_cert(const char*) override;
virtual bool spoof_cert(X509* cert_orig, SpoofOptions& spo);
virtual bool use_cert_null();
virtual bool use_cert_sni(SpoofOptions &spo);
virtual bool use_cert_ip(SpoofOptions &spo);
virtual bool use_cert_mitm(X509* cert_orig, SpoofOptions& spo);
baseCom* replicate() override { return new baseSSLMitmCom(); };
std::string shortname() const override { static std::string s("ssli"); return s; }
std::string to_string(int verbosity) const override { return SSLProto::to_string(verbosity); };
TYPENAME_OVERRIDE("baseSSLMitmCom")
DECLARE_LOGGING(to_string)
struct log {
static logan_lite &ca() {
static logan_lite l("com.tls.ca");
return l;
}
static logan_lite &mitm () {
static logan_lite l("com.tls.mitm");
return l;
}
};
};
using SSLMitmCom = baseSSLMitmCom<SSLCom> ;
using DTLSMitmCom = baseSSLMitmCom<DTLSCom>;
#endif // __SSLMITMCOM_HPP__
#include <sslmitmcom.tpp>