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.
    • Field Detail

      • LOG

        private static final Logger LOG
      • hasExpiredCert

        private boolean hasExpiredCert
      • hasExpiringCert

        private boolean hasExpiringCert
      • isNotYetValidCert

        private boolean isNotYetValidCert
      • hasBadKeyUsage

        private boolean hasBadKeyUsage
      • hasBadExtendedKeyUsage

        private boolean hasBadExtendedKeyUsage
      • hasBadNetscapeCertType

        private boolean hasBadNetscapeCertType
      • alreadyTrustPublisher

        private boolean alreadyTrustPublisher
      • rootInCacerts

        private boolean rootInCacerts
      • signedJars

        private java.util.HashMap<java.lang.String,​java.lang.Integer> signedJars
        The jars and their number of entries this cert has signed.
    • 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.
      • removeFromDetails

        private void removeFromDetails​(CertInformation.Detail detail)
        Remove an issue from the list of details of issues with this certificate. List is unchanged if detail was not present.
        Parameters:
        detail - The issue to be removed regarding this certificate.
      • 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.