473,394 Members | 1,944 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

String Cryptography

Hello.
How can I crypt and decrypt string using System.Security.Cryptography
namespase methods?
Send me any example please.
Nov 16 '05 #1
2 10172
Sample code: http://www.obviex.com/samples/Encryption.aspx
Background: http://msdn.microsoft.com/msdnmag/is...S/default.aspx

"msnews.microsoft.com" <da*********@hotmail.com> wrote in message
news:Ox**************@TK2MSFTNGP10.phx.gbl...
Hello.
How can I crypt and decrypt string using System.Security.Cryptography
namespase methods?
Send me any example please.

Nov 16 '05 #2
msnews.microsoft.com <da*********@hotmail.com> wrote:
How can I crypt and decrypt string using System.Security.Cryptography
namespase methods?
Send me any example please.


Cryptography generally works on binary data rather than text data. So,
you need to convert the text data to binary data first (using an
Encoding), encrypt the binary data, and (usually) then convert the
binary data back to text - this time using something like
Convert.ToBase64String.

To decrypt, you reverse the process:

From the base64-encoded string, you get the encrypted binary data using
Convert.FromBase64String. You then decrypt the binary data as
documented in the MSDN (using CryptoStream etc), and then use Encoding
to get back to the original string.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: shappen | last post by:
Is there a function to do this ? with the string parameter,it return the encryption result of the string ?
7
by: Matthias S. | last post by:
Hi, I had a look at the vast information on encryption in the MSDN and got pretty confused. All I want to do is to encrypt a string into an encrypted string and later decrypt that (encrypted)...
2
by: Greg R | last post by:
Where can I find a code example that will demonstrate the encryption and decryption of a string in C# I am familiar with "System.Security.Cryptography" encryption, but need a system that will both...
1
by: Srinivasa Reddy K Ganji | last post by:
Hi I want to encrypt the database connection string and add it to web.config file. Before connecting to the database I want to decrypt it. Can anyone suggest me how to implement this (c#) ...
4
by: Charlie | last post by:
Hi: I'm storing my dB connection in web.config file. Since it will be easily read by opening file, what is a good way to secure it? Thanks, Charlie
5
by: Tony | last post by:
Is there a quick and easy way to encrypt and decrypt a string in vb.net
4
by: Trapulo | last post by:
I've a webservice with a string parameter. I call this webservice passing a string that is 1129 chars length. On the webservice, the received string is 1146 length (I tested sizes with...
4
by: vcnewbie | last post by:
Hi I'm maintaining a VisualC++ project to increase its security regarding stored passwords. I thought about using SHA256Managed to create a hash for the password when creating a user and when...
3
by: ad | last post by:
I want to hash a givien string to a hashed string. How can I do witth c#?
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.