Reputation: 1719
Does anyone know of a good way to encrypt and decrypt strings using VB6 to ensure sensitive data is secure?
Also, is there an encryption method that can be shared between VB6 and .NET? Example:
The encrypted string will be written to a database using a VB6 application, but the value also need to be read an decrypted in a c# .net application using the .net framework if possible.
Thanks!
Upvotes: 1
Views: 1659
Reputation: 15794
My first thoughts would be to use the built-in CryptoAPI which is built-in to the Microsoft operating systems. This would give you the common-ground effect between your VB6 and C# development platforms.
http://en.wikipedia.org/wiki/Cryptographic_API
Some quick & dirty sample code here: http://www.freevbcode.com/ShowCode.Asp?ID=804
And this is one of the many sites explaining how to do this in C#: Link
Upvotes: 1
Reputation: 1678
You could try VBCorLib which supports the same cryptography classes as found in .NET. The crypto classes in VBCorLib provide a nearly identical API as the .NET classes, so the code will be very similar to perform encryption/decryption between the two platforms.
https://sourceforge.net/projects/vbcorlib/
Upvotes: 1
Reputation: 1362
Rather than putting the work of encrypting / decrypting on the application side, perhaps you could handle the security in the database using the Cryptographic Functions of Transact-SQL? After all, both applications would be connecting to the same database.
Upvotes: 3
Reputation: 1047
Have you looked at System.Security.Cryptography?
http://msdn.microsoft.com/en-us/library/system.security.cryptography.aspx
I would look at the AesCryptoServiceProvider.
Upvotes: 2
Reputation: 1039588
Yeah, symmetric encryption algorithms such as AES are pretty standard so as long as you are using the same keys for encryption and decryption there should be absolutely no problem.
Upvotes: 0