#!/usr/bin/perl
#
# $Id: tinyca,v 1.6 2003/06/23 21:28:36 sm Exp $
#
# Copyright (c) Stephan Martin <sm@sm-zone.net>
#
# This program 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.
# 
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.

BEGIN { push(@INC, './lib'); } # put here the location of the modules

use strict;

use Tk;
use Tk::widgets qw(Frame Button Label NoteBook HList ItemStyle Scrollbar 
                   Menubutton Toplevel DialogBox Listbox Entry Radiobutton);
use MIME::Base64;
use Time::Local;

use POSIX;
use Locale::gettext;

use OpenSSL;
use CA;
use GUI;
use CERT;
use REQ;
use KEY;
use TCONFIG;

my $init = {};

# location of openssl
$init->{'opensslbin'} = "/usr/bin/openssl";

if(not -x $init->{'opensslbin'}) {
   print gettext("Can't execute"), " $init->{'opensslbin'}\n";
   print gettext("Configure correct Path to openssl in tinyca"), "\n";
   exit(1);
}

# directory with the templates
$init->{'templatedir'} = "./templates";

if(not -d $init->{'templatedir'}) {
   print gettext("Can't find templatedir:"), "$init->{'templatedir'}\n";
   print gettext("Please configure"), "\$init->{'templatedir'}\n";
   exit(1);
}

# location for CA files
$init->{'basedir'} = $ENV{HOME}."/.TinyCA";

umask(0077);

# create main object and initialize CA
my $gui = GUI->new($init);

# and now run...
MainLoop();

exit(0);

