Solved

Symmetric Cryptography

Posted on 2003-11-28
7
990 Views
Last Modified: 2011-04-14
How can i change the min and max size of the keys for cryptografy in a SymmetricAlgorithm class?
I tried to modify the MinSize and MaxSize properties of the LegalKeySizes array but they are read only...
I instantiated a new class System.Security.Cryptography.KeySizes with my dimension in the constructor but i can't assign it to the cryptografy object...

Please help me..
0
Comment
Question by:DaniPro
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 1

Expert Comment

by:AJMartin
ID: 9836090
> How can i change the min and max size of the keys for cryptografy in a SymmetricAlgorithm class?

You can't, according to the documentation:

SymmetricAlgorithm.KeySize Property
The valid key sizes are specified by the particular symmetric algorithm implementation and are listed in LegalKeySizes.

SymmetricAlgorithm.LegalKeySizes Property
Only key sizes that match an entry in this array are supported by the symmetric algorithm.

Of course, if you subclass your own Symmetric Algorithm class from System.Security.Cryptography.SymmetricAlgorithm just like System.Security.Cryptography.DES, System.Security.Cryptography.RC2, System.Security.Cryptography.Rijndael, & System.Security.Cryptography.TripleDES are, then you can do what you like.

Alternatively, you might need the highencryption pack, perhaps?

I hope that helps!
0
 
LVL 6

Author Comment

by:DaniPro
ID: 9836959
I instantiated a TripleDESCryptoServiceProvider class but i can't change the MinSize and MaxSize properties.
The "LegaleKeySizes" contains an array with the keys dimensions supported. How can i append a new item to this array?
0
 
LVL 1

Expert Comment

by:AJMartin
ID: 9839931
> How can i append a new item to this array?

You can't. The algorithm for TripleDES only supports the key sizes in LegalKeySizes.
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 41

Expert Comment

by:graye
ID: 9863507
Are you perhaps thinking about the "block size" often used in cryptographic service providers for working on "sizeable chunks" of the cleartext/ciphertext?
0
 
LVL 6

Author Comment

by:DaniPro
ID: 9864997
Hi graye,

do you have any examples about "block size" or like that say about it?
0
 
LVL 41

Expert Comment

by:graye
ID: 9869462
Well, no examples, per se... but I've got a better explaination!

Consider the good-ole standard DES encryption.  It uses a varying key length 40, 56, 128 (in bits).  But the block size is 8 (characters)... and is always 8.  When DES applies it's crypo-magic, it does so in chunks of 8 characters at a time.  That's why the length of DES cipher text is always an even multiple of 8.  For example, if you encrypt the word "hello"... it always comes out 8 characters long (without regard to the key and initialization vector lengths).

You never really told us what you're trying to do... if you're trying to use one of the existing CSPs in your application, then the "maximum length" is the key (er, pardon the pun) to getting longer keys.

Remember, it hasn't been too long ago that the US Government wouldn't allow 128 bit key lengths in technology that was exported to other countries.  (Now the restriction is just to a few countries that sponsor terrorism).  

But, as you can imagine, the writers of the CSP would NOT allow you to change the maxium key lenghts on-the-fly.  They were hard-coded in to the encryption libraries for legal reasons.  Other CSP writers queried the OS to determine the maximum key length (back with IE5 came out...and with the "high encryption pack").  But then again, just because the OS says "I'll take 128 bits", doesn't mean that the CSP will honor that.

I suspect that you're trying to subclass an existing CSP class?  If so then that's simply not gonna work.  If on the other hand, you're writing your own... then have fun!
0
 
LVL 1

Accepted Solution

by:
pun1sher earned 500 total points
ID: 9907858
use rijndael symetric encryption, I have used this extensivly, there are a few selection of key size on offer there...
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

823 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question