Error: Specified key is not a valid size for this algorithm. (TripleDES)
I built a Cryptography application by using TripleDES. But I got an error:
System.Security.Cryptography.CryptographicException: Specified key is not a valid size for this algorithm.
The key I used was in an incorrect length, it should 16 bytes length.
For example:
Code
PasswordDeriveBytes pwd = new PasswordDeriveBytes("password", salt); | |
TripleDES alg = TripleDES.Create(); | |
| |
alg.Key = pwd.GetBytes(16); | |
alg.IV = new byte[alg.BlockSize / 8];; |
Trackback address for this post
Trackback URL (right click and copy shortcut/link location)
Feedback awaiting moderation
This post has 4309 feedbacks awaiting moderation...
Form is loading...