value = CertTools.getPartFromDN(dirAttr, "gender"); if (!StringUtils.isEmpty(value)) { DEREncodableVector vec = new DEREncodableVector(); vec.add(new DERPrintableString(value)); attr = new Attribute(new DERObjectIdentifier(id_pda_gender),new DERSet(vec)); ret.add(attr);
if (StringUtils.isEmpty(result)) { return null;
    public static Collection getSubjectDirectoryAttributes(String dirAttr) {    	ArrayList ret = new ArrayList();    	Attribute attr = null;        String value = CertTools.getPartFromDN(dirAttr, "countryOfResidence");        if (!StringUtils.isEmpty(value)) {        	DEREncodableVector vec = new DEREncodableVector();        	vec.add(new DERPrintableString(value));        	attr = new Attribute(new DERObjectIdentifier(id_pda_countryOfResidence),new DERSet(vec));        	ret.add(attr);        }        value = CertTools.getPartFromDN(dirAttr, "countryOfCitizenship");        if (!StringUtils.isEmpty(value)) {        	DEREncodableVector vec = new DEREncodableVector();        	vec.add(new DERPrintableString(value));        	attr = new Attribute(new DERObjectIdentifier(id_pda_countryOfCitizenship),new DERSet(vec));        	ret.add(attr);        }        value = CertTools.getPartFromDN(dirAttr, "gender");        if (!StringUtils.isEmpty(value)) {        	DEREncodableVector vec = new DEREncodableVector();        	vec.add(new DERPrintableString(value));        	attr = new Attribute(new DERObjectIdentifier(id_pda_gender),new DERSet(vec));        	ret.add(attr);        }        value = CertTools.getPartFromDN(dirAttr, "placeOfBirth");        if (!StringUtils.isEmpty(value)) {        	DEREncodableVector vec = new DEREncodableVector();        	X509DefaultEntryConverter conv = new X509DefaultEntryConverter();        	DERObject obj = conv.getConvertedValue(new DERObjectIdentifier(id_pda_placeOfBirth), value);        	vec.add(obj);        	attr = new Attribute(new DERObjectIdentifier(id_pda_placeOfBirth),new DERSet(vec));        	ret.add(attr);        }                // dateOfBirth that is a GeneralizedTime        // The correct format for this is YYYYMMDD, it will be padded to YYYYMMDD120000Z        value = CertTools.getPartFromDN(dirAttr, "dateOfBirth");        if (!StringUtils.isEmpty(value)) {            if (value.length() == 8) {                value += "120000Z"; // standard format according to rfc3739                DEREncodableVector vec = new DEREncodableVector();                vec.add(new DERGeneralizedTime(value));                attr = new Attribute(new DERObjectIdentifier(id_pda_dateOfBirth),new DERSet(vec));                ret.add(attr);                            } else {                log.error("Wrong length of data for 'dateOfBirth', should be of format YYYYMMDD, skipping...");            }        }        return ret;    }