You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2026/08/22 12:38:51 UTC

(maven-jarsigner) branch fix/isSignatureFile-PKCS7 created (now aea73f4)

This is an automated email from the ASF dual-hosted git repository.

elharo pushed a change to branch fix/isSignatureFile-PKCS7
in repository https://gitbox.apache.org/repos/asf/maven-jarsigner.git


      at aea73f4  Detect PKCS#7 signature files in isSignatureFile() (#101)

This branch includes the following new commits:

     new aea73f4  Detect PKCS#7 signature files in isSignatureFile() (#101)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(maven-jarsigner) 01/01: Detect PKCS#7 signature files in isSignatureFile() (#101)

Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch fix/isSignatureFile-PKCS7
in repository https://gitbox.apache.org/repos/asf/maven-jarsigner.git

commit aea73f4b3c725369dcfcd4decbcfcbad2b556c81
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Sat Aug 22 12:38:43 2026 +0000

    Detect PKCS#7 signature files in isSignatureFile() (#101)
---
 .../java/org/apache/maven/shared/jarsigner/JarSignerUtil.java     | 8 +++++---
 .../java/org/apache/maven/shared/jarsigner/JarSignerUtilTest.java | 6 ++++++
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/maven/shared/jarsigner/JarSignerUtil.java b/src/main/java/org/apache/maven/shared/jarsigner/JarSignerUtil.java
index ff45cc6..e39635a 100644
--- a/src/main/java/org/apache/maven/shared/jarsigner/JarSignerUtil.java
+++ b/src/main/java/org/apache/maven/shared/jarsigner/JarSignerUtil.java
@@ -173,8 +173,8 @@ public class JarSignerUtil {
 
     /**
      * Checks whether the specified JAR file entry denotes a signature-related file, i.e. matches
-     * <code>META-INF/*.SF</code>, <code>META-INF/*.DSA</code>, <code>META-INF/*.RSA</code> or
-     * <code>META-INF/*.EC</code>.
+     * <code>META-INF/*.SF</code>, <code>META-INF/*.DSA</code>, <code>META-INF/*.RSA</code>,
+     * <code>META-INF/*.EC</code>, <code>META-INF/*.PKCS7</code> or <code>META-INF/*.p7s</code>.
      *
      * @param entryName The name of the JAR file entry to check, must not be <code>null</code>.
      * @return <code>true</code> if the entry is related to a signature, <code>false</code> otherwise.
@@ -187,7 +187,9 @@ public class JarSignerUtil {
                 return endsWithIgnoreCase(entryName, ".SF")
                         || endsWithIgnoreCase(entryName, ".DSA")
                         || endsWithIgnoreCase(entryName, ".RSA")
-                        || endsWithIgnoreCase(entryName, ".EC");
+                        || endsWithIgnoreCase(entryName, ".EC")
+                        || endsWithIgnoreCase(entryName, ".PKCS7")
+                        || endsWithIgnoreCase(entryName, ".p7s");
             }
         }
         return false;
diff --git a/src/test/java/org/apache/maven/shared/jarsigner/JarSignerUtilTest.java b/src/test/java/org/apache/maven/shared/jarsigner/JarSignerUtilTest.java
index 017440a..a984576 100644
--- a/src/test/java/org/apache/maven/shared/jarsigner/JarSignerUtilTest.java
+++ b/src/test/java/org/apache/maven/shared/jarsigner/JarSignerUtilTest.java
@@ -150,6 +150,12 @@ class JarSignerUtilTest extends AbstractJarSignerTest {
         assertEquals(0, leftover.length, "no .unsigned files should remain after concurrent unsign");
     }
 
+    @Test
+    void isSignatureFileDetectsPKCS7() {
+        assertTrue(JarSignerUtil.isSignatureFile("META-INF/CERT.PKCS7"));
+        assertTrue(JarSignerUtil.isSignatureFile("META-INF/cert.p7s"));
+    }
+
     private Manifest readManifest(File file) throws IOException {
         JarFile jarFile = new JarFile(file);