Click here to Skip to main content
15,888,090 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We were using hard coded IVParameterSpec in our program.
We use same IvParameterSpec to encrypt and later to decrypt our strings .
We want to use below code to generate IvParameterSpec

C#
SecureRandom random = new SecureRandom();
byte[] iv = random.generateSeed(16);
IvParameterSpec ips = new IvParameterSpec(iv);


But now ips will be different at each time .So it will be different at the time of encryption and different at the time of decryption .How will it decrypt ?

How can we use this random scenario in our case .
Please suggest .

What I have tried:

C#
SecureRandom random = new SecureRandom();
byte[] iv = random.generateSeed(16);
IvParameterSpec ips = new IvParameterSpec(iv);
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900