From: Trastabuga
Subject: URL hiding (file download script) using Lisp
Date: 
Message-ID: <1162487220.273944.202250@i42g2000cwa.googlegroups.com>
Hi

I'd like to implement some kind of solution for downloadable goods when
you receive the payment from the client for some digital product (let's
say an image), so I'd like to generate a link to the image that would
be impossible to guess from outside. Once the user has downloaded from
the link, it would go away. It should be some kind of virtual link that
the Apache web server would know how to handle. I wonder if there were
any efforts to do it in Lisp? Any products anyone can recommend on
this?

Thank you,
Andrew

From: Victor Kryukov
Subject: Re: URL hiding (file download script) using Lisp
Date: 
Message-ID: <m2lkmtrc4e.fsf@victor-kryukovs-computer.local>
I'm not sure what do you mean by virtual link.

I think that the exact answer would depend on the (Lisp) web-server you're
going to use, and franlky, it's not that Lisp-related. The general
answer (regardless of what web-server of programming language)
would probably like this:

1. Generate some large unique string (e.g. md5sum of user account,
   image, date and time of the request and purchase order number), say
   2ff1364f6de3cb8ab468081a656d7fe0

2. Store the above number and it's image association in some database
   (assoc list, flat file) on the server.

3. Write url-hanler function for urls of type
   http://yoursite/download?id=XXX, which would check if XXX is in
   database, feed the associated image to the requestor and then
   remove XXX from database.

4. Send the download link
   http://yoursite/download?id=2ff1364f6de3cb8ab468081a656d7fe0 to the
   customer

For Lisp, there are several good web-servers; I tried AllegroServe and
it works perfect for me.

Regards,
Victor.
From: Trastabuga
Subject: Re: URL hiding (file download script) using Lisp
Date: 
Message-ID: <1162489442.516279.14810@i42g2000cwa.googlegroups.com>
Victor Kryukov wrote:
> I'm not sure what do you mean by virtual link.
>
> I think that the exact answer would depend on the (Lisp) web-server you're
> going to use, and franlky, it's not that Lisp-related. The general
> answer (regardless of what web-server of programming language)
> would probably like this:
>
> 1. Generate some large unique string (e.g. md5sum of user account,
>    image, date and time of the request and purchase order number), say
>    2ff1364f6de3cb8ab468081a656d7fe0
>
> 2. Store the above number and it's image association in some database
>    (assoc list, flat file) on the server.
>
> 3. Write url-hanler function for urls of type
>    http://yoursite/download?id=XXX, which would check if XXX is in
>    database, feed the associated image to the requestor and then
>    remove XXX from database.
>
> 4. Send the download link
>    http://yoursite/download?id=2ff1364f6de3cb8ab468081a656d7fe0 to the
>    customer
>
> For Lisp, there are several good web-servers; I tried AllegroServe and
> it works perfect for me.
>
> Regards,
> Victor.

Hi Victor

This is exactly what I am looking for. I don't know the exact term for
that kind of URL. I agree it's not Lisp related I just wanted to write
it in Lisp thought PHP may be more up to the task since it's easy to
create the CGI in PHP. I was thinking to use lisp_mod with Apache.
I was also wondering if there are some open source efforts to implement
the full package. Maybe there are only commercial products like PayPal
download manager.

Thanks,
Andrew
From: =?ISO-8859-15?Q?Andr=E9_Thieme?=
Subject: Re: URL hiding (file download script) using Lisp
Date: 
Message-ID: <eidds5$ocl$1@registered.motzarella.org>
Trastabuga schrieb:

> This is exactly what I am looking for. I don't know the exact term for
> that kind of URL. I agree it's not Lisp related I just wanted to write
> it in Lisp thought PHP may be more up to the task since it's easy to
> create the CGI in PHP. I was thinking to use lisp_mod with Apache.

You don't need to use Apache. AllegroServe is a webserver, written in Lisp.
You could use the PUBLISH methods to listen for urls that contain the
IDs for the image.


> I was also wondering if there are some open source efforts to implement
> the full package. Maybe there are only commercial products like PayPal
> download manager.

What full package? You are talking about 5-20 Lines of Lisp code to do
what you want...


Andr�
-- 
From: Trastabuga
Subject: Re: URL hiding (file download script) using Lisp
Date: 
Message-ID: <1162498321.521897.186990@e3g2000cwe.googlegroups.com>
André Thieme wrote:
> Trastabuga schrieb:
>
> > This is exactly what I am looking for. I don't know the exact term for
> > that kind of URL. I agree it's not Lisp related I just wanted to write
> > it in Lisp thought PHP may be more up to the task since it's easy to
> > create the CGI in PHP. I was thinking to use lisp_mod with Apache.
>
> You don't need to use Apache. AllegroServe is a webserver, written in Lisp.
> You could use the PUBLISH methods to listen for urls that contain the
> IDs for the image.
>
>
> > I was also wondering if there are some open source efforts to implement
> > the full package. Maybe there are only commercial products like PayPal
> > download manager.
>
> What full package? You are talking about 5-20 Lines of Lisp code to do
> what you want...
>
>
> André
> --

