Creating IV for CNG encryption

343 Views Asked by At

I'm trying to rework the CNG encryption example in the Microsoft documentation. One peculiar thing about the example is that the encryption IV is hard coded.

I don't know a lot about encryption but my understanding is that it is more secure to generate a random IV for each encrypted data.

Does anyone have any links or examples for how I'd create a good IV for encryption?

Is it enough to just use rand() to come up with N random byte values?

0

There are 0 best solutions below