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.

2) After I receive the data from the outlying offices, I need to Decrypt
the data using VB.NET 2003 and the Cryptography namespace prior to
transforming the data into an AS/400.

I have successfully written VB6 code which encrypts and decryptes the data
through calls to advapi32.dll. Unfortunately, any attempts to decrypt these
files using VB.NET's Cryptography namespace results in a error and the
attempt always fails.

Can someone give me some examples or guidance in VB6 to VB.NET data 3DES
encryption/decryption??? I am really stumped on this topic. Sample code
would be nice!!! Remember the conditions - Encypt Under VB6 / Decrypt Under
VB.NET 2003.

Thanks
underwmd

Re: Help 3DES File Encrypt in VB6 to 3DES File Decrypt In VB.NET by Rick

Rick
Sun Apr 18 08:32:37 CDT 2004

Almost everybody in this newsgroup is using VB6 or lower. While you may get
a stray answer to VB.NET questions here, you should ask them in newsgroups
devoted exclusively to .NET programming. Look for newsgroups with either the
word "dotnet" or "vsnet" in their name.

For the microsoft news server, try these newsgroups...

microsoft.public.dotnet.general
microsoft.public.dotnet.languages.vb
microsoft.public.vsnet.general

There are some others, but these should get you started.

Rick - MVP



"underwmd" <nospam@nospam.net> wrote in message
news:aRugc.13424665$Of.2236464@news.easynews.com...
> 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.
>
> 2) After I receive the data from the outlying offices, I need to
Decrypt
> the data using VB.NET 2003 and the Cryptography namespace prior to
> transforming the data into an AS/400.
>
> I have successfully written VB6 code which encrypts and decryptes the data
> through calls to advapi32.dll. Unfortunately, any attempts to decrypt
these
> files using VB.NET's Cryptography namespace results in a error and the
> attempt always fails.
>
> Can someone give me some examples or guidance in VB6 to VB.NET data 3DES
> encryption/decryption??? I am really stumped on this topic. Sample code
> would be nice!!! Remember the conditions - Encypt Under VB6 / Decrypt
Under
> VB.NET 2003.
>
> Thanks
> underwmd
>
>



Re: Help 3DES File Encrypt in VB6 to 3DES File Decrypt In VB.NET by underwmd

underwmd
Sun Apr 18 10:45:19 CDT 2004

Rick,

If you were to take note, I posted this to a total of 7 groups encompassing
both VB Classic and VB.NET. With this, I hoped to stir up someone whom is
in a unique situation such as myself whom has to support both platforms

1. microsoft.public.dotnet.framework
2. microsoft.public.dotnet.framework.interop
3. microsoft.public.dotnet.general
4. microsoft.public.dotnet.languages.vb
5. microsoft.public.vb.com
6. microsoft.public.vb.winapi
7. microsoft.public.vb.winapi.networks

This is not the first time I have posted to the USENET.

Michael


"Rick Rothstein" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in message
news:%23mHTbmUJEHA.3436@tk2msftngp13.phx.gbl...
> Almost everybody in this newsgroup is using VB6 or lower. While you may
get
> a stray answer to VB.NET questions here, you should ask them in newsgroups
> devoted exclusively to .NET programming. Look for newsgroups with either
the
> word "dotnet" or "vsnet" in their name.
>
> For the microsoft news server, try these newsgroups...
>
> microsoft.public.dotnet.general
> microsoft.public.dotnet.languages.vb
> microsoft.public.vsnet.general
>
> There are some others, but these should get you started.
>
> Rick - MVP
>
>
>
> "underwmd" <nospam@nospam.net> wrote in message
> news:aRugc.13424665$Of.2236464@news.easynews.com...
> > 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.
> >
> > 2) After I receive the data from the outlying offices, I need to
> Decrypt
> > the data using VB.NET 2003 and the Cryptography namespace prior to
> > transforming the data into an AS/400.
> >
> > I have successfully written VB6 code which encrypts and decryptes the
data
> > through calls to advapi32.dll. Unfortunately, any attempts to decrypt
> these
> > files using VB.NET's Cryptography namespace results in a error and the
> > attempt always fails.
> >
> > Can someone give me some examples or guidance in VB6 to VB.NET data 3DES
> > encryption/decryption??? I am really stumped on this topic. Sample
code
> > would be nice!!! Remember the conditions - Encypt Under VB6 / Decrypt
> Under
> > VB.NET 2003.
> >
> > Thanks
> > underwmd
> >
> >
>
>



