Package org.ejbca.util.dn

Examples of org.ejbca.util.dn.DistinguishedName


                    final Map<String, String> dnMap = new HashMap<String, String>();
                    if (profile.getUse(DnComponents.DNEMAIL, 0)) {
                        dnMap.put(DnComponents.DNEMAIL, userDataVO.getEmail());
                    }
                    try {
                        dn = (new DistinguishedName(userData.getSubjectDN())).mergeDN(new DistinguishedName(dn), true, dnMap).toString();
                    } catch (InvalidNameException e) {
                        log.debug("Invalid dn. We make it empty");
                        dn = "";
                    }
                }
                if (userData.getSubjectAltName() != null) {
                    final Map<String, String> dnMap = new HashMap<String, String>();
                    if (profile.getUse(DnComponents.RFC822NAME, 0)) {
                        dnMap.put(DnComponents.RFC822NAME, userDataVO.getEmail());
                    }
                    try {
                        // SubjectAltName is not mandatory so
                        if (altName == null) {
                            altName = "";
                        }
                        altName = (new DistinguishedName(userData.getSubjectAltName())).mergeDN(new DistinguishedName(altName), true, dnMap).toString();
                    } catch (InvalidNameException e) {
                        log.debug("Invalid altName. We make it empty");
                        altName = "";
                    }
                }
View Full Code Here


     * @param email entity email.
     * @return updated DN.
     */
    private static String mergeSubjectDnWithDefaultValues(String subjectDN, EndEntityProfile profile,
            String entityEmail) {
        DistinguishedName profiledn;
        DistinguishedName userdn;
        try {
          userdn = new DistinguishedName(subjectDN);
    } catch (InvalidNameException ine) {
      log.debug(subjectDN,ine);
      throw new RuntimeException(ine);
    }
        int numberofsubjectdnfields = profile.getSubjectDNFieldOrderLength();
        List rdnList = new ArrayList(numberofsubjectdnfields);
        int[] fielddata = null;
        String value;
        //Build profile's DN
        for (int i = 0; i < numberofsubjectdnfields; i++) {
          value=null;
      fielddata = profile.getSubjectDNFieldsInOrder(i);
      String parameter = DNFieldExtractor.getFieldComponent(
          DnComponents.profileIdToDnId(fielddata[EndEntityProfile.FIELDTYPE]),
          DNFieldExtractor.TYPE_SUBJECTDN);
      value = profile.getValue(fielddata[EndEntityProfile.FIELDTYPE], 0);
      if (value != null) {
        value = value.trim();
        if (!value.equals("")) {         
          try {
            parameter = StringUtils.replace(parameter, "=", "");
            rdnList.add(fielddata[EndEntityProfile.NUMBER],new Rdn(parameter,value));
          }catch(InvalidNameException ine) {
            log.debug("InvalidNameException while creating new Rdn with parameter "+ parameter + " and value " + value,ine);
            throw new RuntimeException(ine);
          }
         
        }
      }
    }
        profiledn = new DistinguishedName(rdnList);

        Map dnMap = new HashMap();
        if (profile.getUse(DnComponents.DNEMAIL, 0)) {
            dnMap.put(DnComponents.DNEMAIL, entityEmail);
        }
View Full Code Here

     * @param profile user associated profile.
     * @param email entity email field
     * @return updated subject alt name
     */
    private static String mergeSubjectAltNameWithDefaultValues(String subjectAltName, EndEntityProfile profile, String entityEmail) {
        DistinguishedName profileAltName;
        DistinguishedName userAltName;
        try {
          if(subjectAltName==null) {
            subjectAltName = "";
          }
          userAltName = new DistinguishedName(subjectAltName);
    } catch (InvalidNameException ine) {
      log.debug(subjectAltName,ine);
      throw new RuntimeException(ine);
    }
        int numberofsubjectAltNamefields = profile.getSubjectAltNameFieldOrderLength();
        List rdnList = new ArrayList(numberofsubjectAltNamefields);
        int[] fielddata = null;
        String value;
        //Build profile's Alt Name
        for (int i = 0; i < numberofsubjectAltNamefields; i++) {
          value=null;
      fielddata = profile.getSubjectAltNameFieldsInOrder(i);
      String parameter = DNFieldExtractor.getFieldComponent(
          DnComponents.profileIdToDnId(fielddata[EndEntityProfile.FIELDTYPE]),
          DNFieldExtractor.TYPE_SUBJECTALTNAME);
      value = profile.getValue(fielddata[EndEntityProfile.FIELDTYPE], 0);
      if (value != null) {
        value = value.trim();
        if (!value.equals("")) {         
          try {
            parameter = StringUtils.replace(parameter, "=", "");
            rdnList.add(fielddata[EndEntityProfile.NUMBER],new Rdn(parameter,value));
          }catch(InvalidNameException ine) {
            log.debug("InvalidNameException while creating new Rdn with parameter "+ parameter + " and value " + value,ine);
            throw new RuntimeException(ine);
          }
         
        }
      }
    }
        profileAltName = new DistinguishedName(rdnList);

        Map dnMap = new HashMap();
        if (profile.getUse(DnComponents.RFC822NAME, 0)) {
            dnMap.put(DnComponents.RFC822NAME, entityEmail);
        }
View Full Code Here

TOP

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

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.