Discussion:
des3 decrypt bad magic number
barchia
2006-09-11 21:59:37 UTC
Permalink
Hi to *

I try to decode a file that is encripted with des3 cipher,
the file is encoded with .NET framework, the key is 128 bit


when i type the openssl command:

C:\test\des3>openssl des3 -d -in fileencodec.enc -out fileout.txt -K
7e46960de0c59530f7332b3eedb5867e -p
-iv "0000000000000000" -p
salt=78013E0001000000
key=7E46960DE0C59530F7332B3EEDB5867E0000000000000000
iv =0000000000000000
bad decrypt
948:error:06065064:digital envelope routines:EVP_DecryptFinal:bad
decrypt:.\crypto\evp\evp_enc.c:509:

why I have "0000000000000000" at the end of key?
what mean?

or:

C:\test\des3>openssl des3 -d -in PI_FATT_0606_0017_03226_114108.enc -out
file.txt -pass file:key.decrypted -iv "0000000000000000" -p
bad magic number

If decode all with C# in .NET all work fine...

where is the mistake?

Thank in advance...

Alessandro B.
Dr. Stephen Henson
2006-09-11 23:44:41 UTC
Permalink
Post by barchia
Hi to *
I try to decode a file that is encripted with des3 cipher,
the file is encoded with .NET framework, the key is 128 bit
Err no it isn't the key is 192 bit of which 168 are significant.
Post by barchia
C:\test\des3>openssl des3 -d -in fileencodec.enc -out fileout.txt -K
7e46960de0c59530f7332b3eedb5867e -p
-iv "0000000000000000" -p
salt=78013E0001000000
key=7E46960DE0C59530F7332B3EEDB5867E0000000000000000
iv =0000000000000000
bad decrypt
948:error:06065064:digital envelope routines:EVP_DecryptFinal:bad
why I have "0000000000000000" at the end of key?
what mean?
C:\test\des3>openssl des3 -d -in PI_FATT_0606_0017_03226_114108.enc -out
file.txt -pass file:key.decrypted -iv "0000000000000000" -p
bad magic number
If decode all with C# in .NET all work fine...
where is the mistake?
Well other than the key length you need -nosalt to use "raw" mode.

Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users-MCmKBN63+***@public.gmane.org
Automated List Manager majordomo-MCmKBN63+***@public.gmane.org
barchia
2006-09-12 08:44:22 UTC
Permalink
Post by Dr. Stephen Henson
Post by barchia
Hi to *
I try to decode a file that is encripted with des3 cipher,
the file is encoded with .NET framework, the key is 128 bit
Err no it isn't the key is 192 bit of which 168 are significant.
Sorry, but I dont't understand... you say that the key must
be long 192 bit?
Post by Dr. Stephen Henson
Well other than the key length you need -nosalt to use "raw" mode.
I would know the procedure is correct:
I have a file "key.decrypted" that contains the key
")»£╩:ÝÊEh÷u dt"
in hex
"7e46960de0c59530f7332b3eedb5867e"


-pass method:
openssl des3 -nosalt -d -in file_encrypted.enc -out file.txt -pass
file:key.decrypted -iv "0000000000000000" -p
key=C0E955710C49AAE737CBAF6A6969DC5567C94180D4E987D9
iv =0000000000000000
bad decrypt
2380:error:06065064:digital envelope routines:EVP_DecryptFinal:bad
decrypt:.\crypto\evp\evp_enc.c:509:

-k method:
openssl des3 -nosalt -d -in PI_FATT_0606_0017_03226_114108.enc -out
file.txt -k 7e46960de0c59530f7332b3eedb5867e
-iv "0000000000000000" -p
key=AEEAF0F0C26D74D36A8B3581A8A9083224E5BED087D1F686
iv =0000000000000000
bad decrypt
3360:error:06065064:digital envelope routines:EVP_DecryptFinal:bad
decrypt:.\crypto\evp\evp_enc.c:509:

Alessandro

Loading...