18#ifndef GNSS_SDR_GALILEO_OSNMA_H
19#define GNSS_SDR_GALILEO_OSNMA_H
24#include <unordered_map>
33constexpr size_t SIZE_DSM_BLOCKS_BYTES = 13;
36const std::unordered_map<uint8_t, std::string> OSNMA_TABLE_1 = {
37 {0, std::string(
"Reserved")},
38 {1, std::string(
"Test")},
39 {2, std::string(
"Operational")},
40 {3, std::string(
"Don't use")}};
44const std::unordered_map<uint8_t, std::string> OSNMA_TABLE_2 = {
45 {0, std::string(
"Reserved")},
46 {1, std::string(
"Nominal")},
47 {2, std::string(
"End of Chain (EOC)")},
48 {3, std::string(
"Chain Revoked (CREV)")},
49 {4, std::string(
"New Public Key (NPK)")},
50 {5, std::string(
"Public Key Revoked (PKREV)")},
51 {6, std::string(
"New Merkle Tree (NMT)")},
52 {7, std::string(
"Alert Message (AM)")}};
55const std::unordered_map<uint8_t, std::pair<uint16_t, uint16_t>> OSNMA_TABLE_3 = {
73const std::unordered_map<uint8_t, std::string> OSNMA_TABLE_5 = {
74 {0, std::string(
"Reserved")},
75 {1, std::string(
"ECDSA P-256")},
76 {2, std::string(
"Reserved")},
77 {3, std::string(
"ECDSA P-521")},
78 {4, std::string(
"OAM")},
79 {5, std::string(
"Reserved")},
80 {6, std::string(
"Reserved")},
81 {7, std::string(
"Reserved")},
82 {8, std::string(
"Reserved")},
83 {9, std::string(
"Reserved")},
84 {10, std::string(
"Reserved")},
85 {11, std::string(
"Reserved")},
86 {12, std::string(
"Reserved")},
87 {13, std::string(
"Reserved")},
88 {14, std::string(
"Reserved")},
89 {15, std::string(
"Reserved")}};
91const std::unordered_map<std::string, uint16_t> OSNMA_TABLE_6 = {
92 {std::string(
"ECDSA P-256"), 264},
93 {std::string(
"ECDSA P-521"), 536}};
96const std::unordered_map<uint8_t, std::pair<uint16_t, uint16_t>> OSNMA_TABLE_7 = {
114const std::unordered_map<uint8_t, std::string> OSNMA_TABLE_8 = {
115 {0, std::string(
"SHA-256")},
116 {1, std::string(
"Reserved")},
117 {2, std::string(
"SHA3-256")},
118 {3, std::string(
"Reserved")}};
120const std::unordered_map<uint8_t, uint16_t> OSNMA_TABLE_10 = {
138const std::unordered_map<uint8_t, uint8_t> OSNMA_TABLE_11 = {
157const std::unordered_map<std::string, uint16_t> OSNMA_TABLE_15 = {
158 {std::string(
"ECDSA P-256"), 512},
159 {std::string(
"ECDSA P-521"), 1056}};
161const std::string PEMFILE_DEFAULT(
"./OSNMA_PublicKey.pem");
162const std::string CRTFILE_DEFAULT(
"./OSNMA_PublicKey_20240115100000_newPKID_1.crt");
163const std::string MERKLEFILE_DEFAULT(
"./OSNMA_MerkleTree_20240115100000_newPKID_1.xml");
164const std::string KROOTFILE_DEFAULT(
"./OSNMA_DSM_KROOT_NMAHeader.bin");
169 Mack_lookup() =
default;
170 Mack_lookup(uint8_t msg_,
172 const std::vector<std::string>& s1_,
173 const std::vector<std::string>& s2_) : msg(msg_),
179 std::vector<std::string> sequence1;
180 std::vector<std::string> sequence2;
183const std::unordered_map<uint8_t, Mack_lookup> OSNMA_TABLE_16 = {
184 {27, {2, 6, {
"00S",
"00E",
"00E",
"00E",
"12S",
"00E"}, {
"00S ",
"00E",
"00E",
"04S",
"12S",
"00E"}}},
185 {28, {2, 10, {
"00S",
"00E",
"00E",
"00E",
"00S",
"00E",
"00E",
"12S",
"00E",
"00E"}, {
"00S",
"00E",
"00E",
"00S",
"00E",
"00E",
"04S",
"12S",
"00E",
"00E"}}},
186 {31, {2, 5, {
"00S",
"00E",
"00E",
"12S",
"00E"}, {
"00S",
"00E",
"00E",
"12S",
"04S"}}},
187 {33, {2, 6, {
"00S",
"00E",
"04S",
"00E",
"12S",
"00E"}, {
"00S",
"00E",
"00E",
"12S",
"00E",
"12E"}}},
188 {34, {2, 6, {
"00S",
"FLX",
"04S",
"FLX",
"12S",
"00E"}, {
"00S",
"FLX",
"00E",
"12S",
"00E",
"12E"}}},
189 {35, {2, 6, {
"00S",
"FLX",
"04S",
"FLX",
"12S",
"FLX"}, {
"00S",
"FLX",
"FLX",
"12S",
"FLX",
"FLX"}}},
190 {36, {2, 5, {
"00S",
"FLX",
"04S",
"FLX",
"12S"}, {
"00S",
"FLX",
"00E",
"12S",
"12E"}}},
191 {37, {2, 5, {
"00S",
"00E",
"04S",
"00E",
"12S"}, {
"00S",
"00E",
"00E",
"12S",
"12E"}}},
192 {38, {2, 5, {
"00S",
"FLX",
"04S",
"FLX",
"12S"}, {
"00S",
"FLX",
"FLX",
"12S",
"FLX"}}},
193 {39, {2, 4, {
"00S",
"FLX",
"04S",
"FLX"}, {
"00S",
"FLX",
"00E",
"12S"}}},
194 {40, {2, 4, {
"00S",
"00E",
"04S",
"12S"}, {
"00S",
"00E",
"00E",
"12E"}}},
195 {41, {2, 4, {
"00S",
"FLX",
"04S",
"FLX"}, {
"00S",
"FLX",
"FLX",
"12S"}}}};