ifm3d
crypto.h
1 // -*- c++ -*-
2 /*
3  * Copyright 2025-present ifm electronic, gmbh
4  * SPDX-License-Identifier: Apache-2
5  */
6 
7 #ifndef IFM3D_CRYPTO_CRYPTO_H
8 #define IFM3D_CRYPTO_CRYPTO_H
9 
10 #include <string>
11 #include <vector>
12 #include <optional>
13 #include <cstdint>
14 
15 namespace ifm3d
16 {
17  class SealedBox
18  {
19  public:
20  SealedBox(const std::vector<uint8_t>& public_key,
21  const std::optional<const std::vector<uint8_t>>& private_key =
22  std::nullopt);
23 
24  ~SealedBox();
25 
26  std::vector<uint8_t> Encrypt(const std::string& plaintext);
27  std::string Decrypt(const std::vector<uint8_t>& ciphertext);
28 
29  private:
30  std::vector<uint8_t> public_key_;
31  std::optional<std::vector<uint8_t>> private_key_;
32  };
33 
34  std::vector<uint8_t> RandomNonce();
35 
36 } // end: namespace ifm3d
37 
38 #endif // IFM3D_CRYPTO_CRYPTO_H
ifm3d::SealedBox
Definition: crypto.h:17