Is this simple deniable encryption scheme based on streaming cypher security enough for each message?

in flag

Many existing deniable encryptions are for files or FS volumes, which are too heavy for simple short secrets, such as password, tokens, etc.

So I try to implement a PoC crypto container based on streaming cypher (ChaCha20), which at once encrypts multiple secrets with different passwords, and then one can decrypt one of the secrets by the corresponding password.

Some explain on the simple scheme. For a single secret message, encode it as a length-prefix byte string $M$, then prepend and append random bytes to $M$, and put the prefix padding length at first. This results $M_{full} = L_{pre-padding} || padding || M || padding $, then random 256-bit entropy $K$ to encrypt $M_{full}$ as $EM_{full} = ChaCha20(K, M_{full})$. After that, encrypt $K$ with a password $P$: $EK=ChaCha20(hash(P, salt), K)$. The output is $EK || EM_{full}$.

For multiple secrets, each $(P_i, EK)$ decides a $(K_i, L^i_{pre-padding})$. So just random search a valid $EK$, such that all message $M_i$ will not overlap. The question here is that, is this scheme security enough as directly using the streaming cypher for each secret?


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.