Repository navigation
Verify signed JAR files. - #633
Conversation
| private static final String SIGNATURE_VERSION = "1.0"; | ||
|
|
||
| // Manifest location in JAR file | ||
| private static final String MANIFEST_LOCATION = "META-INF/MANIFEST.MF"; |
There was a problem hiding this comment.
This constant is duplicate of JarFile.MANIFEST_NAME.
| return; | ||
| } | ||
|
|
||
| KeyStore caCertificates = getCaCertificates(); |
There was a problem hiding this comment.
Moved this block to the super class since it's code that VerifyJarAction needs to have.
|
|
||
| return signatureFile; | ||
| } | ||
|
|
There was a problem hiding this comment.
This block of code was moved to the super class.
| jdnIssuer.setEnabled(false); | ||
| jbTimeStamp.setEnabled(false); | ||
| jbSignerAsn1.setEnabled(false); | ||
| jbCertificates.setEnabled(false); |
There was a problem hiding this comment.
Previously, the CMSSignedData object was not linked to the selected item so these buttons could always be enabled, but now that the object is linked to the selected item need to disable/enable based on the selection.
| } | ||
| }; | ||
| } | ||
| } |
There was a problem hiding this comment.
Creating a JTable extension is the Java Swing Tutorial method of adding tooltips to column headers. I'm considering doing a full refactoring of KSE to follow this model. I'd move this inner class to a new org.kse.gui.tables package and use it as the super class for JKseTable or just bring this code directly into JKseTable.
kaikramer
left a comment
There was a problem hiding this comment.
Excellent work! Thank you very much.
I'll take care of the icon.
| trustedCerts.addAll(extractCertificates(keyStore)); | ||
|
|
||
| if (caCertificates != null) | ||
| { |
There was a problem hiding this comment.
Please try to keep the code formatting consistent. There are several other occurrences of this in this PR.
There was a problem hiding this comment.
Sorry about that. I'll find them all and fix them.
| importTrustedCertificateAction.setEnabled(false); | ||
| importKeyPairAction.setEnabled(false); | ||
| verifySignatureAction.setEnabled(false); | ||
| verifyJarAction.setEnabled(false); |
There was a problem hiding this comment.
Maybe I am missing something but there is no reason to not allow the 2 verify actions when no keystore is open, right?
There was a problem hiding this comment.
As currently coded up, the verify actions will throw a NullPointerException when looking up the trusted certs, but I can change them to automatically use the cacerts if a key store is not loaded.
Closes #439 by adding a menu item and toolbar button for verifying a signed JAR file.
Action items: Need a new icon for the Verify JAR File Signature action
New Tools menu item

New toolbar button

Handles unsigned JARs:

Displays the same message as jarsigner when JAR verification fails:

Displays a table similar to the verbose jarsigner output for a verified jar:

Entry certificates can be viewed by double clicking on the entry or clicking the Certificates button (uses DViewCertificate). This is the KSE method of displaying the entry certs (jarsigner -verify -verbose -certs) The signers of the JAR can be viewed by clicking the Signatures button (uses DViewSignature). This is the KSE method of display the signers and time stamp information.
This action works just like jarsigner in that only Certificate entries in a KeyStore are used for establishing trust. Any KeyPair entries will be ignored. This is unlike the Verify Signature action which will consider KeyPair entries, too.
Other changes: