The specified initialization vector (IV) does not match the block size for this algorithm
If you're getting exception when trying to assigned key to a symmetric key and getting error message below :-
The specified initialization vector (IV) does not match the block size for this algorithm
And your code probably look like something below :-
Then you need to go into debug mode and start looking into the supported size for IV as shown in diagram below :-
As you can see, IV is 16 bytes, so you need to provide 16 bytes. The same goes for Key field too, if you're adding anything to it.
As long as you provide a valid key size, then we're good and you're code will be ready.
Comments