I was talking about full e-commerce package integrated with PayPal
(2Checkout you name it) credit card payment system. So that the whole
process of payment->send link or refund would be automated. You are
right it's a couple of lines just for the task of sending the link.

Thank you,
Andrew
From: Rob Warnock
Subject: Re: URL hiding (file download script) using Lisp
Date: 
Message-ID: <CPSdnUK7hMfeL9fYnZ2dnUVZ_qOdnZ2d@speakeasy.net>
Trastabuga <·········@gmail.com> wrote:
+---------------
| Victor Kryukov wrote:
| > I'm not sure what do you mean by virtual link.
...
| > 1. Generate some large unique string (e.g. md5sum of user account,
| >    image, date and time of the request and purchase order number), say
| >    2ff1364f6de3cb8ab468081a656d7fe0
...
| > 3. Write url-hanler function for urls of type
| >    http://yoursite/download?id=XXX, which would check if XXX is in
| >    database, feed the associated image to the requestor and then
...
| This is exactly what I am looking for. I don't know the exact term for
| that kind of URL.
+---------------

I call them "obfuscated URLs", and I use them (manually) all the time
for sending information to friends or (sometimes) business associates.
It's far easier than setting up a separate user name & password for
each occasion, and if all you're using is HTTP "Authentication Basic",
it's just as safe. Just be sure that in addition to whatever deterministic
information you hash in [such as Victor listed -- image, date and time,
etc.] that you also hash in at least, oh, 64 bits[1] of nonce [randomness,
different for *each* instance of a download, even if the content is
exactly the same -- /dev/urandom is often a good source, on a busy
server], and use all 128 bits of your MD5 hash. That helps avoid
replay attacks.


-Rob

[1] Normally I would say to use 128 bits of nonce, which would be
    safe from a birthday attack up to about 2^64 tries, but in this
    case you're going to invalidate the URL long before an attacker
    could make even 2^32 attempts, so a 64-bit nonce is probably fine.

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: John Thingstad
Subject: Re: URL hiding (file download script) using Lisp
Date: 
Message-ID: <op.tifq1giipqzri1@pandora.upc.no>
On Fri, 03 Nov 2006 04:06:43 +0100, Rob Warnock <····@rpw3.org> wrote:

> I call them "obfuscated URLs", and I use them (manually) all the time
> for sending information to friends or (sometimes) business associates.
> It's far easier than setting up a separate user name & password for
> each occasion, and if all you're using is HTTP "Authentication Basic",
> it's just as safe. Just be sure that in addition to whatever  
> deterministic
> information you hash in [such as Victor listed -- image, date and time,
> etc.] that you also hash in at least, oh, 64 bits[1] of nonce  
> [randomness,
> different for *each* instance of a download, even if the content is
> exactly the same -- /dev/urandom is often a good source, on a busy
> server], and use all 128 bits of your MD5 hash. That helps avoid
> replay attacks.

The one problem is that they are not very search engine friedly.
With Apache you can use the URL rewrite facillity to turn it into
a directory name. Thus avoiding the ?var=symbol.

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
From: Rob Warnock
Subject: Re: URL hiding (file download script) using Lisp
Date: 
Message-ID: <2PidnX-CUaiundHYnZ2dnUVZ_oCdnZ2d@speakeasy.net>
John Thingstad <··············@chello.no> wrote:
+---------------
| Rob Warnock <····@rpw3.org> wrote:
| > I call them "obfuscated URLs", and I use them (manually) all the time
| > for sending information to friends or (sometimes) business associates.
...
| The one problem is that they are not very search engine friedly.
+---------------

Uh... What part of "this is a private secret and I don't *WANT*
any ·@·····@ search engines to find it!" was not obvious?!?  ;-}

+---------------
| With Apache you can use the URL rewrite facillity to turn it into
| a directory name. Thus avoiding the ?var=symbol.
+---------------

Well, that's what another replier suggested. As for myself, I *do*
use static URLs, of the form "${recipient_name}.`random 16`", e.g.:

    http://dom.ain/.unpub/alice.KpZQsCbaj_i4V96I/
    http://dom.ain/.unpub/bob.6U3145MvqsfOw0uZ/
    http://dom.ain/.unpub/eve.l_v0TZDhN1V832Ys/
    http://dom.ain/.unpub/mallory.SoQLqlWOwUjSzgxR/

and make very, very sure that <http://dom.ain/.unpub/> has indexing
turned off [or has an explicit dummy index page] and that the the
full URL never shows up visibly on the public areas of the site.


-Rob

p.s. There's nothing magic about that format, except that my
"random" script makes sure to use only characters that are legal
in both URLs and filenames. The set [··········@] contains 64
elements, and is thus easy to map to from /dev/urandom output.

Also, having the obfuscated URLs start with the recipient name
makes it easier for *me* to remember which directory is which
and to navigate among them with shell file-completion.  ;-}  ;-}

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607