org.codehaus.mojo.webstart.sign
Class DefaultSignTool

java.lang.Object
  extended by org.codehaus.plexus.logging.AbstractLogEnabled
      extended by org.codehaus.mojo.webstart.sign.DefaultSignTool
All Implemented Interfaces:
SignTool, org.codehaus.plexus.logging.LogEnabled

public class DefaultSignTool
extends org.codehaus.plexus.logging.AbstractLogEnabled
implements SignTool

Default implementation of the SignTool.

Since:
1.0-beta-3
Author:
tchemit
Plexus component:
role-hint:
"default"

Field Summary
 
Fields inherited from interface org.codehaus.mojo.webstart.sign.SignTool
ROLE
 
Constructor Summary
DefaultSignTool()
           
 
Method Summary
 void deleteKeyStore(File keystore, boolean verbose)
          Delete an existing key store
 void generateKey(SignConfig config, File keystoreFile)
          Generate a key store using keytool.
 boolean isJarSigned(SignConfig config, File jarFile)
          Tests if the given jar is signed.
 void sign(SignConfig config, File jarFile, File signedJar)
          Sign a jar using jarsigner.
 void unsign(File jarFile, File tempDirectory, boolean verbose)
          Unsign a jar.
protected  void verboseLog(boolean verbose, String msg)
          Log as info when verbose or info is enabled, as debug otherwise.
 void verify(SignConfig config, File jarFile, boolean certs)
          Verify a jar file using jarsigner.
 
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSignTool

public DefaultSignTool()
Method Detail

generateKey

public void generateKey(SignConfig config,
                        File keystoreFile)
                 throws org.apache.maven.plugin.MojoExecutionException
Description copied from interface: SignTool
Generate a key store using keytool.

Specified by:
generateKey in interface SignTool
Parameters:
config - sign configuration
keystoreFile - location of the keystore to generate
Throws:
org.apache.maven.plugin.MojoExecutionException - if something wrong occurs

sign

public void sign(SignConfig config,
                 File jarFile,
                 File signedJar)
          throws org.apache.maven.plugin.MojoExecutionException
Description copied from interface: SignTool
Sign a jar using jarsigner.

Specified by:
sign in interface SignTool
Parameters:
config - sign configuration
jarFile - location of the jar to sign
signedJar - optional location of the signed jar to produce (if not set, will use the original location)
Throws:
org.apache.maven.plugin.MojoExecutionException - if something wrong occurs

verify

public void verify(SignConfig config,
                   File jarFile,
                   boolean certs)
            throws org.apache.maven.plugin.MojoExecutionException
Description copied from interface: SignTool
Verify a jar file using jarsigner.

Specified by:
verify in interface SignTool
Parameters:
config - sign configuration
jarFile - location of the jar to sign
certs - flag to show certificats details
Throws:
org.apache.maven.plugin.MojoExecutionException - if something wrong occurs

isJarSigned

public boolean isJarSigned(SignConfig config,
                           File jarFile)
                    throws org.apache.maven.plugin.MojoExecutionException
Description copied from interface: SignTool
Tests if the given jar is signed.

Specified by:
isJarSigned in interface SignTool
Parameters:
config - sign configuration
jarFile - the jar file to test
Returns:
true if jar file is signed, false otherwise
Throws:
org.apache.maven.plugin.MojoExecutionException - if something wrong occurs

unsign

public void unsign(File jarFile,
                   File tempDirectory,
                   boolean verbose)
            throws org.apache.maven.plugin.MojoExecutionException
Description copied from interface: SignTool
Unsign a jar.

Specified by:
unsign in interface SignTool
Parameters:
jarFile - location of the jar to unsign
tempDirectory - temp directory where to unzip the jar
verbose - flag to display verbose logs
Throws:
org.apache.maven.plugin.MojoExecutionException - if something wrong occurs

deleteKeyStore

public void deleteKeyStore(File keystore,
                           boolean verbose)
Description copied from interface: SignTool
Delete an existing key store

Specified by:
deleteKeyStore in interface SignTool
Parameters:
keystore - the keystore to delete
verbose - flag to display verbose logs

verboseLog

protected void verboseLog(boolean verbose,
                          String msg)
Log as info when verbose or info is enabled, as debug otherwise.

Parameters:
verbose - verbose level
msg - message to log


Copyright © 2005-2012 Codehaus. All Rights Reserved.