By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,853 Members | 2,144 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,853 IT Pros & Developers. It's quick & easy.

Encryption

P: n/a
I have to make an Encrytion function that works for both VB.NEt and VB 6. I
use the System.Security.Cryptography in VB.NET and I want to use the same
type of functions in VB6.

I USE DPAPI to store some keys in registry and I want to use the same keys
both in VB6 and VB.NET. The DPAPI works fine in both. The problem is the
Encryprion/Decryption using advapi.dll

I have converted the classes from
http://msdn.microsoft.com/library/de...SecNetHT10.asp
to VB and I want the same classes/methods in VB6.

Anyone who has the same problem ? Any tips, hints ?

--
Regards
Robert Vabo
Gecko AS
www.gecko.no
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
One easy way if you don't mind having your VB6 app relying on the presence
of .NET framework is by putting your VB.NET encryption code in a COM class
(ie instead of add a new class in VB.NET, you add a new COM class), build,
and add a reference in your VB6 app to that COM class. You will need both
sets of binaries (VB.NET and VB6) as well as .NET framework to run your VB6
app but it should work.

Nov 20 '05 #2

P: n/a
Thanks for the answer.
I have now made the component a COM component. I call it from VB6 but I get
this error message :
"Function or interface marked as restricted, or the function uses an
Automation type not supported in Visual Basic". Any suggestions.
I have made all the methods public.
--
Regards
Robert Vabo
Gecko AS
www.gecko.no

"Ting Liang (MSFT)" <tl****@online.microsoft.com> skrev i melding
news:vA**************@cpmsftngxa06.phx.gbl...
One easy way if you don't mind having your VB6 app relying on the presence
of .NET framework is by putting your VB.NET encryption code in a COM class
(ie instead of add a new class in VB.NET, you add a new COM class), build,
and add a reference in your VB6 app to that COM class. You will need both
sets of binaries (VB.NET and VB6) as well as .NET framework to run your VB6 app but it should work.

Nov 20 '05 #3

P: n/a
You should create a VB.net ClassLibrary project (named ClassLibrary1),
remove Class1 and create a new COM class (ComClass1). Implement your
encryption function in ComClass1, eg Public Function Encrypt(...). Build
ClassLibrary1 project. After building you should be able to find
ClassLibrary1 in VB6's Project->References dialog. Check it in the dialog.
You should then be able to write something like Dim x as New
ClassLibrary1.Class1, and make calls x.Encrypt(...) to it.

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.