[system] / trunk / webwork-modperl / lib / WeBWorK / Upload.pm Repository:
ViewVC logotype

View of /trunk/webwork-modperl/lib/WeBWorK/Upload.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 494 - (download) (as text) (annotate)
Wed Aug 21 18:31:20 2002 UTC (10 years, 9 months ago) by sh002i
File size: 1452 byte(s)
updated copyright header.
-sam

    1 ################################################################################
    2 # WeBWorK mod_perl (c) 2000-2002 WeBWorK Project
    3 # $Id$
    4 ################################################################################
    5 
    6 package WeBWorK::Upload;
    7 
    8 =head1 NAME
    9 
   10 WeBWorK::Upload - everything we need to be confident about an upload.
   11 
   12 =cut
   13 
   14 use Data::UUID;
   15 use MD5 qw();
   16 use WeBWorK::Constants qw(SECRET);
   17 
   18 # This package allows a file to be reliably cached on disk and replaced with
   19 # a string that universally and unforgeably represents that file, and then
   20 # retrieved later given that string.
   21 
   22 sub store_upload {}
   23 
   24 sub retrieve_upload {}
   25 
   26 sub new {
   27   unless (SECRET) {
   28     die "A secret has not been set in WeBWorK::Constants for this server.";
   29   }
   30   my $invocant = shift;
   31   my $class = ref($invocant) || invocant;
   32   my $self = {
   33     basedir => shift; # The directory into which to place the spool file
   34     uploadObject => shift;  # The Apache::Upload object to deal with
   35   };
   36 
   37   my $ug = Data::UUID->new;   # UUID Generator/Handler
   38   my $uuid = $ug->generate; # Unique identifier for this file, guaranteed to be unique until 3400AD
   39   my $uuid_as_string = $ug->to_string($uuid);
   40   my $mac = MD5->hexhash(SECRET . MD5->hexhash(SECRET . $uuid_as_string); # Message Authentication Check. As long as SECRET stays secret,
   41 
   42 
   43   $self->{
   44   $self->{MAC} = MD5->hexhash(SECRET . MD4->hexhash(SECRET . $self{UUID}->  # Message Authentication Check - An unforgeable checksum
   45   };
   46 }
   47 
   48 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9