diff -NurpP tinyca-0.6.7.orig/lib/GUI.pm tinyca-0.6.7/lib/GUI.pm --- tinyca-0.6.7.orig/lib/GUI.pm 2004-12-07 12:14:18 +0400 +++ tinyca-0.6.7/lib/GUI.pm 2005-04-03 21:21:19 +0500 @@ -1241,7 +1241,7 @@ sub show_req_dialog { my ($self, $opts) = @_; my ($box, $button_ok, $button_cancel, $reqtable, $radiobox, $key1, $key2, - $key3, $key4, $key5, $entry, $label); + $key3, $key4, $key5, $key6, $entry, $label); $button_ok = Gnome::Stock->button('Button_Ok'); $button_ok->signal_connect('clicked', @@ -1360,6 +1360,13 @@ sub show_req_dialog { \$opts->{'digest'}, 'md4'); $radiobox->add($key5); + $key6 = Gtk::RadioButton->new('No Des', $key1); + $key6->set_active(1) + if(defined($opts->{'digest'}) && $opts->{'digest'} eq 'nodes'); + $key6->signal_connect('toggled', \&GUI::CALLBACK::toggle_to_var, + \$opts->{'digest'}, 'nodes'); + $radiobox->add($key6); + $reqtable->attach_defaults($radiobox, 1, 2, 15, 16); $label = GUI::HELPERS::create_label(gettext("Algorithm").":", 'left', 0, 0); diff -NurpP tinyca-0.6.7.orig/lib/OpenSSL.pm tinyca-0.6.7/lib/OpenSSL.pm --- tinyca-0.6.7.orig/lib/OpenSSL.pm 2004-12-07 12:14:18 +0400 +++ tinyca-0.6.7/lib/OpenSSL.pm 2005-04-03 23:56:06 +0500 @@ -81,12 +81,15 @@ sub newkey { return($ret, $ext) if($ret); $cmd = "$self->{'bin'} gendsa"; + $cmd .= " -des3"; $cmd .= " -passout env:SSLPASS"; + $cmd .= " -out \"$opts->{'outfile'}\""; $cmd .= " $param"; } else { $cmd = "$self->{'bin'} genrsa"; + $cmd .= " -des3"; $cmd .= " -passout env:SSLPASS"; @@ -96,6 +99,7 @@ sub newkey { } $ENV{'SSLPASS'} = $opts->{'pass'}; + my($rdfh, $wtfh); $ext = "$cmd\n\n"; $pid = open3($wtfh, $rdfh, $rdfh, $cmd); @@ -120,6 +124,7 @@ sub newkey { delete($ENV{'SSLPASS'}); + return($ret, $ext); } @@ -290,19 +295,33 @@ sub newreq { my $self = shift; my $opts = { @_ }; - my ($ext, $ret, $cmd, $pid); + my ($ext, $ret, $cmd, $pid, $t, $bar, $box, $i, $c); $cmd = "$self->{'bin'} req -new"; $cmd .= " -keyform PEM"; $cmd .= " -outform PEM"; - $cmd .= " -passin env:SSLPASS"; + + $cmd .= " -passin env:SSLPASS" + if ( $opts->{'digest'} ne "nodes"); $cmd .= " -config $opts->{'config'}"; $cmd .= " -out $opts->{'outfile'}"; - $cmd .= " -key $opts->{'keyfile'}"; + + if ( $opts->{'digest'} ne "nodes") + { + $cmd .= " -key $opts->{'keyfile'}"; + } + else + { + $cmd .= " -keyout $opts->{'keyfile'}"; + } + + $cmd .= " -"."$opts->{'digest'}"; - $ENV{'SSLPASS'} = $opts->{'pass'}; + $ENV{'SSLPASS'} = $opts->{'pass'} + if ( $opts->{'digest'} ne "nodes"); + # print "DEBUG call: $cmd\n"; my($rdfh, $wtfh); @@ -318,13 +337,23 @@ sub newreq { } } - while(<$rdfh>) { - $ext .= $_; + $t = gettext("Creating key and req in progress..."); + ($box, $bar) = GUI::HELPERS::create_activity_bar($t); + $i = 0; + while(defined($c = getc($rdfh))) { + $ext .= $c; + $bar->update(($i++%100)/100); + while(Gtk->events_pending) { + Gtk->main_iteration; + } } + $box->destroy(); + waitpid($pid, 0); $ret = $? >> 8; - delete($ENV{'SSLPASS'}); + delete($ENV{'SSLPASS'}) + if ( $opts->{'digest'} ne "nodes"); return($ret, $ext); } diff -NurpP tinyca-0.6.7.orig/lib/REQ.pm tinyca-0.6.7/lib/REQ.pm --- tinyca-0.6.7.orig/lib/REQ.pm 2004-12-07 12:14:18 +0400 +++ tinyca-0.6.7/lib/REQ.pm 2005-04-03 23:49:03 +0500 @@ -46,6 +46,7 @@ sub get_req_create { $ca = $main->{'CA'}->{'actca'}; + if(!(defined($opts)) || !(ref($opts))) { if(defined($opts) && $opts eq "signserver") { $opts = {}; @@ -94,8 +95,12 @@ sub get_req_create { if((not defined($opts->{'CN'})) || ($opts->{'CN'} eq "") || - (not defined($opts->{'passwd'})) || - ($opts->{'passwd'} eq "")) { + ( + ((not defined($opts->{'passwd'})) || + ($opts->{'passwd'} eq "")) && + $opts->{'digest'} ne "nodes" + ) + ) { $main->show_req_dialog($opts); GUI::HELPERS::print_warning( gettext("Please specify at least Common Name ") @@ -103,8 +108,14 @@ sub get_req_create { return; } - if((not defined($opts->{'passwd2'})) || - $opts->{'passwd'} ne $opts->{'passwd2'}) { + if( + ( + (not defined($opts->{'passwd2'})) || + $opts->{'passwd'} ne $opts->{'passwd2'} + ) + && ($opts->{'digest'} ne "nodes") + ) + { $main->show_req_dialog($opts); GUI::HELPERS::print_warning(gettext("Passwords don't match")); return; @@ -153,18 +164,21 @@ sub create_req { $reqfile = $cadir."/req/".$opts->{'reqname'}.".pem"; $keyfile = $cadir."/keys/".$opts->{'reqname'}.".pem"; - ($ret, $ext) = $self->{'OpenSSL'}->newkey( - 'algo' => $opts->{'algo'}, - 'bits' => $opts->{'bits'}, - 'outfile' => $keyfile, - 'pass' => $opts->{'passwd'} - ); - - if (not -s $keyfile || $ret) { - unlink($keyfile); - GUI::HELPERS::set_cursor($main, 0); - GUI::HELPERS::print_warning(gettext("Generating key failed"), $ext); - return; + if ( defined($opts->{'passwd'}) && "$opts->{'passwd'}" ne "" ) + { + ($ret, $ext) = $self->{'OpenSSL'}->newkey( + 'algo' => $opts->{'algo'}, + 'bits' => $opts->{'bits'}, + 'outfile' => $keyfile, + 'pass' => $opts->{'passwd'} + ); + + if (not -s $keyfile || $ret) { + unlink($keyfile); + GUI::HELPERS::set_cursor($main, 0); + GUI::HELPERS::print_warning(gettext("Generating key failed"), $ext); + return; + } } ($ret, $ext) = $self->{'OpenSSL'}->newreq(