code: public int getCertNum() {
          for (int i = this.certChain.length - 1; i >= 0; i--) {
              if (!this.certChain[i].getSubjectDN().equals(this.certChain[i].getIssuerDN())) {
                  return i + 1;
              }
          }
          return this.certChain.length;
      }
docs: Returns the number of certificates in the credential without the self-signed certificates.
  
  @return number of certificates without counting self-signed certificates