Invalid key size creating ICryptoTransform instance for TripleDES

  • Thread starter =?iso-8859-1?Q?Jan_Weing=E4rtner?=
  • Start date

?

=?iso-8859-1?Q?Jan_Weing=E4rtner?=

Hi.
I just try to encrypt data with TripleDES.
The LegalKeySize is defined as MinSize=128, MaxSize=192, SkipSize=64.
So i try to use a 128 byte array for key and IV :
-----------------------
byte[] pwd = new System.Text.ASCIIEncoding().GetBytes(new string('a', 128));

byte[] desIV = new System.Text.ASCIIEncoding().GetBytes(new string('b', 128));

System.Security.Cryptography.TripleDESCryptoServiceProvider des3Prov
= new System.Security.Cryptography.TripleDESCryptoServiceProvider();
-----------------------

I get an exception on creating the crypter:
"Specified key is not a valid size for this algorithm."

-----------------------
System.Security.Cryptography.ICryptoTransform crypter
= des3Prov.CreateEncryptor(pwd, desIV);
-----------------------

can anybody help?

thanks and best regards (and a happy new year),
Jan
 
Ad

Advertisements

?

=?iso-8859-1?Q?Jan_Weing=E4rtner?=

The LegalKeySize is defined as MinSize=128, MaxSize=192, SkipSize=64.
...
byte[] pwd = new System.Text.ASCIIEncoding().GetBytes(new string('a', 128));
How stupid: 128 bit (not byte).

brgds,
Jan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top