File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ #include " Client.h"
4+
5+
6+ namespace arduino {
7+
8+ // Tls CertificatesKeys are strings
9+ using CertificateKey = const char [];
10+
11+ enum class CertificateFormat {
12+ Der,
13+ Pem,
14+ }
15+
16+ class Tls : public ClientConnect {
17+ public:
18+ virtual ~Tls () = default ;
19+
20+ enum IdentityVerification {
21+ MTls, // both ends identity needs to be verified
22+ Tls, // The server side end is verified against CA
23+ Insecure, // no check against server side identity
24+ };
25+
26+ virtual void setIdentityVerification (IdentityVerification mode) { _mode = mode; };
27+ virtual void setCA (CertificateKey ca, CertificateFormat f=CertificateFormat::Pem) = 0;
28+ virtual void setCertificate (CertificateKey public, CertificateKey private, CertificateFormat f=CertificateFormat::Pem) = 0;
29+
30+
31+ // Tls protocol enables Server Name Indication usage, for which a client provides
32+ // the hostname it is trying to connect to. This hostname may be required to be verified
33+ // against the server provided one
34+ virtual void sniVerification (bool ) = 0;
35+
36+ // manually provide an hostname that will be used toghether with sni
37+ // if connect is called with hostname as parameter this will be automatically called
38+ virtual void setHostname (const char hostname[]) = 0;
39+ protected:
40+ IdentityVerification _mode;
41+ };
42+
43+ class TlsClient : public Client , Tls {
44+
45+ };
46+ }
You can’t perform that action at this time.
0 commit comments