Can a cipher that is vulnerable to an known plaintext attack be made secure by adding an additional XOR-encryption?
That is: suppose I have an (w.l.o.g. symmetric) encryption algorithm E were the attacker can retrieve the rest of the message, if he knows any part of it (but secure if he doesn't).
I would try to address this weakness as follows: I would XOR the plaintext with a securely generated 8 byte nonce (used once per message), and then add the nonce as a prefix:
ciphertext = E(key, nonce || XOR(nonce, plaintext))
XOR() applies the nonce repeatedly if the plaintext is longer than 8 byte.
The XORing as such is obviously insecure. But now the attacker doesn't have a known plaintext anymore: He can't know the nonce and therefore can't know "XOR(nonce, plaintext)".
Would this be enough to prevent the known plaintext attack from succeding?
I am not going to implement this, don't worry. I am just curious.
I am also aware that the possibility of an known plaintext attack hints at deeper problems. In reality I would choose another cipher.