Class ASJarSigner
- java.lang.Object
-
- org.glassfish.appclient.server.core.jws.servedcontent.ASJarSigner
-
- All Implemented Interfaces:
org.glassfish.hk2.api.PostConstruct
@Service @Singleton public class ASJarSigner extends Object implements org.glassfish.hk2.api.PostConstruct
Signs a specified JAR file.This implementation searches the available keystores for the signing alias indicated in the domain.xml config or, if not specified, the default alias, the first time it is invoked to sign a JAR file. After the first requested signing it uses the same alias and provider to sign all JARs.
The public interface to this class is the static signJar method.
- Author:
- tjquinn
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ASJarSigner.ASJarSignerException
Wraps any underlying exception.
-
Field Summary
Fields Modifier and Type Field Description static String
USER_SPECIFIED_ALIAS_PROPERTYNAME
property name optionally set by the admin in domain.xml to select an alias for signing
-
Constructor Summary
Constructors Constructor Description ASJarSigner()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
postConstruct()
long
signJar(File unsignedJar, File signedJar, String alias, Attributes attrs)
Creates a signed jar from the specified unsigned jar.long
signJar(File unsignedJar, ZipOutputStream signedJar, String alias, Attributes attrs, Map<String,byte[]> additionalContent)
Creates a signed ZIP output stream from an unsigned JAR and, possibly, additional content.
-
-
-
Field Detail
-
USER_SPECIFIED_ALIAS_PROPERTYNAME
public static final String USER_SPECIFIED_ALIAS_PROPERTYNAME
property name optionally set by the admin in domain.xml to select an alias for signing- See Also:
- Constant Field Values
-
-
Method Detail
-
postConstruct
public void postConstruct()
- Specified by:
postConstruct
in interfaceorg.glassfish.hk2.api.PostConstruct
-
signJar
public long signJar(File unsignedJar, File signedJar, String alias, Attributes attrs) throws Exception
Creates a signed jar from the specified unsigned jar.- Parameters:
unsignedJar
- the unsigned JAR filesignedJar
- the signed JAR to be createdattrs
- additional attributes to be added to the JAR's manifest main section- Returns:
- the elapsed time to sign the JAR (in milliseconds)
- Throws:
Exception
- getting the keystores from SSLUtils fails
-
signJar
public long signJar(File unsignedJar, ZipOutputStream signedJar, String alias, Attributes attrs, Map<String,byte[]> additionalContent) throws Exception
Creates a signed ZIP output stream from an unsigned JAR and, possibly, additional content.- Parameters:
unsignedJar
- JAR file containing most of the content to sign and returnsignedJar
- already-opened ZipOutputStream to receive the signed contentalias
- the alias with which to identify the cert for signing the outputattrs
- additional manifest attributes to addadditionalContent
- additional JAR entries to add- Returns:
- Throws:
Exception
-
-