diff options
author | Adam Domurad <[email protected]> | 2012-10-19 14:34:16 -0400 |
---|---|---|
committer | Adam Domurad <[email protected]> | 2012-10-19 14:34:16 -0400 |
commit | eca6b5289555031b31da4721800f5031c87bb309 (patch) | |
tree | 45378524fa07783879a1b21d90538b763538df8a | |
parent | e150560769232e18fa516609933649dab002f358 (diff) |
Use interface types in JCV classes where applicable
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | netx/net/sourceforge/jnlp/security/AppVerifier.java | 14 | ||||
-rw-r--r-- | netx/net/sourceforge/jnlp/security/JNLPAppVerifier.java | 13 | ||||
-rw-r--r-- | netx/net/sourceforge/jnlp/security/PluginAppVerifier.java | 25 | ||||
-rw-r--r-- | netx/net/sourceforge/jnlp/tools/JarCertVerifier.java | 14 |
5 files changed, 40 insertions, 33 deletions
@@ -35,6 +35,13 @@ * netx/net/sourceforge/jnlp/security/PluginAppVerifier.java: Same. * netx/net/sourceforge/jnlp/tools/JarCertVerifier.java: Same. +2012-10-19 Adam Domurad <[email protected]> + + * netx/net/sourceforge/jnlp/security/AppVerifier.java: Use interface + types for declared types where applicable. + * netx/net/sourceforge/jnlp/security/PluginAppVerifier.java: Same. + * netx/net/sourceforge/jnlp/tools/JarCertVerifier.java: Same. + 2012-10-19 Danesh Dadachanji <[email protected]> Rework JarCertVerifier certificate management to handle multiple diff --git a/netx/net/sourceforge/jnlp/security/AppVerifier.java b/netx/net/sourceforge/jnlp/security/AppVerifier.java index 2fc1ec0..95c608f 100644 --- a/netx/net/sourceforge/jnlp/security/AppVerifier.java +++ b/netx/net/sourceforge/jnlp/security/AppVerifier.java @@ -38,7 +38,7 @@ exception statement from your version. package net.sourceforge.jnlp.security; import java.security.cert.CertPath; -import java.util.HashMap; +import java.util.Map; import net.sourceforge.jnlp.JNLPFile; import net.sourceforge.jnlp.LaunchException; @@ -58,8 +58,8 @@ public interface AppVerifier { * @return True if the app trusts its publishers. */ public boolean hasAlreadyTrustedPublisher( - HashMap<CertPath, CertInformation> certs, - HashMap<String, Integer> signedJars); + Map<CertPath, CertInformation> certs, + Map<String, Integer> signedJars); /** * Checks if the app has signer(s) whose certs along their chains are in CA certs. @@ -68,8 +68,8 @@ public interface AppVerifier { * signed entries each one has. * @return True if the app has a root in the CA certs store. */ - public boolean hasRootInCacerts(HashMap<CertPath, CertInformation> certs, - HashMap<String, Integer> signedJars); + public boolean hasRootInCacerts(Map<CertPath, CertInformation> certs, + Map<String, Integer> signedJars); /** * Checks if the app's jars are covered by the provided certificates, enough @@ -79,8 +79,8 @@ public interface AppVerifier { * signed entries each one has. * @return */ - public boolean isFullySigned(HashMap<CertPath, CertInformation> certs, - HashMap<String, Integer> signedJars); + public boolean isFullySigned(Map<CertPath, CertInformation> certs, + Map<String, Integer> signedJars); /** * Prompt the user with requests for trusting the certificates used by this app diff --git a/netx/net/sourceforge/jnlp/security/JNLPAppVerifier.java b/netx/net/sourceforge/jnlp/security/JNLPAppVerifier.java index 9dcfaf5..cbc9db0 100644 --- a/netx/net/sourceforge/jnlp/security/JNLPAppVerifier.java +++ b/netx/net/sourceforge/jnlp/security/JNLPAppVerifier.java @@ -40,7 +40,6 @@ package net.sourceforge.jnlp.security; import static net.sourceforge.jnlp.runtime.Translator.R; import java.security.cert.CertPath; -import java.util.HashMap; import java.util.Map; import net.sourceforge.jnlp.JNLPFile; @@ -53,8 +52,8 @@ public class JNLPAppVerifier implements AppVerifier { @Override public boolean hasAlreadyTrustedPublisher( - HashMap<CertPath, CertInformation> certs, - HashMap<String, Integer> signedJars) { + Map<CertPath, CertInformation> certs, + Map<String, Integer> signedJars) { int sumOfSignableEntries = JarCertVerifier.getTotalJarEntries(signedJars); for (CertInformation certInfo : certs.values()) { Map<String, Integer> certSignedJars = certInfo.getSignedJars(); @@ -68,8 +67,8 @@ public class JNLPAppVerifier implements AppVerifier { } @Override - public boolean hasRootInCacerts(HashMap<CertPath, CertInformation> certs, - HashMap<String, Integer> signedJars) { + public boolean hasRootInCacerts(Map<CertPath, CertInformation> certs, + Map<String, Integer> signedJars) { int sumOfSignableEntries = JarCertVerifier.getTotalJarEntries(signedJars); for (CertInformation certInfo : certs.values()) { Map<String, Integer> certSignedJars = certInfo.getSignedJars(); @@ -83,8 +82,8 @@ public class JNLPAppVerifier implements AppVerifier { } @Override - public boolean isFullySigned(HashMap<CertPath, CertInformation> certs, - HashMap<String, Integer> signedJars) { + public boolean isFullySigned(Map<CertPath, CertInformation> certs, + Map<String, Integer> signedJars) { int sumOfSignableEntries = JarCertVerifier.getTotalJarEntries(signedJars); for (CertPath cPath : certs.keySet()) { // If this cert has signed everything, return true diff --git a/netx/net/sourceforge/jnlp/security/PluginAppVerifier.java b/netx/net/sourceforge/jnlp/security/PluginAppVerifier.java index a8589d8..f08b4b0 100644 --- a/netx/net/sourceforge/jnlp/security/PluginAppVerifier.java +++ b/netx/net/sourceforge/jnlp/security/PluginAppVerifier.java @@ -41,7 +41,8 @@ import static net.sourceforge.jnlp.runtime.Translator.R; import java.security.cert.CertPath; import java.util.ArrayList; -import java.util.HashMap; +import java.util.List; +import java.util.Map; import net.sourceforge.jnlp.JNLPFile; import net.sourceforge.jnlp.LaunchException; @@ -53,8 +54,8 @@ public class PluginAppVerifier implements AppVerifier { @Override public boolean hasAlreadyTrustedPublisher( - HashMap<CertPath, CertInformation> certs, - HashMap<String, Integer> signedJars) { + Map<CertPath, CertInformation> certs, + Map<String, Integer> signedJars) { boolean allPublishersTrusted = true; @@ -77,8 +78,8 @@ public class PluginAppVerifier implements AppVerifier { } @Override - public boolean hasRootInCacerts(HashMap<CertPath, CertInformation> certs, - HashMap<String, Integer> signedJars) { + public boolean hasRootInCacerts(Map<CertPath, CertInformation> certs, + Map<String, Integer> signedJars) { boolean allRootCAsTrusted = true; @@ -101,8 +102,8 @@ public class PluginAppVerifier implements AppVerifier { } @Override - public boolean isFullySigned(HashMap<CertPath, CertInformation> certs, - HashMap<String, Integer> signedJars) { + public boolean isFullySigned(Map<CertPath, CertInformation> certs, + Map<String, Integer> signedJars) { boolean isFullySigned = true; @@ -127,8 +128,8 @@ public class PluginAppVerifier implements AppVerifier { @Override public void checkTrustWithUser(JarCertVerifier jcv, JNLPFile file) throws LaunchException { - ArrayList<CertPath> certPaths = buildCertPathsList(jcv); - ArrayList<CertPath> alreadyApprovedByUser = new ArrayList<CertPath>(); + List<CertPath> certPaths = buildCertPathsList(jcv); + List<CertPath> alreadyApprovedByUser = new ArrayList<CertPath>(); for (String jarName : jcv.getJarSignableEntries().keySet()) { boolean trustFoundOrApproved = false; for (CertPath cPathApproved : alreadyApprovedByUser) { @@ -190,9 +191,9 @@ public class PluginAppVerifier implements AppVerifier { * 3. Roots in the CA store but have signing issues * 4. Everything else */ - public ArrayList<CertPath> buildCertPathsList(JarCertVerifier jcv) { - ArrayList<CertPath> certPathsList = jcv.getCertsList(); - ArrayList<CertPath> returnList = new ArrayList<CertPath>(); + public List<CertPath> buildCertPathsList(JarCertVerifier jcv) { + List<CertPath> certPathsList = jcv.getCertsList(); + List<CertPath> returnList = new ArrayList<CertPath>(); for (CertPath cPath : certPathsList) { if (!returnList.contains(cPath) diff --git a/netx/net/sourceforge/jnlp/tools/JarCertVerifier.java b/netx/net/sourceforge/jnlp/tools/JarCertVerifier.java index 01426f3..6b828c6 100644 --- a/netx/net/sourceforge/jnlp/tools/JarCertVerifier.java +++ b/netx/net/sourceforge/jnlp/tools/JarCertVerifier.java @@ -78,19 +78,19 @@ public class JarCertVerifier implements CertVerifier { } /** All of the jar files that were verified for signing */ - private ArrayList<String> verifiedJars = new ArrayList<String>(); + private List<String> verifiedJars = new ArrayList<String>(); /** All of the jar files that were not verified */ - private ArrayList<String> unverifiedJars = new ArrayList<String>(); + private List<String> unverifiedJars = new ArrayList<String>(); /** The certificates used for jar verification linked to their respective information */ - private HashMap<CertPath, CertInformation> certs = new HashMap<CertPath, CertInformation>(); + private Map<CertPath, CertInformation> certs = new HashMap<CertPath, CertInformation>(); /** Temporary cert path hack to be used to keep track of which one a UI dialog is using */ private CertPath currentlyUsed; /** Absolute location to jars and the number of entries which are possibly signable */ - private HashMap<String, Integer> jarSignableEntries = new HashMap<String, Integer>(); + private Map<String, Integer> jarSignableEntries = new HashMap<String, Integer>(); /** The application verifier to use by this instance */ private AppVerifier appVerifier; @@ -152,9 +152,9 @@ public class JarCertVerifier implements CertVerifier { /** * Get a list of the cert paths of all signers across the app. * - * @return ArrayList of CertPath vars representing each of the signers present on any jar. + * @return List of CertPath vars representing each of the signers present on any jar. */ - public ArrayList<CertPath> getCertsList() { + public List<CertPath> getCertsList() { return new ArrayList<CertPath>(certs.keySet()); } @@ -321,7 +321,7 @@ public class JarCertVerifier implements CertVerifier { VerifyResult verifyJarEntryCerts(String jarName, boolean jarHasManifest, Vector<JarEntry> entries) throws Exception { // Contains number of entries the cert with this CertPath has signed. - HashMap<CertPath, Integer> jarSignCount = new HashMap<CertPath, Integer>(); + Map<CertPath, Integer> jarSignCount = new HashMap<CertPath, Integer>(); int numSignableEntriesInJar = 0; // Record current time just before checking the jar begins. |