Package org.ejbca.util.dn

Examples of org.ejbca.util.dn.DNFieldExtractor


    public CertificateView(Certificate certificate, RevokedInfoView revokedinfo, String username) {
      this.certificate=certificate;
      this.revokedinfo= revokedinfo;
      this.username=username;

      subjectdnfieldextractor = new DNFieldExtractor(CertTools.getSubjectDN(certificate), DNFieldExtractor.TYPE_SUBJECTDN);
      issuerdnfieldextractor  = new DNFieldExtractor(CertTools.getIssuerDN(certificate), DNFieldExtractor.TYPE_SUBJECTDN);
     
    }
View Full Code Here


     ArrayList<UseKeyWithType> retval = new ArrayList<UseKeyWithType>();
    
     Iterator<UseKeyWithType> iter = reqUsages.iterator();
     while(iter.hasNext()){
       UseKeyWithType useKeyWithType =  iter.next();
       DNFieldExtractor altNameExtractor = new DNFieldExtractor(CertTools.getSubjectAlternativeName(cert),DNFieldExtractor.TYPE_SUBJECTALTNAME);
       String cn = CertTools.getPartFromDN(cert.getSubjectDN().toString(), "CN");
      
      
       if(useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_XKMS)||
            useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_XKMSPROFILE) ||
            useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_TLS)){
          if(altNameExtractor.getField(DNFieldExtractor.URI, 0).startsWith(useKeyWithType.getIdentifier())){
            retval.add(useKeyWithType);
          }
       }
       if(useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_SMIME)||
          useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_PGP)){
          if(altNameExtractor.getField(DNFieldExtractor.RFC822NAME, 0).startsWith(useKeyWithType.getIdentifier())){
              retval.add(useKeyWithType);
        }        
       }
       if(useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_TLSHTTP)){        
          if(cn.startsWith(useKeyWithType.getIdentifier())){
              retval.add(useKeyWithType);
        }                                   
       }
       if(useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_TLSSMTP)){
          if(altNameExtractor.getField(DNFieldExtractor.DNSNAME, 0).startsWith(useKeyWithType.getIdentifier())){
              retval.add(useKeyWithType);
        }        
       }
       if(useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_IPSEC)){
          if(altNameExtractor.getField(DNFieldExtractor.IPADDRESS, 0).startsWith(useKeyWithType.getIdentifier())){
              retval.add(useKeyWithType);
        }        
       }
       if(useKeyWithType.getApplication().equals(XKMSConstants.USEKEYWITH_PKIX)){
          if(CertTools.getSubjectDN(cert).equalsIgnoreCase(CertTools.stringToBCDNString(useKeyWithType.getIdentifier()))){
View Full Code Here

      }
    }
    if (newEndEntityProfile) {
      for (int i=0; i<requiredFields.length; i++) {
        if (GET_SUBJECTDN_FROM_AD.equals(requiredFields[i])) {
          DNFieldExtractor dnfe = new DNFieldExtractor(fetchedSubjectDN, DNFieldExtractor.TYPE_SUBJECTDN);
          // Loop through all fields in DN
          HashMap hmFields = dnfe.getNumberOfFields();
          for (int j=0; j<100; j++) {  // TODO: 100 is really an internal constant..
            Integer fieldsOfType = (Integer) hmFields.get(Integer.valueOf(j));
            if (fieldsOfType != null) {
              log.info("fieldsOfType="+fieldsOfType);
              for (int k = 0; k<fieldsOfType; k++) {
View Full Code Here

     
       logentrydata[ADMINTYPE] = Integer.toString(logentry.getAdminType());
       if (logentry.getAdminType() == Admin.TYPE_CLIENTCERT_USER) {
          String dnstring = dnproxy.getSubjectDN(logentry.getAdminData());
          if ((dnstring !=null) && (!StringUtils.contains(logentry.getAdminData(), "SubjectDN")) ) {
            DNFieldExtractor dn = new DNFieldExtractor(dnstring, DNFieldExtractor.TYPE_SUBJECTDN);
            logentrydata[ADMINDATA] = dn.getField(DNFieldExtractor.CN,0) + ", " + dn.getField(DNFieldExtractor.O,0);
              logentrydata[ADMINCERTSERNO] = logentry.getAdminData();
          } else {
            logentrydata[ADMINDATA] = logentry.getAdminData();
          }
       } else {
          if (logentry.getAdminType() == Admin.TYPE_PUBLIC_WEB_USER) {
            if (logentry.getAdminData() != null) {          
              logentrydata[ADMINDATA] = "IP : " + logentry.getAdminData();
            }
          } else {   
            if (logentry.getAdminData() != null) {          
              logentrydata[ADMINDATA] = logentry.getAdminData();
            }
          } 
          if(logentrydata[ADMINDATA] == null) {
            logentrydata[ADMINDATA] = "";
          }
       }
      
             
       logentrydata[CA]    = caidtonamemap.get(Integer.valueOf(logentry.getCAId()));
      
       logentrydata[MODULE] = localmodulenames[logentry.getModule()];
        
       logentrydata[USERNAME] = logentry.getUsername();
       if (logentrydata[USERNAME] != null && logentrydata[USERNAME].trim().equals("")) {
         logentrydata[USERNAME] = null;
       }
      
       if ( (logentry.getCertificateSNR() != null) && (logentry.getCertificateSNR().trim().equals("")) ) {
            logentrydata[CERTIFICATESERNO] = null;
       } else {
         logentrydata[CERTIFICATESERNO] = logentry.getCertificateSNR();
       }
        
       if (logentrydata[CERTIFICATESERNO] != null) {
          String dnstring = dnproxy.getSubjectDN(logentry.getCertificateSNR());
          if(dnstring != null){
            DNFieldExtractor dn = new DNFieldExtractor(dnstring, DNFieldExtractor.TYPE_SUBJECTDN);
            logentrydata[CERTIFICATE] = dn.getField(DNFieldExtractor.CN,0) + ", " + dn.getField(DNFieldExtractor.O,0);
         
       }
      
       if (logentry.getEvent() < LogConstants.EVENT_ERROR_BOUNDRARY) {
           logentrydata[EVENT] = localinfoeventnames[logentry.getEvent()];
View Full Code Here

    // Public constants.

   public UserView(){
      userdata = new UserDataVO();
      userdata.setType(1);
      subjectdnfields = new DNFieldExtractor("", DNFieldExtractor.TYPE_SUBJECTDN);
      subjectaltnames = new DNFieldExtractor("", DNFieldExtractor.TYPE_SUBJECTALTNAME);
      subjectdirattrs = new DNFieldExtractor("", DNFieldExtractor.TYPE_SUBJECTDIRATTR);
   }
View Full Code Here


    public UserView(UserDataVO newuserdata, Map caidtonamemap){
      userdata = newuserdata;
      this.caname = (String) caidtonamemap.get(Integer.valueOf(newuserdata.getCAId()));
      subjectdnfields = new DNFieldExtractor(userdata.getDN(), DNFieldExtractor.TYPE_SUBJECTDN);
      subjectaltnames = new DNFieldExtractor(userdata.getSubjectAltName(), DNFieldExtractor.TYPE_SUBJECTALTNAME);
      String dirattrs = userdata.getExtendedinformation() != null ? userdata.getExtendedinformation().getSubjectDirectoryAttributes() : null;
      subjectdirattrs = new DNFieldExtractor(dirattrs, DNFieldExtractor.TYPE_SUBJECTDIRATTR);
      setCommonName();

      cleartextpwd = userdata.getPassword() != null;
    }
View Full Code Here

     */
    public Printable print(UserDataVO userdata,
                      String[] pincodes, String[] pukcodes,
                    String hardtokensn, String copyoftokensn) throws IOException, PrinterException {
      // Initialize
    DNFieldExtractor dnfields = new DNFieldExtractor(userdata.getDN(), DNFieldExtractor.TYPE_SUBJECTDN);
    // DNFieldExtractor subaltnamefields = new DNFieldExtractor(dn,DNFieldExtractor.TYPE_SUBJECTALTNAME);
    Date currenttime = new Date();
    String startdate = DateFormat.getDateInstance(DateFormat.SHORT).format(currenttime);
   
    String enddate = DateFormat.getDateInstance(DateFormat.SHORT).format(new Date(currenttime.getTime() + (this.validityms)));
View Full Code Here

        }
        adminsweblanguage = new WebLanguages(servletContext, globalconfiguration, currentadminpreference.getPreferedLanguage()
            ,currentadminpreference.getSecondaryLanguage());
       
        // set User Common Name
        DNFieldExtractor dn = new DNFieldExtractor(userdn, DNFieldExtractor.TYPE_SUBJECTDN);
        usercommonname = dn.getField(DNFieldExtractor.CN,0);
       
        initialized=true;
      }
      return globalconfiguration;
    }
View Full Code Here

    paramPut("requestAdmin.USERNAME", requestAdminUsername);   

    if (requestAdminDN == null) {
      requestAdminDN = "";
    }
    DNFieldExtractor dnfields = new DNFieldExtractor(requestAdminDN, DNFieldExtractor.TYPE_SUBJECTDN);       
    paramPut("requestAdmin.CN", dnfields.getField(DNFieldExtractor.CN, 0));       
    paramPut("requestAdmin.SN", dnfields.getField(DNFieldExtractor.SN, 0));
    paramPut("requestAdmin.O", dnfields.getField(DNFieldExtractor.O, 0));
    paramPut("requestAdmin.OU", dnfields.getField(DNFieldExtractor.OU, 0));
    paramPut("requestAdmin.C", dnfields.getField(DNFieldExtractor.C, 0));
    paramPut("requestAdmin.E", dnfields.getField(DNFieldExtractor.E, 0));

    paramPut("approvalAdmin.USERNAME", approvalAdminUsername);

    populateWithApprovalAdminDN(approvalAdminDN);
  }
View Full Code Here

  protected void populateWithApprovalAdminDN(String approvalAdminDN) {
    if (approvalAdminDN == null) {
      approvalAdminDN = "";
    }
    DNFieldExtractor dnfields = new DNFieldExtractor(approvalAdminDN, DNFieldExtractor.TYPE_SUBJECTDN);       
    paramPut("approvalAdmin.CN", dnfields.getField(DNFieldExtractor.CN, 0));       
    paramPut("approvalAdmin.SN", dnfields.getField(DNFieldExtractor.SN, 0));
    paramPut("approvalAdmin.O", dnfields.getField(DNFieldExtractor.O, 0));
    paramPut("approvalAdmin.OU", dnfields.getField(DNFieldExtractor.OU, 0));
    paramPut("approvalAdmin.C", dnfields.getField(DNFieldExtractor.C, 0));
    paramPut("approvalAdmin.E", dnfields.getField(DNFieldExtractor.E, 0));
  }
View Full Code Here

TOP

Related Classes of org.ejbca.util.dn.DNFieldExtractor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.