Re: Encrypt Decrypt URL UnURL Weirdness

This WebDNA talk-list message is from

2001


It keeps the original formatting.
numero = 40187
interpreted = N
texte = You need to understand the sequence in which WebCat is working here. WebCat always works from the inside of nested contexts to the outside...[URL][URL][Encrypt Seed=123][Something][/Encrypt][/URL][/URL]tells WebCat to: 1) Encrypt Something 2) URL encode the result of step 1 3) URL encode the result of step 2You need to un-do this in the reverse order: 1) UnURL 2) UnURL 3) DecryptBut, your code:[UnURL][Decrypt Seed=123][Something][/Decrypt][/UnURL]does this backwards... 1) Decrypt (the double-URL-encoded value - which doesn't work) 2) UnUrl (the failed decrypted value)Sometimes this will work, but only if URL didn't actually change the original encrypted value (i.e. no characters needed to be encoded).The correct code for un-doing your encryption/encoding example would be:[Decrypt Seed=123][UnURL][UnURL][Something][/UnURL][/UnURL][/Decrypt]As for the need to sometimes do a double URL and a single UnURL, this comes from situations where WebCatalog does an implied UnURL - such as when writing to a database or setting a cookie. If you put %20 as the value of a field in an APPEND or REPLACE context, WebCatalog will automatically UnURL the value when writing it to the database, so the database will actually contain a space character. Because ENCRYPT can result in some pretty funky characters, some of which may cause problems when stored in a database, it is a good idea to do a double URL when storing an encrypted value. In our space character example, storing [url]%20[/url] will actually write %20 to the database. In order to see this as a space character again, you would need to wrap the database field in an UnURL context.What this comes down to is that given a field called public in plain text, to encrypt it and store it in a database should be done something like this:[replace db=my.db&eqSKUdatarq=[mySKU]][!] [/!]private=[url][url][encrypt seed=123][public][/encrypt][/url][/url][!] [/replace]To view this field as plain text:[search db=my.db&eqSKUdatarq=[mySKU]][founditems] public => [decrypt seed=123][UnURL][private][/UnURL][/decrypt] [/founditems][/search] Hope this helps... - BrianAt 12:33 PM 11/17/2001, Glenn Busbin wrote: >I read an archive message about encrypting and decrypting the >contents of a database. It said that >sometimes you have to experiment with the URL and UnURL tags to get >the encrypt/decrypt tags to >work properly. It said that using two Encrypt tags and one Decrypt >tag worked, but to >experiment and see what works on each setup. > >I tried that in one database and had no problems. I used: >[URL][URL][Encrypt Seed=123][Something][/Encrypt][/URL][/URL] >[UnURL][Decrypt Seed=123][Something][/Decrypt][/UnURL] > >This seems to work in that database, so I tried it on another one, >but used a different Seed. >Again, I used two URL's with the Encrypt tags and one UnURL with the >Decrypt tags >[URL][URL][Encrypt Seed=qwerty][SomethingElse][/Encrypt][/URL][/URL] >[UnURL][Decrypt Seed=qwerty][SomethingElse][/Decrypt][/UnURL] > >That's when the problems appeared. Some fields would Decrypt and >display properly, but not all. >I then tried using 2 UnURL outside of the Decrypt tags: >[UNURL][UnURL][Decrypt Seed=qwerty][SomethingElse][/Decrypt][/UnURL][/UNURL] >That sometimes worked, but not always. > >I then tried using 2 UnURL tags inside of the Decrypt tags: >[Decrypt Seed=qwerty][UNURL][UnURL][SomethingElse][/UnURL][/UNURL][/Decrypt] >This works 100% of the time in this database. > >I also used 1 UnURL tag outside of the Decrypt tag and another UnURL >tag inside of it. >[UnURL][Decrypt Seed=qwerty][UNURL][SomethingElse][/UNURL][/Decrypt][/UnURL] >This also works 100% of the time. > >It's odd that one format will work in one database, but not in >another. Both contain plain text in the database fields. Does anyone >have any idea why? > >Mac, WC 3.08, IE 5. > >Glenn > > > >------------------------------------------------------------- >This message is sent to you because you are subscribed to > the mailing list . >To unsubscribe, E-mail to: >To switch to the DIGEST mode, E-mail to > >Web Archive of this list is at: http://search.smithmicro.com/-- <= Brian C. Fries, BrainScan Software http://www.brainscansoftware.com =>------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: Encrypt Decrypt URL UnURL Weirdness (Stuart Tremain 2001)
  2. Re: Encrypt Decrypt URL UnURL Weirdness (Glenn Busbin 2001)
  3. Re: Encrypt Decrypt URL UnURL Weirdness (Stuart Tremain 2001)
  4. Re: Encrypt Decrypt URL UnURL Weirdness (Glenn Busbin 2001)
  5. Re: Encrypt Decrypt URL UnURL Weirdness (Brian Fries 2001)
  6. Re: Encrypt Decrypt URL UnURL Weirdness (Glenn Busbin 2001)
  7. Re: Encrypt Decrypt URL UnURL Weirdness (Brian Fries 2001)
  8. Re: Encrypt Decrypt URL UnURL Weirdness (Glenn Busbin 2001)
  9. Re: Encrypt Decrypt URL UnURL Weirdness (Brian Fries 2001)
  10. Encrypt Decrypt URL UnURL Weirdness (Glenn Busbin 2001)
You need to understand the sequence in which WebCat is working here. WebCat always works from the inside of nested contexts to the outside...[url][url][Encrypt Seed=123][Something][/Encrypt][/URL][/URL]tells WebCat to: 1) Encrypt Something 2) URL encode the result of step 1 3) URL encode the result of step 2You need to un-do this in the reverse order: 1) UnURL 2) UnURL 3) DecryptBut, your code:[unurl][Decrypt Seed=123][Something][/Decrypt][/UnURL]does this backwards... 1) Decrypt (the double-URL-encoded value - which doesn't work) 2) UnUrl (the failed decrypted value)Sometimes this will work, but only if URL didn't actually change the original encrypted value (i.e. no characters needed to be encoded).The correct code for un-doing your encryption/encoding example would be:[Decrypt Seed=123][unurl][unurl][Something][/UnURL][/UnURL][/Decrypt]As for the need to sometimes do a double URL and a single UnURL, this comes from situations where WebCatalog does an implied UnURL - such as when writing to a database or setting a cookie. If you put %20 as the value of a field in an APPEND or REPLACE context, WebCatalog will automatically UnURL the value when writing it to the database, so the database will actually contain a space character. Because ENCRYPT can result in some pretty funky characters, some of which may cause problems when stored in a database, it is a good idea to do a double URL when storing an encrypted value. In our space character example, storing [url]%20[/url] will actually write %20 to the database. In order to see this as a space character again, you would need to wrap the database field in an UnURL context.What this comes down to is that given a field called public in plain text, to encrypt it and store it in a database should be done something like this:[replace db=my.db&eqSKUdatarq=[mySKU]][!] [/!]private=[url][url][encrypt seed=123][public][/encrypt][/url][/url][!] [/replace]To view this field as plain text:[search db=my.db&eqSKUdatarq=[mySKU]][founditems] public => [decrypt seed=123][unurl][private][/UnURL][/decrypt] [/founditems][/search] Hope this helps... - BrianAt 12:33 PM 11/17/2001, Glenn Busbin wrote: >I read an archive message about encrypting and decrypting the >contents of a database. It said that >sometimes you have to experiment with the URL and UnURL tags to get >the encrypt/decrypt tags to >work properly. It said that using two Encrypt tags and one Decrypt >tag worked, but to >experiment and see what works on each setup. > >I tried that in one database and had no problems. I used: >[url][url][Encrypt Seed=123][Something][/Encrypt][/URL][/URL] >[unurl][Decrypt Seed=123][Something][/Decrypt][/UnURL] > >This seems to work in that database, so I tried it on another one, >but used a different Seed. >Again, I used two URL's with the Encrypt tags and one UnURL with the >Decrypt tags >[url][url][Encrypt Seed=qwerty][SomethingElse][/Encrypt][/URL][/URL] >[unurl][Decrypt Seed=qwerty][SomethingElse][/Decrypt][/UnURL] > >That's when the problems appeared. Some fields would Decrypt and >display properly, but not all. >I then tried using 2 UnURL outside of the Decrypt tags: >[unurl][unurl][Decrypt Seed=qwerty][SomethingElse][/Decrypt][/UnURL][/UNURL] >That sometimes worked, but not always. > >I then tried using 2 UnURL tags inside of the Decrypt tags: >[Decrypt Seed=qwerty][unurl][unurl][SomethingElse][/UnURL][/UNURL][/Decrypt] >This works 100% of the time in this database. > >I also used 1 UnURL tag outside of the Decrypt tag and another UnURL >tag inside of it. >[unurl][Decrypt Seed=qwerty][unurl][SomethingElse][/UNURL][/Decrypt][/UnURL] >This also works 100% of the time. > >It's odd that one format will work in one database, but not in >another. Both contain plain text in the database fields. Does anyone >have any idea why? > >Mac, WC 3.08, IE 5. > >Glenn > > > >------------------------------------------------------------- >This message is sent to you because you are subscribed to > the mailing list . >To unsubscribe, E-mail to: >To switch to the DIGEST mode, E-mail to > >Web Archive of this list is at: http://search.smithmicro.com/-- <= Brian C. Fries, BrainScan Software http://www.brainscansoftware.com =>------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/ Brian Fries

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Webcatalog, Webstar and Crasharama (1999) international time (1997) Separate SSL Server (1997) [WebDNA] SETCOOKIE (2009) requiring form fields? (2000) search for all (1998) [WriteFile] problems (1997) EMailer - WebSTAR V - OSX - WebDNA (2003) Separate SSL Server (1997) RE: OK, here goes... (1997) Problems deleting when a search field is blank... (1998) WebCatalog and WebTen (1997) [username][password] not showing up! HELP! (1999) Sorry if this is really stupid but.. (2000) Using Checkbox (2000) [WebDNA] WebDNA and macOS 10.4 Mojave - Operational? (2018) New Web Site Developers Database (1996) Input appreciated (2000) updating with ProductEditor (1998) TCP Connect (2000)