From 1456bcea61c37449864274811659ea6f11b96c60 Mon Sep 17 00:00:00 2001 From: weijun Date: Thu, 18 Jun 2009 11:12:13 +0800 Subject: [PATCH] 6712755: jarsigner fails to sign itextasian.jar since 1.5.0_b14, it works with 1.5.0_13 Reviewed-by: mullan --- .../classes/sun/security/tools/JarSigner.java | 7 +- .../security/tools/jarsigner/emptymanifest.sh | 66 +++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 test/sun/security/tools/jarsigner/emptymanifest.sh diff --git a/src/share/classes/sun/security/tools/JarSigner.java b/src/share/classes/sun/security/tools/JarSigner.java index 2de2e52b0..e7ca8bc75 100644 --- a/src/share/classes/sun/security/tools/JarSigner.java +++ b/src/share/classes/sun/security/tools/JarSigner.java @@ -1402,9 +1402,14 @@ public class JarSigner { } /** - * Find the position of \r\n\r\n inside bs + * Find the position of an empty line inside bs */ private int findHeaderEnd(byte[] bs) { + // An empty line can be at the beginning... + if (bs.length > 1 && bs[0] == '\r' && bs[1] == '\n') { + return 0; + } + // ... or after another line for (int i=0; i A +echo B > B +mkdir META-INF +printf "\r\n" > META-INF${FS}MANIFEST.MF +zip $JFILE META-INF${FS}MANIFEST.MF A B + +$KT -alias a -dname CN=a -keyalg rsa -genkey -validity 300 + +$JARSIGNER -keystore $KS -storepass changeit $JFILE a || exit 1 +$JARSIGNER -keystore $KS -verify -debug -strict $JFILE || exit 2 + +exit 0 -- GitLab