473,473 Members | 1,502 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

String Encrypt and Decrypt Examples

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 encrypt and decrypt a string

Is it possible to convert a string that represents a byte array as the output string below
string input = "something"
Byte[] clearBytes = new UnicodeEncoding().GetBytes(input)
string output = BitConverter.ToString(clearBytes)
back into original string "something"

Thank you
Nov 17 '05 #1
2 4285
are the encryption / decryption classes in system.security.cryptography not
good enough?
they can do exactly what you ask for, or am i missing something?

kind regards,
Bruno.
"Greg R" <an*******@discussions.microsoft.com> wrote in message
news:F9**********************************@microsof t.com...
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 encrypt and decrypt a string.
Is it possible to convert a string that represents a byte array as the output string below:
{
string input = "something";
Byte[] clearBytes = new UnicodeEncoding().GetBytes(input);
string output = BitConverter.ToString(clearBytes);
}

back into original string "something"?

Thank you

Nov 17 '05 #2
Greg,

Check this: http://www.obviex.com/samples/encryption.aspx.

Alek

"Greg R" <an*******@discussions.microsoft.com> wrote in message
news:F9**********************************@microsof t.com...
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 encrypt and decrypt a string.
Is it possible to convert a string that represents a byte array as the output string below:
{
string input = "something";
Byte[] clearBytes = new UnicodeEncoding().GetBytes(input);
string output = BitConverter.ToString(clearBytes);
}

back into original string "something"?

Thank you

Nov 17 '05 #3

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

Similar topics

1
by: wqhdebian | last post by:
As far as I know,when encrypt or decrypt ,a key must first be got,and the key is first generate by a tool or from SecurityRandom,that means I can not generate the same key with the same input.Does...
12
by: Dave Bailey | last post by:
I need to store an encrypted connection string in the web.config file. I have found several examples on the Net but nothing specific as to how to accomplish task. Thanks in advance, Dave
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)...
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#) ...
12
by: Charlie | last post by:
Hi: My host will not allow me use a trusted connection or make registry setting, so I'm stuck trying find a way to hide connection string which will be stored in web.config file. If I encrypt...
7
by: Bob Hollness | last post by:
OK, this has me pulling my hair out. All I want to do is encrypt/decrypt strings. They may be up to 400 characters in length though. So, I assume System.Security.Cryptography is the one to use....
8
by: moondaddy | last post by:
I need to convert a byte array to a string and pass it as a parameter in a URL and then convert it back to the original byte array. However, its getting scrambled in the conversion. In short,...
8
by: toupeira23 | last post by:
Hello, I'm trying to encrypt passwords in my app. After discovering that there's no simple function to do this, I wrote a wrapper class which decodes a string using UTF8, encrypts it with...
4
by: JJ | last post by:
I need to encrypt credit card # and store that in a database (and be able to decrypt it). Any codes that use strong encyption algorithm like AES 256 on the web that I can copy and paste? Thanks
5
by: Ranginald | last post by:
Hi, I have a question about encrypting connection strings in an asp.net 2.0 app in a shared hosting environment. From what I have read, I believe I need to programatically encrypt and decrypt...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
1
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...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.