# Would flipping arbitrary bits of the ciphertext make it more secure?

Suppose I wanted to upload a text file to a malicious cloud storage provider. Would the file be more secure against decryption if AFTER encrypting it (say with the AES scheme), I flipped certain bits of the ciphertext, for example according to the scheme below:

010010001000010000010000001...


Obviously the cost of "storing" or "remembering" the scheme is minimal, and more complex schemes could easily be devised

• Well, this essentially adds another layer of encryption on-top with the pattern being the key for this layer. It should make a case of "infeasible" (only AES) vs "infeasible" (AES and this scheme). – SEJPM Apr 2 '18 at 11:47
• Would crypto.stackexchange.com/q/27813/23115 help? – Paul Uszak Apr 2 '18 at 16:08
• There is no such thing as "the AES scheme". AES is a block cipher; it only turns into a real cipher when combined with a mode of operation. The properties of that cipher depend on the mode mostly - as long as AES itself isn't broken. – Maarten - reinstate Monica Apr 3 '18 at 9:40

First of all, your change doesn't involve a key, so it isn't really a cipher. It requires knowledge of a pattern, but that goes against Kerckhoffs principle; the knowledge of an algorithm shouldn't influence security.

Second, you're flipping only specific bits. It depends on the mode of operation on how much that changes the decryption. If a stream cipher or streaming mode of operation is used then only those specific bits in the plaintext are flipped. It is very likely that the result will be easy to distinguish from random, which lets an attacker know that decryption succeeded. Things may be different for other modes of operations like CBC.

Third: you say that more complex schemes can be easily derived. That's a lot like handwaving. One obvious scheme would be another cipher with a fixed key. Yes, that would work, but in that case you have to communicate the key / algorithm with the other party. Basically you would have double encryption but without the necessary key management.

Finally, AES is already thought to be secure. AES-256 is even thought to be secure against attacks that involve quantum computers. Having an additional layer with very low complexity doesn't make all that much sense; AES is in itself much more complex.

Using an additional pattern could make finding a key in a password based encryption slightly more complex (as dictionary attacks are much more feasible than brute forcing AES) but even then I would rather focus on the security of the password itself.

Does it add some complexity? Sure, but it is unlikely to affect the attacks much. And even if it does, it depends on the attacker now knowing the scheme, going against Kerckhoffs principle.

• Actually one could have the view that the encryption algorithm is simple XOR and the key is the pattern.... – SEJPM Apr 3 '18 at 11:49
• @SEJPM Sure, but as long as the pattern depends on an algorithm to generate it, you need to have some kind of mechanism to select that algorithm. If it is a static bit pattern then it is an OTP. – Maarten - reinstate Monica Apr 3 '18 at 20:59