Add experimental stream archive support
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user