• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Encryption Code Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Encryption Code Problem


  • Subject: Re: Encryption Code Problem
  • From: email@hidden
  • 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.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.

References: 
 >Re: Encryption Code Problem (From: "Jonathan Fleming" <email@hidden>)

  • Prev by Date: [WOMTL] Première rencontre/first meeting
  • Next by Date: Re: Picking up .wo changes
  • Previous by thread: Re: Encryption Code Problem
  • Next by thread: docRoot webresources path string
  • Index(es):
    • Date
    • Thread