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 5: Perl script for installing client certificate

#!/usr/local/bin/perl

%arguments;

foreach (@ARGV) {
    s/\n//g;
    my( $key, $value ) = split( /=/ );
    $arguments{$key} = $value;
}

$serial = $arguments{"serial"};
$cert = "certs/$serial.pem";
#$cert = "../../certs/$serial.pem";

open CERT, "<$cert" or die "certificate: $!\n";
@full = <CERT>;
close CERT;

$size = 0;
shift @full until( $full[0] =~ /-----BEGIN CERTIFICATE-----/ );
shift @full;
push @cert, shift @full until( ($size += (length( $cert[$#cert]) )) \
&& $full[0] =~ /-----END CERTIFICATE-----/ ); $size += length( "-----BEGIN CERTIFICATE-----\n" ); $size += length( "-----END CERTIFICATE-----\n" ); print "HTTP/1.0 200 \n"; print "Content-Type: application/x-x509-user-cert\n"; print "Content-Encoding: base64\n"; print "Content-Length: " . $size . "\n\n"; print "-----BEGIN CERTIFICATE-----\n"; foreach (@cert) { chomp; print"$_\n"; } print "-----END CERTIFICATE-----\n"; # End of File