Class AMCertStore

  • Direct Known Subclasses:
    AMCRLStore

    public class AMCertStore
    extends Object
    The class is used to manage certificate store in LDAP server This class does get certificate with specified attr name and value. This class should be used in order to manage certificate store in LDAP
    • Constructor Detail

      • AMCertStore

        public AMCertStore​(AMLDAPCertStoreParameters param)
        Class AMCertStore is special cased Certificate store for LDAP. A AMCertStore instance has to have all the information for ldap.
        Parameters:
        param - the LDAP certificate store parameters used to configure this store
    • Method Detail

      • getCertificate

        public X509Certificate getCertificate​(X509Certificate cert)
        Return matched certificate from ldap certificate store
        Parameters:
        cert - the certificate to match against the store
      • getCertificate

        public X509Certificate getCertificate()
        Return matched certificate from ldap certificate store
      • getIssuerDN

        public static String getIssuerDN​(X509Certificate certificate)
        Return value of certificate Issuer DN.
        Parameters:
        certificate - the certificate whose issuer DN is returned
        Returns:
        The Issuer's DN as String.
      • getSubjectDN

        public static String getSubjectDN​(X509Certificate certificate)
                                   throws IOException
        Return value of certificate subject DN.
        Parameters:
        certificate - the certificate whose subject DN is returned
        Returns:
        The Subject's DN as String.
        Throws:
        IOException
      • setSearchFilter

        public static String setSearchFilter​(String attrName,
                                             String attrValue)
        Return value of certificate subject DN
        Parameters:
        attrName - the attribute name to match in the search filter
        attrValue - the attribute value to match in the search filter
        Returns:
        searchFilter
      • setLdapStoreParam

        public static AMLDAPCertStoreParameters setLdapStoreParam​(String serverHost,
                                                                  int serverPort,
                                                                  String principleUser,
                                                                  String principlePasswd,
                                                                  String startSearchLoc,
                                                                  String uriParamsCRL,
                                                                  boolean isSSL)
                                                           throws Exception
        Return ldapParam object has all config params
        Parameters:
        serverHost - the LDAP server host name
        serverPort - the LDAP server port
        principleUser - the bind DN used to authenticate to the LDAP server
        principlePasswd - the bind password used to authenticate to the LDAP server
        startSearchLoc - the base DN at which to start the search
        uriParamsCRL - the URI parameters used when retrieving CRLs
        isSSL - true if the connection to the LDAP server should use SSL
        Throws:
        Exception
      • getIssuerCertificate

        public static X509Certificate getIssuerCertificate​(AMLDAPCertStoreParameters ldapParam,
                                                           X509Certificate cert,
                                                           String attrName)
        Return Issuer Certificate if the ldap entry has one
        Parameters:
        ldapParam - the LDAP certificate store parameters used to connect to the store
        cert - the certificate whose issuer certificate is looked up
        attrName - the attribute name used to match the issuer certificate
      • getRegisteredCertificate

        public static X509Certificate getRegisteredCertificate​(AMLDAPCertStoreParameters ldapParam,
                                                               X509Certificate cert,
                                                               String attrName)
        Return X509 Certificate if the ldap entry has the same one
        Parameters:
        ldapParam - the LDAP certificate store parameters used to connect to the store
        cert - the certificate to look up and compare against the store
        attrName - the attribute name used to match the certificate
      • getCertificate

        public static X509Certificate getCertificate​(AMLDAPCertStoreParameters ldapParam,
                                                     String attrName,
                                                     String attrValue)
        Return X509 Certificate if the ldap entry has one
        Parameters:
        ldapParam - the LDAP certificate store parameters used to connect to the store
        attrName - the attribute name to match in the search filter
        attrValue - the attribute value to match in the search filter
      • isRootCA

        public static boolean isRootCA​(X509Certificate cert)
        Return true if it is self signed ROOT CA
        Parameters:
        cert - the certificate to test for being a self-signed root CA