Add experimental stream archive support
Some checks failed
ci / headless-e2e (push) Has been cancelled
runtime-self-hosted / runtime-ci (push) Has been cancelled

This commit is contained in:
server
2026-04-15 18:40:40 +02:00
parent 09d51fdf2f
commit ae3c3cb33c
4 changed files with 191 additions and 39 deletions

View File

@@ -205,6 +205,42 @@ std::vector<std::uint8_t> decrypt_payload(
return plaintext;
}
std::vector<std::uint8_t> encrypt_payload_stream(
const std::vector<std::uint8_t>& plaintext,
const std::array<std::uint8_t, kAeadKeySize>& key,
const std::array<std::uint8_t, kAeadNonceSize>& nonce)
{
std::vector<std::uint8_t> ciphertext(plaintext.size());
if (!plaintext.empty())
{
crypto_stream_xchacha20_xor(
ciphertext.data(),
plaintext.data(),
plaintext.size(),
nonce.data(),
key.data());
}
return ciphertext;
}
std::vector<std::uint8_t> decrypt_payload_stream(
const std::vector<std::uint8_t>& ciphertext,
const std::array<std::uint8_t, kAeadKeySize>& key,
const std::array<std::uint8_t, kAeadNonceSize>& nonce)
{
std::vector<std::uint8_t> plaintext(ciphertext.size());
if (!ciphertext.empty())
{
crypto_stream_xchacha20_xor(
plaintext.data(),
ciphertext.data(),
ciphertext.size(),
nonce.data(),
key.data());
}
return plaintext;
}
std::vector<std::uint8_t> sign_detached(
const std::vector<std::uint8_t>& data,
const std::vector<std::uint8_t>& secret_key)