Class JarSignerUtil
java.lang.Object
org.apache.maven.shared.jarsigner.JarSignerUtil
-
Method Summary
Modifier and TypeMethodDescriptionprotected static ManifestbuildUnsignedManifest(Manifest manifest) Build a new manifest from the given one, removing any signing information inside it.static booleanisArchiveSigned(File jarFile) Scans an archive for existing signatures.protected static booleanisManifestFile(String entryName) protected static booleanisSignatureFile(String entryName) Checks whether the specified JAR file entry denotes a signature-related file, i.e.static booleanChecks whether the specified file is a JAR file.static voidunsignArchive(File jarFile) Removes any existing signatures from the specified JAR file.
-
Method Details
-
isZipFile
Checks whether the specified file is a JAR file. For our purposes, a ZIP file is a ZIP stream with at least one entry.- Parameters:
file- The file to check, must not benull.- Returns:
trueif the file looks like a ZIP file,falseotherwise.
-
unsignArchive
Removes any existing signatures from the specified JAR file. We will stream from the input JAR directly to the output JAR to retain as much metadata from the original JAR as possible.- Parameters:
jarFile- The JAR file to unsign, must not benull.- Throws:
IOException- when error occurs during processing the file
-
buildUnsignedManifest
Build a new manifest from the given one, removing any signing information inside it. This is done by removing any attributes containing some digest information. If an entry has then no more attributes, then it will not be written in the result manifest.- Parameters:
manifest- manifest to clean- Returns:
- the build manifest with no digest attributes
- Since:
- 1.3
-
isArchiveSigned
Scans an archive for existing signatures.- Parameters:
jarFile- The archive to scan, must not benull.- Returns:
true, if the archive contains at least one signature file;false, if the archive does not contain any signature files.- Throws:
IOException- if scanningjarFilefails.
-
isSignatureFile
Checks whether the specified JAR file entry denotes a signature-related file, i.e. matchesMETA-INF/*.SF,META-INF/*.DSA,META-INF/*.RSAorMETA-INF/*.EC.- Parameters:
entryName- The name of the JAR file entry to check, must not benull.- Returns:
trueif the entry is related to a signature,falseotherwise.
-
isManifestFile
-