Re: Help 3DES File Encrypt in VB6 to 3DES File Decrypt In VB.NET by Eduardo

Eduardo
Sun Apr 18 10:59:33 CDT 2004

If you use this to encrypt the data in VB6 (using MD5 and 3DES):

Encrypting data with CryptoAPI
http://www.mvps.org/emorcillo/vb6/crypto/encrypt.shtml

You can then decrypt it in vb.net using this function:

Private Function DecryptData(ByVal data() As Byte, ByVal password As String)
As Byte()

' Create the 3DES service provider
Dim tdes As New TripleDESCryptoServiceProvider

' Create a PasswordDeriveBytes to derive the key
' from the password
Dim passderive As New PasswordDeriveBytes(password, Nothing)
Dim iv As Byte() = New Byte() {0, 0, 0, 0, 0, 0, 0, 0}

' Derive the key from the password
tdes.Key = passderive.CryptDeriveKey("TripleDES", "MD5", 0, iv)
tdes.IV = iv

' Get the decryptor
Dim decryptor As ICryptoTransform = tdes.CreateDecryptor

' Decrypt the data
DecryptData = decryptor.TransformFinalBlock(data, 0, data.Length)

decryptor.Dispose()

End Function

--
Eduardo A. Morcillo [MS MVP VB]
http://www.mvps.org/emorcillo



Re: Help 3DES File Encrypt in VB6 to 3DES File Decrypt In VB.NET by Rick

Rick
Sun Apr 18 11:17:59 CDT 2004

Sorry, I missed the multi-post when I responded. However, for future
reference, VB Classic and VB.NET are, for all practical purposes, different
languages (as you no doubt are aware). I would submit that you will find
those supporting both languages (such as yourself) will be located in the
dotnet newsgroups along with those who only support VB.NET... if they are
participants in a non-dotnet newsgroup, then they are surely participants in
a dotnet group also. For the **vast** majority of users here in the
non-dotnet newsgroups, postings about VB.NET amount to nothing more than
noise.

Rick - MVP


"underwmd" <nospam@nospam.net> wrote in message
news:joxgc.13342255$Id.2217333@news.easynews.com...
> Rick,
>
> If you were to take note, I posted this to a total of 7 groups
encompassing
> both VB Classic and VB.NET. With this, I hoped to stir up someone whom is
> in a unique situation such as myself whom has to support both platforms
>
> 1. microsoft.public.dotnet.framework
> 2. microsoft.public.dotnet.framework.interop
> 3. microsoft.public.dotnet.general
> 4. microsoft.public.dotnet.languages.vb
> 5. microsoft.public.vb.com
> 6. microsoft.public.vb.winapi
> 7. microsoft.public.vb.winapi.networks
>
> This is not the first time I have posted to the USENET.
>
> Michael
>
>
> "Rick Rothstein" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in message
> news:%23mHTbmUJEHA.3436@tk2msftngp13.phx.gbl...
> > Almost everybody in this newsgroup is using VB6 or lower. While you may
> get
> > a stray answer to VB.NET questions here, you should ask them in
newsgroups
> > devoted exclusively to .NET programming. Look for newsgroups with either
> the
> > word "dotnet" or "vsnet" in their name.
> >
> > For the microsoft news server, try these newsgroups...
> >
> > microsoft.public.dotnet.general
> > microsoft.public.dotnet.languages.vb
> > microsoft.public.vsnet.general
> >
> > There are some others, but these should get you started.
> >
> > Rick - MVP
> >
> >
> >
> > "underwmd" <nospam@nospam.net> wrote in message
> > news:aRugc.13424665$Of.2236464@news.easynews.com...
> > > 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.
> > >
> > > 2) After I receive the data from the outlying offices, I need to
> > Decrypt
> > > the data using VB.NET 2003 and the Cryptography namespace prior to
> > > transforming the data into an AS/400.
> > >
> > > I have successfully written VB6 code which encrypts and decryptes the
> data
> > > through calls to advapi32.dll. Unfortunately, any attempts to decrypt
> > these
> > > files using VB.NET's Cryptography namespace results in a error and the
> > > attempt always fails.
> > >
> > > Can someone give me some examples or guidance in VB6 to VB.NET data
3DES
> > > encryption/decryption??? I am really stumped on this topic. Sample
> code
> > > would be nice!!! Remember the conditions - Encypt Under VB6 / Decrypt
> > Under
> > > VB.NET 2003.
> > >
> > > Thanks
> > > underwmd
> > >
> > >
> >
> >
>
>



