public class JarSignerUtil
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
private |
JarSignerUtil() |
Modifier and Type | Method and Description |
---|---|
protected static java.util.jar.Manifest |
buildUnsignedManifest(java.util.jar.Manifest manifest)
Build a new manifest from the given one, removing any signing information inside it.
|
private static boolean |
endsWithIgnoreCase(java.lang.String str,
java.lang.String searchStr) |
static boolean |
isArchiveSigned(java.io.File jarFile)
Scans an archive for existing signatures.
|
protected static boolean |
isManifestFile(java.lang.String entryName) |
protected static boolean |
isSignatureFile(java.lang.String entryName)
Checks whether the specified JAR file entry denotes a signature-related file, i.e.
|
static boolean |
isZipFile(java.io.File file)
Checks whether the specified file is a JAR file.
|
static void |
unsignArchive(java.io.File jarFile)
Removes any existing signatures from the specified JAR file.
|
public static boolean isZipFile(java.io.File file)
file
- The file to check, must not be null
.true
if the file looks like a ZIP file, false
otherwise.public static void unsignArchive(java.io.File jarFile) throws java.io.IOException
jarFile
- The JAR file to unsign, must not be null
.java.io.IOException
protected static java.util.jar.Manifest buildUnsignedManifest(java.util.jar.Manifest manifest)
manifest
- manifest to cleanpublic static boolean isArchiveSigned(java.io.File jarFile) throws java.io.IOException
jarFile
- The archive to scan, must not be null
.true
, if the archive contains at least one signature file; false
, if the archive
does not contain any signature files.java.io.IOException
- if scanning jarFile
fails.protected static boolean isSignatureFile(java.lang.String entryName)
META-INF/*.SF
, META-INF/*.DSA
, META-INF/*.RSA
or
META-INF/*.EC
.entryName
- The name of the JAR file entry to check, must not be null
.true
if the entry is related to a signature, false
otherwise.protected static boolean isManifestFile(java.lang.String entryName)
private static boolean endsWithIgnoreCase(java.lang.String str, java.lang.String searchStr)