HighTechTalks DotNet Forums  

DES parity wrong for generated key

Dotnet Security microsoft.public.dotnet.security


Discuss DES parity wrong for generated key in the Dotnet Security forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Daniel Hughes
 
Posts: n/a

Default DES parity wrong for generated key - 09-25-2007 , 11:34 PM






I need to create a random generated DES key. But when I use the crypto
service provider to create one the partity is wrong. The Key I am creating
needs to be used outside the windows environment and so the partity needs to
be correct or the device I am using will reject the key.

DES des = DES.Create();

des.GenerateKey();

byte[] key = des.Key;

The above code creates a 64 bit key that does not meet the DES standard ie
the parity is wrong. .net appears to ignore parity all together which is fine
within dotnet but not if you need to use the key elsewhere.

Does anyone know a way to tell .net to do parity correctly as per the DES
standard?

Reply With Quote
  #2  
Old   
Valery Pryamikov
 
Posts: n/a

Default Re: DES parity wrong for generated key - 09-27-2007 , 04:37 AM






On Sep 26, 5:34 am, Daniel Hughes <daniel.hug... (AT) tait (DOT) co.nz.
(donotspam)> wrote:
Quote:
I need to create a random generated DES key. But when I use the crypto
service provider to create one the partity is wrong. The Key I am creating
needs to be used outside the windows environment and so the partity needs to
be correct or the device I am using will reject the key.

DES des = DES.Create();

des.GenerateKey();

byte[] key = des.Key;

The above code creates a 64 bit key that does not meet the DES standard ie
the parity is wrong. .net appears to ignore parity all together which is fine
within dotnet but not if you need to use the key elsewhere.

Does anyone know a way to tell .net to do parity correctly as per the DES
standard?
DES parity bits is something that was added by NSA for reducing
keystrenth of DES from 64 to 56 bits during DES standartization in the
middle of 70th. The parity check is the most stupid and useless thing
in DES!!! you only need to make sure that parity bits summs to 0 (or 1
- don't remember wich is correct . So, to set parity on your key,
you just use simple bitwise AND of your key and a constant where
parity bits are set to summ to value that will be expected by
validator, all other bits are set to 1 (so that you keep your key-bits
value as it is).

-Valery



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.