boolean found = false;
for (int i = 0; i < gns.length; i++) {
int tag = gns[i].getTagNo();
if (tag == 4) {
found = true;
DEREncodable enc = gns[i].getName();
X509Name dir = (X509Name) enc;
String str = dir.toString();
log.debug("DirectoryName: " + str);
assertEquals("CN=testDirName,O=Foo,OU=Bar,C=SE", str);
}
}
assertTrue(found);
altName = "rfc822name=foo@bar.se, rfc822name=foo@bar.com, uri=http://foo.bar.se, directoryName="
+ LDAPDN.escapeRDN("CN=testDirName, O=Foo, OU=Bar, C=SE")
+ ", dnsName=foo.bar.se, dnsName=foo.bar.com";
san = CertTools.getGeneralNamesFromAltName(altName);
gns = san.getNames();
int dnscount = 0;
int rfc822count = 0;
for (int i = 0; i < gns.length; i++) {
int tag = gns[i].getTagNo();
if (tag == 2) {
dnscount++;
DEREncodable enc = gns[i].getName();
DERIA5String dir = (DERIA5String) enc;
String str = dir.getString();
log.info("DnsName: " + str);
}
if (tag == 1) {
rfc822count++;
DEREncodable enc = gns[i].getName();
DERIA5String dir = (DERIA5String) enc;
String str = dir.getString();
log.info("Rfc822Name: " + str);
}