|  | Cookie encryption? |  | |
| | | Walter Sobchak |  |
| Posted: Fri Aug 29, 2008 12:17 pm Post subject: Cookie encryption? |  |
The connection is ssl encrypted and I need to write some sensitive information in a cookie. I'd like to encrypt the cookie on the client so it could be decrypted later on the server.
1. If I use a symmetric algorithm how do I send the encryption key? 2. Is there any asymmetric algorithm that doesn't have an impact on performance? 3. Is there a difference in writing cookies with http an https? I think https in that case doesn't help.
Thanks in advance for any suggestions. |
| |
| | | Doug Miller |  |
| Posted: Fri Aug 29, 2008 1:09 pm Post subject: Re: Cookie encryption? |  |
In article <g990ds$1e5$2@news.metronet.hr>, Walter Sobchak <genijalac@yahoo.com> wrote:
| Quote: | The connection is ssl encrypted and I need to write some sensitive information in a cookie. I'd like to encrypt the cookie on the client so it could be decrypted later on the server.
|
Posting this question in a javascript newsgroup implies that you intend to write your encryption algorithm in javascript.
Consider that doing so exposes your encryption algorithm, including the encryption key, to anyone with the wit to click View Source.
Does this seem like a good plan?
-- Regards, Doug Miller (alphageek-at-milmac-dot-com)
Join the UseNet Improvement Project: killfile Google Groups. LINK
Get a copy of my NEW AND IMPROVED TrollFilter for NewsProxy/Nfilter by sending email to autoresponder at filterinfo-at-milmac-dot-com You must use your REAL email address to get a response.
Download Nfilter at LINK |
| |
| | | Mike Duffy |  |
| Posted: Fri Aug 29, 2008 2:35 pm Post subject: Re: Cookie encryption? |  |
spambait@milmac.com (Doug Miller) wrote in news:mjUtk.19354$cW3.6486@nlpi064.nbdc.sbc.com:
| Quote: | In article <g990ds$1e5$2@news.metronet.hr>, Walter Sobchak genijalac@yahoo.com> wrote:
Consider that doing so exposes your encryption algorithm, including the encryption key, to anyone with the wit to click View Source.
Does this seem like a good plan?
|
You could ask the end user for a password. Then you end up with something that can only be decrypted by the client. You would need to prompt the user again for the password when it is needed to decrypt the cookie. |
| |
| | | Bart Van der Donck |  |
| Posted: Fri Aug 29, 2008 4:32 pm Post subject: Re: Cookie encryption? |  |
| |  | |
Walter Sobchak wrote:
| Quote: | The connection is ssl encrypted and I need to write some sensitive information in a cookie. I'd like to encrypt the cookie on the client so it could be decrypted later on the server.
|
I would usually not perform such a task at the client. The server could both encrypt the value and set the cookie via a HTTP-header (still better than document.cookie IMHO).
| Quote: | 1. If I use a symmetric algorithm how do I send the encryption key?
|
If you would use javascript, there is no other choice than making the key/salt available as plaintext for the script in the web page; thus making it interceptable for the viewer of the page. I think there can be little doubt that a server-side solution would be better in this case.
| Quote: | 2. Is there any asymmetric algorithm that doesn't have an impact on performance?
|
Encryption is memory-intensive by nature; but I wouldn't care much about only one en-/decrypt action. The difficuly for asymmetric cryptography is that there are both the private key (encrypt) and the public key (decrypt).
A somewhat safe strategy could be to make only the public key available to the client; so he can only decrypt the cookie with it. But I believe this would be the opposite of your plan: when you want to encrypt asymmetrically in javascript, you always need the private key.
But I think that symmetric cryptography is more recommended in your scenario (and preferably done at the server).
| Quote: | 3. Is there a difference in writing cookies with http an https? I think https in that case doesn't help.
|
HTTPS secures the transmission of data along the line, but nothing more. You are only reasonably safe that nobody can intercept data between server and client. Most security problems do not relate to this area.
-- Bart |
| |
| | | micah |  |
| Posted: Fri Aug 29, 2008 10:00 pm Post subject: Re: Cookie encryption? |  |
| |  | |
i think it'd be prudent to change your approach on this one, since you're running into a fundamental roadblock: you want to put secure info somewhere that's inherently insecure.
personally, i'd just write the data to the server and associate it with that user's account. if there isn't a logged-in user involved in this operation then... well... what sensitive information could/would you give to someone you haven't authenticated?
-micah
On Aug 29, 7:17 am, Walter Sobchak <genija...@yahoo.com> wrote:
| Quote: | The connection is ssl encrypted and I need to write some sensitive information in a cookie. I'd like to encrypt the cookie on the client so it could be decrypted later on the server.
1. If I use a symmetric algorithm how do I send the encryption key? 2. Is there any asymmetric algorithm that doesn't have an impact on performance? 3. Is there a difference in writing cookies with http an https? I think https in that case doesn't help.
Thanks in advance for any suggestions. |
|
| |
| | | Walter Sobchak |  |
| Posted: Sun Aug 31, 2008 12:03 am Post subject: Re: Cookie encryption? |  |
| |  | |
Bart Van der Donck wrote:
| Quote: | Walter Sobchak wrote:
The connection is ssl encrypted and I need to write some sensitive information in a cookie. I'd like to encrypt the cookie on the client so it could be decrypted later on the server.
I would usually not perform such a task at the client. The server could both encrypt the value and set the cookie via a HTTP-header (still better than document.cookie IMHO).
1. If I use a symmetric algorithm how do I send the encryption key?
If you would use javascript, there is no other choice than making the key/salt available as plaintext for the script in the web page; thus making it interceptable for the viewer of the page. I think there can be little doubt that a server-side solution would be better in this case.
2. Is there any asymmetric algorithm that doesn't have an impact on performance?
Encryption is memory-intensive by nature; but I wouldn't care much about only one en-/decrypt action. The difficuly for asymmetric cryptography is that there are both the private key (encrypt) and the public key (decrypt).
A somewhat safe strategy could be to make only the public key available to the client; so he can only decrypt the cookie with it. But I believe this would be the opposite of your plan: when you want to encrypt asymmetrically in javascript, you always need the private key.
But I think that symmetric cryptography is more recommended in your scenario (and preferably done at the server).
3. Is there a difference in writing cookies with http an https? I think https in that case doesn't help.
HTTPS secures the transmission of data along the line, but nothing more. You are only reasonably safe that nobody can intercept data between server and client. Most security problems do not relate to this area.
-- Bart
|
The thing is that I have the information on the client side. So I want to encrypt it and out it in a cookie. I know that should be done on the server side but I don't know how. Is there a way to call a server function from a client in a way that you send a parameter to that function and receive the result?? |
| |
| | | Walter Sobchak |  |
| Posted: Sun Aug 31, 2008 12:08 am Post subject: Re: Cookie encryption? |  |
| |  | |
It sounds like a good solution but the problem is that user enters some information on the client side and I need to have this information in a cookie because it is some kind of an authentication ticket.
micah wrote:
| Quote: | i think it'd be prudent to change your approach on this one, since you're running into a fundamental roadblock: you want to put secure info somewhere that's inherently insecure.
personally, i'd just write the data to the server and associate it with that user's account. if there isn't a logged-in user involved in this operation then... well... what sensitive information could/would you give to someone you haven't authenticated?
-micah
On Aug 29, 7:17 am, Walter Sobchak <genija...@yahoo.com> wrote: The connection is ssl encrypted and I need to write some sensitive information in a cookie. I'd like to encrypt the cookie on the client so it could be decrypted later on the server.
1. If I use a symmetric algorithm how do I send the encryption key? 2. Is there any asymmetric algorithm that doesn't have an impact on performance? 3. Is there a difference in writing cookies with http an https? I think https in that case doesn't help.
Thanks in advance for any suggestions.
|
|
| |
| | | Bart Van der Donck |  |
| Posted: Mon Sep 01, 2008 8:51 am Post subject: Re: Cookie encryption? |  |
| |  | |
Walter Sobchak wrote:
....
| Quote: | Walter Sobchak wrote: The connection is ssl encrypted and I need to write some sensitive information in a cookie. I'd like to encrypt the cookie on the client so it could be decrypted later on the server. ... The thing is that I have the information on the client side. So I want to encrypt it and out it in a cookie. I know that should be done on the server side but I don't know how.
|
I think the most classic design would be like this:
1. Put the information in an <input> (type=hidden?) 2. submit the form (manually?) as post-request over HTTPS to server 3. server encrypts it (+probably stores it?) 4. send next 'you-are-now-logged-in'-page with cookie in HTTP-header
The javascript way:
1. offer string+salt to the encryption alghoritm on the page LINK 2. use document.cookie() to store it LINK
| Quote: | Is there a way to call a server function from a client in a way that you send a parameter to that function and receive the result??
|
LINK
-- Bart |
| |
|
|