开发者

Encrypting and decrypting strings

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 applic开发者_高级运维ation using the .net framework if possible.

Thanks!


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.


Have you looked at System.Security.Cryptography?

http://msdn.microsoft.com/en-us/library/system.security.cryptography.aspx

I would look at the AesCryptoServiceProvider.


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/


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