Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit47eb863

Browse files
Introducing Tls apis in Arduino Core api
Added Interfaces to handle Tls api standardization in arduino core api.
1 parenteee27b0 commit47eb863

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

‎api/Tls.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#pragma once
2+
3+
#include"Client.h"
4+
5+
6+
namespacearduino {
7+
8+
// Tls CertificatesKeys are strings
9+
using CertificateKey =constchar[];
10+
11+
enumclassCertificateFormat {
12+
Der,
13+
Pem,
14+
}
15+
16+
classTls:publicClientConnect {
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+
virtualvoidsetIdentityVerification(IdentityVerification mode) { _mode = mode; };
27+
virtualvoidsetCA(CertificateKey ca, CertificateFormat f=CertificateFormat::Pem) = 0;
28+
virtualvoidsetCertificate(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+
virtualvoidsniVerification(bool) = 0;
35+
36+
// manually provide an hostname that will be used together with sni
37+
// if connect is called with hostname as parameter this will be automatically called
38+
virtualvoidsetHostname(constchar hostname[]) = 0;
39+
protected:
40+
IdentityVerification _mode;
41+
};
42+
43+
classTlsClient:publicClient, Tls {
44+
45+
};
46+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp