DES Encryption and Decryption using different keys gives 'Bad Data' exception
From: dean (abc_at_def.com)
Date: 05/27/03
- Next message: Joe Kaplan \(MVP - ADSI\): "Re: Passing in Hex values for encryption"
- Previous message: dean: "Passing in Hex values for encryption"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Tue, 27 May 2003 15:43:33 +0200
Hi all,
Is anyone familiar with the AnsiX9.19 document which handles the generation
of Key Encryption Keys (KEK) and Key Check Vaues (KCV). A rough overview of
the process is as follows:
Step 1 : Take a given 128bit key, and divide it into 2 - to generate key
parts KL equals the left 64 bits and KR the right.
Step 2 : Then encrypt the number zero "0" using the left hand key part (KL)
and DES.
Step 3 : The output of step 2 is then decrypted using the right hand key
part (KR).
Step 4 : The final step is to re-encrypt this output using the left hand key
part once again.
According to the ANSI doc this yields a Key Check Value which can be used
for message authentication.
The Step 1 encryption part works fine but Step 2 decrypting using the right
hand key part fails with the infamous 'Bad Data' cryptographic exception.
When I reran the process using the the left hand key part (KL) for both
encryption, decryption and the re-encryption it works fine. This leads me to
beleive that the code is ok but the decryption process doesn't like a
different key.
Does any one have any ideas on this. Help would be greatly appreciated.
Best regards
Dean
PS I can attach some code samples if that would help.
- Next message: Joe Kaplan \(MVP - ADSI\): "Re: Passing in Hex values for encryption"
- Previous message: dean: "Passing in Hex values for encryption"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|