Re: Help 3DES File Encrypt in VB6 to 3DES File Decrypt In VB.NET by underwmd

underwmd
Sun Apr 18 11:21:38 CDT 2004

Eduardo

I'll try your recommendations and get back with you.

In the mean time to enlighten me on this issue further:

Can you refence a document to me to give me an idea of how to combine the
hashing with the encryption technique, how would I have known without your
reply to use a zeroed byte array for the IV array. The security and
encryption of VB classic and VB.NET is all new to me.

Thank you for your time

Michael Underwood

"Eduardo A. Morcillo [MS MVP VB]" <emorcillo_at_mvps.org> wrote in message
news:umTQj4VJEHA.2576@TK2MSFTNGP12.phx.gbl...
> If you use this to encrypt the data in VB6 (using MD5 and 3DES):
>
> Encrypting data with CryptoAPI
> http://www.mvps.org/emorcillo/vb6/crypto/encrypt.shtml
>
> You can then decrypt it in vb.net using this function:
>
> Private Function DecryptData(ByVal data() As Byte, ByVal password As
String)
> As Byte()
>
> ' Create the 3DES service provider
> Dim tdes As New TripleDESCryptoServiceProvider
>
> ' Create a PasswordDeriveBytes to derive the key
> ' from the password
> Dim passderive As New PasswordDeriveBytes(password, Nothing)
> Dim iv As Byte() = New Byte() {0, 0, 0, 0, 0, 0, 0, 0}
>
> ' Derive the key from the password
> tdes.Key = passderive.CryptDeriveKey("TripleDES", "MD5", 0, iv)
> tdes.IV = iv
>
> ' Get the decryptor
> Dim decryptor As ICryptoTransform = tdes.CreateDecryptor
>
> ' Decrypt the data
> DecryptData = decryptor.TransformFinalBlock(data, 0, data.Length)
>
> decryptor.Dispose()
>
> End Function
>
> --
> Eduardo A. Morcillo [MS MVP VB]
> http://www.mvps.org/emorcillo
>
>



Re: Help 3DES File Encrypt in VB6 to 3DES File Decrypt In VB.NET by Andreas

Andreas
Sun Apr 18 11:23:17 CDT 2004

> This is not the first time I have posted to the USENET.

Then you should know that you should NOT cross-post?

> Michael
>
>
> "Rick Rothstein" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in message
> news:%23mHTbmUJEHA.3436@tk2msftngp13.phx.gbl...
> > Almost everybody in this newsgroup is using VB6 or lower. While you may
> get
> > a stray answer to VB.NET questions here, you should ask them in
newsgroups
> > devoted exclusively to .NET programming. Look for newsgroups with either
> the
> > word "dotnet" or "vsnet" in their name.
> >
> > For the microsoft news server, try these newsgroups...
> >
> > microsoft.public.dotnet.general
> > microsoft.public.dotnet.languages.vb
> > microsoft.public.vsnet.general
> >
> > There are some others, but these should get you started.
> >
> > Rick - MVP
> >
> >
> >
> > "underwmd" <nospam@nospam.net> wrote in message
> > news:aRugc.13424665$Of.2236464@news.easynews.com...
> > > 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.
> > >
> > > 2) After I receive the data from the outlying offices, I need to
> > Decrypt
> > > the data using VB.NET 2003 and the Cryptography namespace prior to
> > > transforming the data into an AS/400.
> > >
> > > I have successfully written VB6 code which encrypts and decryptes the
> data
> > > through calls to advapi32.dll. Unfortunately, any attempts to decrypt
> > these
> > > files using VB.NET's Cryptography namespace results in a error and the
> > > attempt always fails.
> > >
> > > Can someone give me some examples or guidance in VB6 to VB.NET data
3DES
> > > encryption/decryption??? I am really stumped on this topic. Sample
> code
> > > would be nice!!! Remember the conditions - Encypt Under VB6 / Decrypt
> > Under
> > > VB.NET 2003.
> > >
> > > Thanks
> > > underwmd
> > >
> > >
> >
> >
>
>



Re: Help 3DES File Encrypt in VB6 to 3DES File Decrypt In VB.NET by Bob

Bob
Sun Apr 18 11:43:52 CDT 2004

underwmd wrote:
>
> This is not the first time I have posted to the USENET.
>

That's obviously correct ... but only accidentally.

microsoft.* is not USENET.



Bob
--