0

So I'm trying to use the TripleDES algorithm in C#.

However, I keep getting an error saying that its not the specified key size.

What does that mean and how can I fix it?

Its occurring on the line:

tripledes.Key = pdb.GetBytes(112);

pdb is an Rfc2898DeriveBytes.

So yeah, how do I fix this error?

Alper
  • 1
  • 12
  • 39
  • 78

2 Answers2

2

Should be 128 or 192. .NET Framework will only use the 112 or 168 bits, but you should specify 128 or 192.

Jim
  • 1,695
  • 2
  • 23
  • 42
1

Legal Key Size depends on your algorithm - see SymmetricAlgorithm.LegalKeySizes.

Steve Townsend
  • 53,498
  • 9
  • 91
  • 140