* @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);
}