# Would data be secure if a cryptographically secure PRNG was used for encryption?

For example, say you have a client and server. You use asymmetric encryption to securely deliver two seeds from server to client. Each user then seeds two PRNGs (one for incoming data, one for outgoing). Then when they send data over the network, they add a new randomly generated byte (from the outgoing PRNG) to each unencrypted byte. The receiver can decrypt using their incoming PRNG which has the same seed as the senders outgoing PRNG. An HMAC could also be used to verify integrity and authenticate messages.

I was just musing over this idea. I'm a total novice to cryptography, so I'm sure there's something flawed with this. I would just like to know what the flaw is?

(The PRNG I'm looking at is ISAAC which is also a stream cipher, but would this work with any PRNG, disregarding speed?)

EDIT: Also, if not secure by itself, would it be possible to do this on top of AES? Is there no point (AES is already secure enough)? Or would it actually hurt security?

• You'd be interested in stream cipher. That's basically what your scheme is (except, of course, when specifying a cipher, we usually leave out things like key exchange and authentication). As for the AES comment, you can use AES as a stream cipher with the appropriate mode of operation, e.g. CTR mode. (Indeed, this is a common way to use AES.) – Reid Jan 8 '14 at 6:33
• Ah, I only understand CBC. I'll look into CTR and stream ciphers, thanks! – user3100783 Jan 8 '14 at 7:40
• Two things : First it would be somewhat pointless to do on top of AES-[insert-right-mode-of-operation-here] but as long as the AES layer and the PRNG layer are uncorrolated it won't decrease security. Also what you get from your solution is confidentiality which is great but in many situations not enough. For example what is the consequence of a bit flip by an attacker on ciphertext in transit ? – Alexandre Yamajako Jan 8 '14 at 9:32
• That's why I suggested an HMAC to be included with messages. Well, it seems by your responses it's overkill and I'll probably never do this. – user3100783 Jan 8 '14 at 10:32

A PRNG with a seed $S$ whose output is combined with the plaintext is called a stream cipher with the key $S$. So assuming that the details are filled in correctly, what you're describing is a stream cipher algorithm with two session keys, one used in each direction. Each seed/key must be unique, and the combination must ensure that each output bit has a $1/2$ probability of being flipped (xor is common, but addition of bytes would work too).