Cover V08, I02
Article
Figure 1a
Figure 1b
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Listing 1
Listing 2
Listing 3
Listing 4
Listing 5

feb99.tar


Listing 4: Perl program for signing client certificate

#!/usr/local/bin/perl

$SECURITYPASSWD="Geheim";
$CAROOT="demoCA";

%certdata;

sub    passwderr {
    print <<EOM
Password error<BR>
EOM
;
}

foreach (@ARGV) {
    s/\n//g;
    my( $key, $value ) = split( /=/ );
    if( $key eq "passwd" ) {
        chop $value;
        $passwd = $value;
    }
    else {
        $certdata{$key} = $value;
    }
}

# Get the serial number
open SERIAL, $CAROOT . "/serial" or die "CA serial file error: $!\n";
$serial = <SERIAL>;
chomp $serial;
close SERIAL;

# Write the request file
open CERT, "> requests/request.$serial";
foreach $key (keys %certdata) {
    print CERT "$key=$certdata{$key}\n";
}
close CERT;

# Call the ca program to sign
open CA, "/usr/local/ssl/bin/ca -key $passwd -spkac \
requests/request.$serial -outdir certs - batch|" or die "CA: $!\n"; my @log = <CA>; close CA; # Present the certificate to the user so he or she can install it print <<EOM <html> <head> <title>Your personal Security Certificate has been generated</title> </head> <BODY TEXT="#FFFF00" BGCOLOR="#7F7F7F" LINK="#FFD700" \
VLINK="#FFD700" ALINK="#FF0000"> <hr size=5> <h1>Your personal Security Certificate has been generated</h1> <hr> <p> Click <a href="/userinstall.phtml?serial=$serial">here</a> to \
install your certificate. </p> <hr> <p> Click <a href="/test.phtml">here</a> to test your certificate. </p> <hr> </body> </html> EOM ; # End of File