PcapPlusPlus  Next
PemCodec.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <cstdint>
4 #include <string>
5 #include <vector>
6 
8 
11 namespace pcpp
12 {
13 
22  class PemCodec
23  {
24  public:
32  static std::string encode(const std::vector<uint8_t>& data, const std::string& label);
33 
43  static std::vector<uint8_t> decode(const std::string& pemData, const std::string& expectedLabel = "");
44 
45  private:
46  static constexpr const char* pemDelimiter = "-----";
47  static constexpr const char* pemBegin = "-----BEGIN ";
48  static constexpr const char* pemEnd = "-----END ";
49  static constexpr size_t pemBeginLen = 11;
50  static constexpr size_t pemEndLen = 9;
51  static constexpr size_t pemDelimiterLen = 5;
52  static constexpr size_t lineLength = 64;
53  };
54 } // namespace pcpp
A utility class for encoding and decoding data in Privacy-Enhanced Mail (PEM) format.
Definition: PemCodec.h:23
static std::string encode(const std::vector< uint8_t > &data, const std::string &label)
static std::vector< uint8_t > decode(const std::string &pemData, const std::string &expectedLabel="")
The main namespace for the PcapPlusPlus lib.