我無法驗證是否有任何問題。你可以看看你的環境中可能會有什麼不同嗎?我在Windows 7 RC上運行。
讓我們檢查版本:
C:\temp>java -version
java version "1.5.0_14"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode, sharing)
讓我們看看會在我們的罐子:
C:\temp>dir /s /b com
C:\temp\com\rdc
C:\temp\com\rdc\test
C:\temp\com\rdc\test\logging.properties
讓我們的jar:
C:\temp>jar -cfv test-source.jar com/*
added manifest
adding: com/rdc/(in = 0) (out= 0)(stored 0%)
adding: com/rdc/test/(in = 0) (out= 0)(stored 0%)
adding: com/rdc/test/logging.properties(in = 13) (out= 15)(deflated -15%)
讓我們簽署的jar:我正在使用自簽名證書。
C:\temp>jarsigner -signedjar test-dest.jar test-source.jar vinay
Enter Passphrase for keystore:
Warning: The signer certificate will expire within six months.
讓我們來看看在我們的簽名的jar:
C:\temp>jar tvf test-dest.jar
155 Wed Jul 15 23:39:12 BST 2009 META-INF/MANIFEST.MF
276 Wed Jul 15 23:39:12 BST 2009 META-INF/VINAY.SF
1130 Wed Jul 15 23:39:12 BST 2009 META-INF/VINAY.DSA
0 Wed Jul 15 23:37:18 BST 2009 META-INF/
0 Wed Jul 15 19:44:44 BST 2009 com/rdc/
0 Wed Jul 15 19:44:58 BST 2009 com/rdc/test/
13 Wed Jul 15 23:37:10 BST 2009 com/rdc/test/logging.properties
OK,它肯定似乎已經簽署,且無類。讓我們來看看MANIFEST.MF
內容:
Manifest-Version: 1.0
Created-By: 1.5.0_14 (Sun Microsystems Inc.)
Name: com/rdc/test/logging.properties
SHA1-Digest: Ob/S+a7TLh+akYGEFIDugM12S88=
和VINAY.SF
內容:
Signature-Version: 1.0
Created-By: 1.5.0_14 (Sun Microsystems Inc.)
SHA1-Digest-Manifest-Main-Attributes: 4bEkze9MHmgfBoY+fnoS1V9bRPs=
SHA1-Digest-Manifest: YB8QKIAQPjEYh8PkuGA5G8pW3tw=
Name: com/rdc/test/logging.properties
SHA1-Digest: qXCyrUvUALII7SBNEq4R7G8lVQQ=
現在,讓我們驗證jar:
C:\temp>jarsigner -verify -verbose test-dest.jar
155 Wed Jul 15 23:51:34 BST 2009 META-INF/MANIFEST.MF
276 Wed Jul 15 23:51:34 BST 2009 META-INF/VINAY.SF
1131 Wed Jul 15 23:51:34 BST 2009 META-INF/VINAY.DSA
0 Wed Jul 15 23:37:18 BST 2009 META-INF/
0 Wed Jul 15 19:44:44 BST 2009 com/rdc/
0 Wed Jul 15 19:44:58 BST 2009 com/rdc/test/
smk 13 Wed Jul 15 23:37:10 BST 2009 com/rdc/test/logging.properties
s = signature was verified
m = entry is listed in manifest
k = at least one certificate was found in keystore
i = at least one certificate was found in identity scope
jar verified.
Warning: This jar contains entries whose signer certificate will expire within
six months. Re-run with the -verbose and -certs options for more details.
在它的面前,似乎一切按順序排列。你能檢查你的證書是否過期,或被撤銷嗎?您是否使用自簽名證書或真正的證書?或者我誤解了你的問題是什麼?
你能顯示你用來創建簽名的jar文件的命令嗎? – notnoop 2009-07-18 17:47:50