Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > 3DES confusion

Reply
Thread Tools

3DES confusion

 
 
tshad
Guest
Posts: n/a
 
      01-03-2007
I am trying to use 3DES to encrypt my keys and am using VS 2003.

I am confused with some code I have that seems to use a hash (MD5) in the
3DES. But a Hash is one way. You are not suppose to be able to decrypt it.
The only thing I can figure is that it is using the hash only on the key.

Also, the

************************************************** ***
Public Shared Function TripleDESEncode(ByVal value As String, ByVal
key As String) As String
Dim des As New
Security.Cryptography.TripleDESCryptoServiceProvid er
des.IV = New Byte(7) {}
Dim pdb As New Security.Cryptography.PasswordDeriveBytes(key,
New Byte(-1) {})
des.Key = pdb.CryptDeriveKey("TripleDES", "MD5", 168, New
Byte(7) {})
Dim ms As New IO.MemoryStream((value.Length * 2) - 1)
Dim encStream As New Security.Cryptography.CryptoStream(ms,
des.CreateEncryptor(), Security.Cryptography.CryptoStreamMode.Write)
Dim plainBytes As Byte() = Text.Encoding.UTF8.GetBytes(value)
encStream.Write(plainBytes, 0, plainBytes.Length)
encStream.FlushFinalBlock()
Dim encryptedBytes(CInt(ms.Length - 1)) As Byte
ms.Position = 0
ms.Read(encryptedBytes, 0, CInt(ms.Length))
encStream.Close()
Return Convert.ToBase64String(encryptedBytes)
End Function
************************************************** ***********

The other thing I noticed was that when I looked at the value pdb.HashName
and des.pdb.HashName it shows "SHA1" instead of "MD5"????

Am I doing something wrong here?

Thanks,

Tom


 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      01-03-2007
"tshad" <> wrote in message
news:...

>I am trying to use 3DES to encrypt my keys and am using VS 2003.
>
> I am confused with some code I have that seems to use a hash (MD5) in the
> 3DES. But a Hash is one way. You are not suppose to be able to decrypt
> it. The only thing I can figure is that it is using the hash only on the
> key.


Contact me privately and I'll give you a copy of my 3DES encryption base
class - it's in C#, but should give you enough guidance to solve your
problem...


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to encript data without iv via 3DES? wolf ASP .Net 0 04-07-2005 07:44 AM
FYI: AES-256 vs. 3DES performance on PIX 515/520 John Caruso Cisco 1 04-29-2004 06:54 AM
PIX Failover and 3DES Gary Cisco 4 11-08-2003 06:41 AM
Re: FS - Cisco Pix 501 - 3DES - 10 user Walter Roberson Cisco 0 07-21-2003 04:05 PM
Re: FS - Cisco Pix 501 - 3DES - 10 user Mike Harrison Cisco 0 07-21-2003 03:10 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57