Package net.sourceforge.jnlp.tools
Class JarCertVerifier
java.lang.Object
net.sourceforge.jnlp.tools.JarCertVerifier
- All Implemented Interfaces:
CertVerifier
The jar certificate verifier utility.
-
Constructor Summary
ConstructorsConstructorDescriptionJarCertVerifier
(AppVerifier verifier) Create a new jar certificate verifier utility that uses the provided verifier for its strategy pattern. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(List<JARDesc> jars, ResourceTracker tracker) Update the verifier to consider new jars when verifying.boolean
Returns if all jars are signed.void
checkTrustWithUser
(JNLPClassLoader.SecurityDelegate securityDelegate, JNLPFile file) boolean
getCertInformation
(CertPath cPath) Find the information the specified cert path has with respect to this application.getCertPath
(CertPath cPath) Get a list of the cert paths of all signers across the app.getDetails
(CertPath certPath) getPublisher
(CertPath cPath) boolean
static int
getTotalJarEntries
(Map<String, Integer> map) Get the total number of entries in the provided map.boolean
hasSigningIssues
(CertPath certPath) boolean
Returns whether or not the app is considered completely signed.static boolean
isJarSigned
(JARDesc jar, AppVerifier verifier, ResourceTracker tracker) boolean
void
setCurrentlyUsedCertPath
(CertPath cPath)
-
Constructor Details
-
JarCertVerifier
Create a new jar certificate verifier utility that uses the provided verifier for its strategy pattern.- Parameters:
verifier
- The application verifier to be used by the new instance.
-
-
Method Details
-
isTriviallySigned
public boolean isTriviallySigned()- Returns:
- true if there are no signable entries in the jar. This will return false if any of verified jars have content more than just META-INF/.
-
getAlreadyTrustPublisher
public boolean getAlreadyTrustPublisher()- Specified by:
getAlreadyTrustPublisher
in interfaceCertVerifier
- Returns:
- if the publisher is already trusted
-
getRootInCacerts
public boolean getRootInCacerts()- Specified by:
getRootInCacerts
in interfaceCertVerifier
- Returns:
- if the root is in CA certs
-
getCertPath
- Specified by:
getCertPath
in interfaceCertVerifier
- Parameters:
cPath
- to be read- Returns:
- a valid certificate path to this certificate being verified
-
hasSigningIssues
- Specified by:
hasSigningIssues
in interfaceCertVerifier
- Parameters:
certPath
- to be validated- Returns:
- if there are signing issues with the certificate being verified
-
getDetails
- Specified by:
getDetails
in interfaceCertVerifier
- Parameters:
certPath
- certificate- Returns:
- the details regarding issue with this certificate
-
getCertsList
Get a list of the cert paths of all signers across the app.- Returns:
- List of CertPath vars representing each of the signers present on any jar.
-
getCertInformation
Find the information the specified cert path has with respect to this application.- Parameters:
cPath
- certificate to provide info- Returns:
- All the information the path has with this app.
-
isFullySigned
public boolean isFullySigned()Returns whether or not the app is considered completely signed. An app using a JNLP is considered signed if all of the entries of its jars are signed by at least one common signer. An applet on the other hand only needs to have each individual jar be fully signed by a signer. The signers can differ between jars.- Returns:
- Whether or not the app is considered signed.
-
isJarSigned
public static boolean isJarSigned(JARDesc jar, AppVerifier verifier, ResourceTracker tracker) throws Exception - Throws:
Exception
-
add
Update the verifier to consider new jars when verifying.- Parameters:
jars
- List of new jars to be verified.tracker
- Resource tracker used to obtain the the jars from cache- Throws:
Exception
- Caused by issues with obtaining the jars' entries or interacting with the tracker.
-
setCurrentlyUsedCertPath
-
getPublisher
- Specified by:
getPublisher
in interfaceCertVerifier
- Parameters:
cPath
- to be read for publisher- Returns:
- the application's publisher's certificate.
-
getRoot
- Specified by:
getRoot
in interfaceCertVerifier
- Parameters:
cPath
- certificate- Returns:
- the application's root's certificate. This may return the same certificate as getPublisher(CertPath certPath) in the event that the application is self signed.
-
allJarsSigned
public boolean allJarsSigned()Returns if all jars are signed.- Returns:
- True if all jars are signed, false if there are one or more unsigned jars
-
checkTrustWithUser
public void checkTrustWithUser(JNLPClassLoader.SecurityDelegate securityDelegate, JNLPFile file) throws LaunchException - Throws:
LaunchException
-
getJarSignableEntries
-
getTotalJarEntries
Get the total number of entries in the provided map.- Parameters:
map
- map of all jars- Returns:
- The number of entries.
-