Class CertInformation


  • public class CertInformation
    extends java.lang.Object
    Maintains information about a CertPath that has signed at least one of the entries provided by a jar of the app.
    • Constructor Summary

      Constructors 
      Constructor Description
      CertInformation()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<java.lang.String> getDetailsAsStrings()
      Get the details regarding issue(s) with this certificate.
      int getNumJarEntriesSigned​(java.lang.String jarName)
      Find the number of entries this cert has signed in the specified jar.
      java.util.Map<java.lang.String,​java.lang.Integer> getSignedJars()
      Get all the jars this cert has signed along with the number of entries in each jar.
      boolean hasExpiringCert()
      Get whether or not this cert will expire within 6 months.
      boolean hasSigningIssues()
      Return if there are signing issues with this certificate.
      boolean isPublisherAlreadyTrusted()
      Return whether or not the publisher is already trusted.
      boolean isRootInCacerts()
      Return whether or not the root is in the list of trusted CA certificates.
      boolean isSignerOfJar​(java.lang.String jarName)
      Check if this cert is the signer of a jar.
      void resetForReverification()
      Resets any trust of the root and publisher.
      void setAlreadyTrustPublisher()
      Set whether or not the publisher is already trusted.
      void setBadExtendedKeyUsage()
      Set that this cert has bad extended key usage and add this issue to the list of details.
      void setBadKeyUsage()
      Set that this cert has bad key usage and add this issue to the list of details.
      void setBadNetscapeCertType()
      Set that this cert has a bad netscape cert type and add this issue to the list of details.
      void setHasExpiredCert()
      Set that this cert is expired and add this issue to the list of details.
      void setHasExpiringCert()
      Set that this cert is expiring within 6 months and add this issue to the list of details.
      void setNotYetValidCert()
      Set that this cert is not yet valid and add this issue to the list of details.
      void setNumJarEntriesSigned​(java.lang.String jarName, int signedEntriesCount)
      Add a jar to the list of jars this certificate has signed along with the number of entries it has signed in the jar.
      void setRootInCacerts()
      Set that this cert's root CA is to be trusted.
      void setUntrusted()
      Set that this cert and all of its CAs are untrusted so far.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CertInformation

        public CertInformation()
    • Method Detail

      • hasSigningIssues

        public boolean hasSigningIssues()
        Return if there are signing issues with this certificate.
        Returns:
        true if there are any issues with expiry, validity or bad key usage.
      • isPublisherAlreadyTrusted

        public boolean isPublisherAlreadyTrusted()
        Return whether or not the publisher is already trusted.
        Returns:
        true if the publisher is trusted already.
      • setAlreadyTrustPublisher

        public void setAlreadyTrustPublisher()
        Set whether or not the publisher is already trusted.
      • isRootInCacerts

        public boolean isRootInCacerts()
        Return whether or not the root is in the list of trusted CA certificates.
        Returns:
        true if the root is in the list of CA certificates.
      • setRootInCacerts

        public void setRootInCacerts()
        Set that this cert's root CA is to be trusted.
      • resetForReverification

        public void resetForReverification()
        Resets any trust of the root and publisher. Also removes unnecessary details from the list of issues.
      • isSignerOfJar

        public boolean isSignerOfJar​(java.lang.String jarName)
        Check if this cert is the signer of a jar.
        Parameters:
        jarName - The absolute path of the jar this certificate has signed.
        Returns:
        true if this cert has signed the jar found at jarName.
      • setNumJarEntriesSigned

        public void setNumJarEntriesSigned​(java.lang.String jarName,
                                           int signedEntriesCount)
        Add a jar to the list of jars this certificate has signed along with the number of entries it has signed in the jar.
        Parameters:
        jarName - The absolute path of the jar this certificate has signed.
        signedEntriesCount - The number of entries this cert has signed in jarName.
      • getNumJarEntriesSigned

        public int getNumJarEntriesSigned​(java.lang.String jarName)
        Find the number of entries this cert has signed in the specified jar.
        Parameters:
        jarName - The absolute path of the jar this certificate has signed.
        Returns:
        The number of entries this cert has signed in jarName.
      • getSignedJars

        public java.util.Map<java.lang.String,​java.lang.Integer> getSignedJars()
        Get all the jars this cert has signed along with the number of entries in each jar.
        Returns:
        a {link Map} of jars and their number of entries this cert has signed
      • getDetailsAsStrings

        public java.util.List<java.lang.String> getDetailsAsStrings()
        Get the details regarding issue(s) with this certificate.
        Returns:
        A list of all the details/issues with this app.
      • setHasExpiredCert

        public void setHasExpiredCert()
        Set that this cert is expired and add this issue to the list of details.
      • setHasExpiringCert

        public void setHasExpiringCert()
        Set that this cert is expiring within 6 months and add this issue to the list of details.
      • hasExpiringCert

        public boolean hasExpiringCert()
        Get whether or not this cert will expire within 6 months.
        Returns:
        true if the cert will be expired after 6 months.
      • setNotYetValidCert

        public void setNotYetValidCert()
        Set that this cert is not yet valid and add this issue to the list of details.
      • setBadKeyUsage

        public void setBadKeyUsage()
        Set that this cert has bad key usage and add this issue to the list of details.
      • setBadExtendedKeyUsage

        public void setBadExtendedKeyUsage()
        Set that this cert has bad extended key usage and add this issue to the list of details.
      • setBadNetscapeCertType

        public void setBadNetscapeCertType()
        Set that this cert has a bad netscape cert type and add this issue to the list of details.
      • setUntrusted

        public void setUntrusted()
        Set that this cert and all of its CAs are untrusted so far.