decrypt decrypted string using convert.frombase64string()

S

Steve

I took over a web app that the developer encrypted the connection string. The connection string looks something like this [mchckjkfiekifjfyhg} (example), he is reading the string as

string con = ASCII.GetString(Convert.FromBase64String(ConfigurationManager.AppSettings["connection"]));

Now, I need to change the string in the web config file, so how can I get the new connection string from plain text to the encrypted string as is currently used?
 
M

marss

I took over a web app that the developer encrypted the connection string. The connection string looks something like this [mchckjkfiekifjfyhg} (example), he is reading the string as

string con = ASCII.GetString(Convert.FromBase64String(ConfigurationManager.AppSettings["connection"]));

Now, I need to change the string in the web config file, so how can I get the new connection string from plain text to the encrypted string as is currently used?

byte[] bytes = System.Text.Encoding.ASCII.GetBytes(originalString);
string encodedString = Convert.ToBase64String(bytes);

Regards,
Mykola
http://marss.co.ua
 
P

Patrice

Sorry for being picky but note that the string is "encoded" rather than
"encrypted".

---
Patrice

marss said:
I took over a web app that the developer encrypted the connection string.
The connection string looks something like this [mchckjkfiekifjfyhg}
(example), he is reading the string as

string con =
ASCII.GetString(Convert.FromBase64String(ConfigurationManager.AppSettings["connection"]));

Now, I need to change the string in the web config file, so how can I get
the new connection string from plain text to the encrypted string as is
currently used?

byte[] bytes = System.Text.Encoding.ASCII.GetBytes(originalString);
string encodedString = Convert.ToBase64String(bytes);

Regards,
Mykola
http://marss.co.ua
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top