Re: Encryption Code Problem [SOLVED]
Re: Encryption Code Problem [SOLVED]
- Subject: Re: Encryption Code Problem [SOLVED]
- From: "Jonathan Fleming" <email@hidden>
- Date: Fri, 06 Jun 2003 00:05:52 +0100
From: email@hidden
To: Jonathan Fleming <email@hidden>
CC: email@hidden, email@hidden
Subject: Re: Encryption Code Problem
Date: Thu, 5 Jun 2003 14:58:44 +0100
Jonathan-
On Wednesday, June 4, 2003, at 09:57 pm, Jonathan Fleming wrote:
This is what I'm doing for Denis's code
I draged the try block off of the Sun code example site (
http://javaalmanac.com/egs/java.net/FormEncode.html?|=find ) but I don't
fully understand how to use it. I tried configuring it but to no avail so
i've left it as is hoping someone can help me out.
public void setPassword(String password) {
String encryptedPassword = encrypt(password);
try {
// Construct a x-www-form-urlencoded string
String line = URLEncoder.encode("name1", "UTF-8") + "=" +
URLEncoder.encode("value1", "UTF-8");
line += "&" + URLEncoder.encode("name2", "UTF-8") + "=" +
URLEncoder.encode("value2", "UTF-8");
// Parse a x-www-form-urlencoded string
String[] pairs = line.split("\\&");
for (int i=0; i<pairs.length; i++) {
String[] fields = pairs[i].split("=");
String name = URLDecoder.decode(fields[0], "UTF-8");
String value = URLDecoder.decode(fields[1], "UTF-8");
}
} catch (UnsupportedEncodingException e) {
}
takeStoredValueForKey(encryptedPassword, "password");
}
Forget that.
I wanted to suggest using URLEncoder just as you would use HexCoder,
I don't know where my head was going, but then again, most of the time I can
be a dodo, the rest of the time though i'm pure genius... I wish ;^)
I finally went with this option as it was simple straight forward and less
code, but big thanks to you Jonathan for taking time and helping me out. You
too Denis.
Kind regards
Joanthan F :^)
i.e.
public void setPassword(String password) {
String encryptedPassword = encrypt(password);
String encoded = URLEncoder.encode(encryptedPassword);
//boolean deleteClientDirContents = deleteDir(new
File(sClientDtaDirectory()));
takeStoredValueForKey(encoded, "password");
}
Cheers,
-- Denis.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_________________________________________________________________
Use MSN Messenger to send music and pics to your friends
http://www.msn.co.uk/messenger
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.