I’m just about to build a simple chat application using One Time Pad.
I’ve already made the algorithm, and to encrypt the messages, I need some sort of key material that is the same on both sides. The distribution of the key material is supposed to happen with physical contact (e.g. USB dongle). So I would like to make some very large random key files, that the two clients can use to communicate. So my questions are:
- I need a very secure random number/string generator, do you know any good ones that I can use in C#?
- And how do I, when I use such big files, avoid to load the whole file into memory, as I plan to read a chunk of the key material (e.g. 1 MB), and remove it from the file afterwards when read, so the same key won’t be used twice.
I Should probably start with this: I assume this is a for fun or for exercise project – not an attempt to create something truly secure.