I’m creating a configuration tool that needs to generate an encryption key to be used with AES128 encryption.
I would like a truly random series of 16 bytes.
Calling Random() 16 times doesn’t seem like a good idea, no matter how you seed it.
Has anyone got a good implementation for this to share?
Kem
Didn’t see a key generator there. It consumes the key, but doesn’t create it.
At the moment I’ve got this, more or less. It generates an array of 16 bytes:
Dim i As Integer
Dim key(-1) As Integer
Dim r As New Random
For i = 0 to 15
r.RandomizeSeed
key.Append r.InRange(0,255)
Next i
Imagining the RandomizeSeed function might mix things up a bit.