Jar::Signer - Ease the process of creating a signed Jar file.
# using FindBin is just a suggestion.
use FindBin qw( $RealBin );
my $signer = Jar::Signer->new;
# location of the keystore, created if needed.
# dname properties of the certificate.
$signer->dname("CN=Mark Southern, O=My Corporation, L=My State, C=USA");
# name for .fingerprint and ..cert files, created if needed.
# the Jar file that we want to sign.
# if signed_jar is undefined then the default is basename.signed.jar where basename is the basename of the Jar file.
# create the signed Jar.
This module, and the script that uses it make it a lot simpler to generate signed Jar files for use in Java applets etc. It steps through all the needed jar, jarsigner and keytool command lines.
Sets/returns the name of the jar file to sign
Sets/returns the name of the signed Jar file to create. if this is undefined then the default is basename.signed.jar where basename is the basename of the Jar file.
Sets/returns the name of the key store to use.
Sets/returns the base name for the .cert and .fingerprint files to use
The method that scripts everything together. You do not need to call any of the methods below as 'process' does this for you.
First the existance of the Jar file and the Keystore, certificate and fingerprint files are checked for with the latter three being created as needed. Then the policy file is checked for and added to the Jar. The jar is then signed.
Adds the policy file to the Jar. Normally you do not need to call this. It is scripted by the 'process' method.
Generates the signed Jar file. Normally you do not need to call this. It is scripted by the 'process' method.
Generates a .fingerprint file. Normally you do not need to call this. It is scripted by the 'process' method.
Generates a .cert file. Normally you do not need to call this. It is scripted by the 'process' method. generate_keystore
Please report them!
You are still required to type in a password where required. It would be nice if this were set up as a property too.
The jarsigner.pl script could do with a lot of beefing up.
Mark Southern (firstname.lastname@example.org)
Copyright (c) 2003, ExSAR Corporation. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the terms of the Perl Artistic License (see http://www.perl.com/perl/misc/Artistic.html)