# # $Id: lonlocal.pm,v 1.2 2004/05/28 09:39:11 foxr Exp $ # # Copyright Michigan State University Board of Trustees # # This file is part of the LearningOnline Network with CAPA (LON-CAPA). # # LON-CAPA is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # LON-CAPA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with LON-CAPA; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # /home/httpd/html/adm/gpl.txt # # http://www.lon-capa.org/ # package lonlocal; # # Module that provides support for local connections between secure # lonc and secure lond. # # A local connection exchanges one-time session keys through a # file that is written in the certificate directory by lonc and # read/deleted by lond. The file is created with permissions # rw------- (0600) to prevent it from being snooped unless the system # itself has been broken. In addition the file will not be around # for very long so it will be hard to find. # use strict; # CPAN/standard modules use English; use Crypt::IDEA; # LONCAPA modules use LONCAPA::Configuration; # Global variables: my $perlvar; # Refers to the apache perlsetvar hash. # Initialization $perlvar = LONCAPA::Configuration::read_conf('loncapa.conf'); #------------------------------------------------------------------------ # # Name BuildKey # Description: Create an encryption key. # Returns: The key. # sub CreateCipherKey { my $keylength; my $binaryKey; my $cipherkey; # we'll use the output of /dev/random to produce our key. # On a system with decent entropy, this ought to be much more # random than all the playing that used to be done to get a key. # $keylength = IDEA::keysize(); open(RANDOM, "