Schedule an encrypted packet with specified content/aad/ignore to be sent to transport * (only after ReceiveKey). */
| 1218 | /** Schedule an encrypted packet with specified content/aad/ignore to be sent to transport |
| 1219 | * (only after ReceiveKey). */ |
| 1220 | void SendPacket(std::span<const uint8_t> content, std::span<const uint8_t> aad = {}, bool ignore = false) |
| 1221 | { |
| 1222 | // Use cipher to construct ciphertext. |
| 1223 | std::vector<std::byte> ciphertext; |
| 1224 | ciphertext.resize(content.size() + BIP324Cipher::EXPANSION); |
| 1225 | m_cipher.Encrypt( |
| 1226 | /*contents=*/MakeByteSpan(content), |
| 1227 | /*aad=*/MakeByteSpan(aad), |
| 1228 | /*ignore=*/ignore, |
| 1229 | /*output=*/ciphertext); |
| 1230 | // Schedule it for sending. |
| 1231 | Send(ciphertext); |
| 1232 | } |
| 1233 | |
| 1234 | /** Schedule garbage terminator to be sent to the transport (only after ReceiveKey). */ |
| 1235 | void SendGarbageTerm() |
no test coverage detected