net.sourceforge.jnlp.tools

## Class JarCertVerifier

- java.lang.Object
- - net.sourceforge.jnlp.tools.JarCertVerifier

- All Implemented Interfaces:
    CertVerifier

      public class JarCertVerifier
      extends java.lang.Object
      implements CertVerifier

  The jar certificate verifier utility.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JarCertVerifier(AppVerifier verifier)` Create a new jar certificate verifier utility that uses the provided verifier for its strategy pattern.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(java.util.List<JARDesc> jars, ResourceTracker tracker)` Update the verifier to consider new jars when verifying.
    `boolean` | `allJarsSigned()` Returns if all jars are signed.
    `void` | `checkTrustWithUser(JNLPFile file)`
    `boolean` | `getAlreadyTrustPublisher()` Return if the publisher is already trusted
    `CertInformation` | `getCertInformation(java.security.cert.CertPath cPath)` Find the information the specified cert path has with respect to this application.
    `java.security.cert.CertPath` | `getCertPath(java.security.cert.CertPath cPath)` Return a valid certificate path to this certificate being verified
    `java.util.List<java.security.cert.CertPath>` | `getCertsList()` Get a list of the cert paths of all signers across the app.
    `java.util.List<java.lang.String>` | `getDetails(java.security.cert.CertPath certPath)` Get the details regarding issue with this certificate
    `java.util.Map<java.lang.String,java.lang.Integer>` | `getJarSignableEntries()`
    `java.security.cert.Certificate` | `getPublisher(java.security.cert.CertPath cPath)` Returns the application's publisher's certificate.
    `java.security.cert.Certificate` | `getRoot(java.security.cert.CertPath cPath)` Returns the application's root's certificate.
    `boolean` | `getRootInCacerts()` Return if the root is in CA certs
    `static int` | `getTotalJarEntries(java.util.Map<java.lang.String,java.lang.Integer> map)` Get the total number of entries in the provided map.
    `boolean` | `hasSigningIssues(java.security.cert.CertPath certPath)` Return if there are signing issues with the certificate being verified
    `boolean` | `isFullySigned()` Returns whether or not the app is considered completely signed.
    `boolean` | `isTriviallySigned()` Return true if there are no signable entries in the jar.
    `void` | `setCurrentlyUsedCertPath(java.security.cert.CertPath cPath)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JarCertVerifier

          public JarCertVerifier(AppVerifier verifier)

      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 Detail

    - #### isTriviallySigned

          public boolean isTriviallySigned()

      Return 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()

      Description copied from interface: `CertVerifier`
      Return if the publisher is already trusted
      Specified by:
        `getAlreadyTrustPublisher` in interface `CertVerifier`

    - #### getRootInCacerts

          public boolean getRootInCacerts()

      Description copied from interface: `CertVerifier`
      Return if the root is in CA certs
      Specified by:
        `getRootInCacerts` in interface `CertVerifier`

    - #### getCertPath

          public java.security.cert.CertPath getCertPath(java.security.cert.CertPath cPath)

      Description copied from interface: `CertVerifier`
      Return a valid certificate path to this certificate being verified
      Specified by:
        `getCertPath` in interface `CertVerifier`
      Returns:
        The CertPath

    - #### hasSigningIssues

          public boolean hasSigningIssues(java.security.cert.CertPath certPath)

      Description copied from interface: `CertVerifier`
      Return if there are signing issues with the certificate being verified
      Specified by:
        `hasSigningIssues` in interface `CertVerifier`

    - #### getDetails

          public java.util.List<java.lang.String> getDetails(java.security.cert.CertPath certPath)

      Description copied from interface: `CertVerifier`
      Get the details regarding issue with this certificate
      Specified by:
        `getDetails` in interface `CertVerifier`

    - #### getCertsList

          public java.util.List<java.security.cert.CertPath> 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

          public CertInformation getCertInformation(java.security.cert.CertPath cPath)

      Find the information the specified cert path has with respect to this application.
      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.

    - #### add

          public void add(java.util.List<JARDesc> jars,
                 ResourceTracker tracker)
                   throws java.lang.Exception

      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:
        `java.lang.Exception` - Caused by issues with obtaining the jars' entries or interacting with the tracker.

    - #### setCurrentlyUsedCertPath

          public void setCurrentlyUsedCertPath(java.security.cert.CertPath cPath)

    - #### getPublisher

          public java.security.cert.Certificate getPublisher(java.security.cert.CertPath cPath)

      Description copied from interface: `CertVerifier`
      Returns the application's publisher's certificate.
      Specified by:
        `getPublisher` in interface `CertVerifier`

    - #### getRoot

          public java.security.cert.Certificate getRoot(java.security.cert.CertPath cPath)

      Description copied from interface: `CertVerifier`
      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.
      Specified by:
        `getRoot` in interface `CertVerifier`

    - #### 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(JNLPFile file)
                                  throws LaunchException

      Throws:
        `LaunchException`

    - #### getJarSignableEntries

          public java.util.Map<java.lang.String,java.lang.Integer> getJarSignableEntries()

    - #### getTotalJarEntries

          public static int getTotalJarEntries(java.util.Map<java.lang.String,java.lang.Integer> map)

      Get the total number of entries in the provided map.
      Returns:
        The number of entries.

Submit a bug or feature