Solved

.NET 3.5 Encrypt/Decrypt String

Posted on 2009-05-18
4
2,099 Views
Last Modified: 2013-11-08
I'm looking for functions usable in VB.NET (3.5 framework) that could be used to encrypt and decrypt stings for storage in a database. The database field is a varchar(100) and the source string will never exceed 20 characters.

We would store the key itself in a protected, central location.
0
Comment
Question by:dthansen
4 Comments
 
LVL 12

Accepted Solution

by:
GuitarRich earned 500 total points
ID: 24410909
0
 
LVL 7

Expert Comment

by:lucky_james
ID: 24411052
0
 
LVL 21

Expert Comment

by:Tapan Pattanaik
ID: 24411147
hi dthansen,
             
                   Check these links.

Simple encrypting and decrypting data in C#:

http://www.codeproject.com/KB/security/DotNetCrypto.aspx

Programmatically Encrypt and Decrypt Configuration Sections in web.config using ASP.NET 2.0 & ASP.NET 3.5:


http://www.dotnetcurry.com/ShowArticle.aspx?ID=185

How To: Encrypt and Decrypt Data Using a Symmetric (Rijndael) Key (C#/VB.NET):

http://www.obviex.com/samples/Encryption.aspx


0
 
LVL 15

Expert Comment

by:oobayly
ID: 24411216
Personally, I'd use a VARBINARY field in the database as this will prevent any encoding headaches when converting the byte array to a string. Also, as you've no need to display the encrypted data, why bother with the overhead in converting an byte array to an unreadable string?

As tapanpattanaik suggested, Rijndael (AES) is the standard to use. It uses streams to to the encryption so at the most basic level, everything's done with byte arrays. You would of course be able to use a StreamWriter to write strings to the CryptoStream when encrypting, and a StreamReader to read from CryptoStream when decrypting.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now