Alper
Alper

Reputation: 1

What is the specified key size for TripleDES in C#?

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?

Upvotes: 0

Views: 6484

Answers (2)

Steve Townsend
Steve Townsend

Reputation: 54178

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

Upvotes: 1

Jim
Jim

Reputation: 1735

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

Upvotes: 2

Related Questions