NetTalk Central

Author Topic: Encrypt parameters in hyperlink - generally  (Read 2742 times)

Matthew

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • Email
Encrypt parameters in hyperlink - generally
« on: July 05, 2013, 02:20:18 AM »
Hello

I have some questions about encryption parameters.

1. Does NetTalk contain the encryption parameters function or something like that?
2. Is it possible to add this functionality in future release?

Example:
1. I would like to pass 2 parameters from one site to another.
2. I create link using p_web.CreateHyperlink function for example: p_web.CreateHyperlink('Go to the shop', 'myshopsite?login=mylogin&pass=123')
3. In myshopsite I have read parameters and store them into the SessionValues.
4. It would be very nicely if p_web.CreateHyperlink function would have option to encryption every parameter and maybe every name of the parameter, so hyperlink could looks like:
  myshopsite?login=hfw7583983gvf465&pass=jgjsdfjkg773hk634jyjjg
5. Then some function in myshopsite procedure could decrypt those parameters.

Does NetTalk has such a functionality or if not how can I simply do it myself?

Regards,
Matthew

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11239
    • View Profile
Re: Encrypt parameters in hyperlink - generally
« Reply #1 on: July 05, 2013, 08:40:18 AM »
Hi Matthew,

are you controlling both ends - ie both sites? Or is one of the sites written in some other language?

Cheers
Bruce

Matthew

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • Email
Re: Encrypt parameters in hyperlink - generally
« Reply #2 on: July 07, 2013, 09:57:18 PM »

Yes, I have controling both ends.

All websites written using NetTalk 7.10

Regards,
Matthew

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11239
    • View Profile
Re: Encrypt parameters in hyperlink - generally
« Reply #3 on: July 08, 2013, 12:44:53 AM »
ok, so the key is that you get to encrypt it in one place, using any arbitrary encryption you like, and then you use the same thing to decrypt on the other side. Because you have control this becomes pretty straight-forward.

Firstly, it's worth noting that you may want to, for aesthetic reasons, convert the encrypted data (which is binary) to base 64 before using it on the link. This will look a bit "neater". StringTheory has methods for converting to Base64, so obviously you can use that.

Encryption itself is outside the scope of NetTalk itself, so typically you'd use a separate encryption library to encrypt and decrypt the data. (Cryptonite is obviously the one I'd use, but any good encryption library would work.)

If you need more then just ask - but that should get you going in the right direction.

cheers
Bruce