1111
1212#include < string>
1313#include < stdint.h>
14- #include < WiFiClientSecure.h>
14+
15+ #if (defined(ESP32) && ESP_ARDUINO_VERSION_MAJOR >= 3)
16+ #define ksCertUtilsNetCLientSecure_t NetworkClientSecure
17+ #else
18+ #define ksCertUtilsNetCLientSecure_t WiFiClientSecure
19+ #endif
20+
21+ class ksCertUtilsNetCLientSecure_t ;
1522
1623namespace ksf ::misc
1724{
@@ -34,25 +41,30 @@ namespace ksf::misc
3441 bool fingerprintToBytes (const std::string& fingerprint, uint8_t * bytes, uint8_t bytesLen) const ;
3542
3643 public:
44+ /* !
45+ @brief Constructor.
46+ */
47+ ksCertFingerprint ();
48+
3749 /* !
3850 @brief Destructor.
3951 */
4052 virtual ~ksCertFingerprint ();
4153
4254 /* !
4355 @brief Performs certificate fingerprint setup (platform dependent).
44- @param client Pointer of WiFiClientSecure
56+ @param client Pointer of ksCertUtilsNetCLientSecure_t
4557 @param fingerprint Fingerprint string
4658 @return True if setup has been successfull, otherwise false.
4759 */
48- virtual bool setup (WiFiClientSecure * client, const std::string& fingerprint);
60+ virtual bool setup (ksCertUtilsNetCLientSecure_t * client, const std::string& fingerprint) = 0 ;
4961
5062 /* !
5163 @brief Performs certificate fingerprint validation (platform dependent).
52- @param client Pointer of WiFiClientSecure
64+ @param client Pointer of ksCertUtilsNetCLientSecure_t
5365 @return True on verification pass, otherwise false.
5466 */
55- virtual bool verify (WiFiClientSecure * client) const ;
67+ virtual bool verify (ksCertUtilsNetCLientSecure_t * client) const = 0 ;
5668 };
5769
5870#ifdef ESP32
@@ -67,18 +79,18 @@ namespace ksf::misc
6779
6880 On ESP32 it will copy fingerprint into fingerprintBytes.
6981
70- @param client Pointer to WiFiClientSecure
82+ @param client Pointer to ksCertUtilsNetCLientSecure_t
7183 @param fingerprint Fingerprint string
7284 @return True if setup passed, otherwise false.
7385 */
74- bool setup (WiFiClientSecure * client, const std::string& fingerprint) override ;
86+ bool setup (ksCertUtilsNetCLientSecure_t * client, const std::string& fingerprint) override ;
7587
7688 /* !
7789 @brief Converts bytes into a string and performs fingerprint validation.
78- @param client Pointer to WiFiClientSecure
90+ @param client Pointer to ksCertUtilsNetCLientSecure_t
7991 @return True if verification passed, otherwise false.
8092 */
81- bool verify (WiFiClientSecure * client) const override ;
93+ bool verify (ksCertUtilsNetCLientSecure_t * client) const override ;
8294 };
8395
8496 using ksCertFingerprintHolder = ksCertFingerprintESP32;
@@ -90,21 +102,21 @@ namespace ksf::misc
90102 public:
91103 /* !
92104 @brief Performs fingerprint setup (platform dependent).
93- @param client Pointer of WiFiClientSecure .
105+ @param client Pointer of ksCertUtilsNetCLientSecure_t .
94106 @param fingerprint Fingerprint string.
95107 @return True if setup passed, otherwise false.
96108 */
97- bool setup (WiFiClientSecure * client, const std::string& fingerprint) override ;
109+ bool setup (ksCertUtilsNetCLientSecure_t * client, const std::string& fingerprint) override ;
98110
99111 /* !
100112 @brief Converts bytes into a string and performs fingerprint validation.
101113
102114 Always returns true on ESP8266 as this functionality is handled under the hood.
103115
104- @param client Pointer to WiFiClientSecure
116+ @param client Pointer to ksCertUtilsNetCLientSecure_t
105117 @return Always true in case of ESP8266.
106118 */
107- bool verify (WiFiClientSecure * client) const override ;
119+ bool verify (ksCertUtilsNetCLientSecure_t * client) const override ;
108120 };
109121
110122 using ksCertFingerprintHolder = ksCertFingerprintESP8266;
0 commit comments