supla-device
Loading...
Searching...
No Matches
rsa_verificator.h
1// SPDX-FileCopyrightText: AC SOFTWARE SP. Z O.O.
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#ifndef SRC_SUPLA_RSA_VERIFICATOR_H_
5#define SRC_SUPLA_RSA_VERIFICATOR_H_
6
7#ifndef SUPLA_TEST
8
9/*
10 * Simple wrapper for mbedTLS RSA methods used to verify sha256 hash
11 * against another hash signed with RSA private key.
12 */
13
14#define RSA_NUM_BYTES 512
15#define RSA_PUBLIC_EXPONENT 65537
16
17#include <stdint.h>
18#include <supla/sha256.h>
19
20namespace Supla {
21
23 public:
24 explicit RsaVerificator(const uint8_t *publicKeyBytes);
26 bool verify(Supla::Sha256 *hash, const uint8_t *signatureBytes);
27
28 protected:
29 void *rsa_ctx;
30 bool ready;
31};
32
33}; // namespace Supla
34
35#endif // SUPLA_TEST
36#endif // SRC_SUPLA_RSA_VERIFICATOR_H_
Definition rsa_verificator.h:22
Definition sha256.h:15