473,769 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

3DES confusion

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.Crypto graphy.TripleDE SCryptoServiceP rovider
des.IV = New Byte(7) {}
Dim pdb As New Security.Crypto graphy.Password DeriveBytes(key ,
New Byte(-1) {})
des.Key = pdb.CryptDerive Key("TripleDES" , "MD5", 168, New
Byte(7) {})
Dim ms As New IO.MemoryStream ((value.Length * 2) - 1)
Dim encStream As New Security.Crypto graphy.CryptoSt ream(ms,
des.CreateEncry ptor(), Security.Crypto graphy.CryptoSt reamMode.Write)
Dim plainBytes As Byte() = Text.Encoding.U TF8.GetBytes(va lue)
encStream.Write (plainBytes, 0, plainBytes.Leng th)
encStream.Flush FinalBlock()
Dim encryptedBytes( CInt(ms.Length - 1)) As Byte
ms.Position = 0
ms.Read(encrypt edBytes, 0, CInt(ms.Length) )
encStream.Close ()
Return Convert.ToBase6 4String(encrypt edBytes)
End Function
*************** *************** *************** *************** *

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

Am I doing something wrong here?

Thanks,

Tom
Jan 3 '07 #1
1 1576
"tshad" <ts**********@f tsolutions.comw rote in message
news:uL******** ******@TK2MSFTN GP02.phx.gbl...
>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...
Jan 3 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
766
by: underwmd | last post by:
Hello, My problem is two fold. 1) I must support a deployed legacy application written in VB6 SP5. I need to export data from a database, compress it and the encrypt the data using 3DES (to prevent tampering) data gets transmitted at night to the home office of my company. Rewriting this application in .NET is not an option as the application was 5 years in development.
3
5091
by: Simang | last post by:
Hi, I am trying to encrypt viewstate in my ASP.NET web site. I put these items in the web.config.. <pages enableViewStateMac="true" /> <machineKey validation="3DES"/> However, when I tried to access the .NET pages, I encountered the ff error:
3
7785
by: Michael Bebenita | last post by:
Hi, A Java application is encrypting a block of text using 3DES ECB mode and PKCS5 padding. I need to decrypt this text using C#. I've extracted the 192 bit key using the getEncoded() method of the SecretKey Java class. However when I use this key in .NET i cannot decrypt the cipher text. I am pretty sure that all my settings are correct, as far as setting the ECB mode, PKCS5 padding and converting the cipher text to byte
0
1461
by: Frederic ESNOUF \(MVP-ISA\) | last post by:
Hi, My question is about 3des, ... in fact the difference between 3DES with Capicom (VB) and VB.net With VB6/capicom, encrypting data is simple : message.Content = "This is my bank account : Azerty007" message.SetSecret "MyPassword' message.Algorithm.KeyLength = CAPICOM_ENCRYPTION_KEY_LENGTH_128_BITS message.Algorithm.Name = CAPICOM_ENCRYPTION_ALGORITHM_3DES
0
1149
by: tshad | last post by:
I have been trying to create encoding/decoding functions for secure Credit Card information. I was looking at 3DES/MD5 and RC2/MD5. I found a simple function that seemed to work pretty well, but I am confused as to what is happening. In the routine I found it was using the TripleDESCryptoServiceProvider (and not the RC2CryptoServiceProvider) class. But in the CryptDeriveKey, it was
1
8040
by: Sathyaish | last post by:
I have the following scenario: Algorithm: 3DES Cipher Mode: CBC Key Size: 128-bit Block Size: 64 bit IV: 0x0000000000000000 (an eight byte array of zeros) The results I get using .NET with the following routine are:
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7409
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3959
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3562
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.