Details
-
Wish
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.1
-
None
-
all
-
Patch
Description
It would be great if the jarsigner plugin was able to sign all zip files, not only those which contain a META-INF folder and/or jar files as the jarsigner command line tool is not limited to "real" jar files. The META-INF folder is created anyway by the jarsigner tool.
My usecase is that I have some projects that create attached zip assemblies and I would like to sign them, too. I don't want to use e.g. an additional ant task attached to the verification phase, as the signing should be done automatically imho. And I don't want to use "external" signing tools like gpg as it requires a manual installation of that tool whereas the jarsigner is always present (in a JDK).
Simply replace the isJarFile method like that or similar:
private boolean isZipFile( final File file )
{
try
{
// NOTE: ZipFile.getEntry() might be shorter but is several factors slower on large files
ZipInputStream zis = new ZipInputStream( new FileInputStream( file ) );
try
finally
{ zis.close(); } }
catch ( Exception e )
return false;
}