Added type checks

pull/217/head
M66B 9 months ago
parent ed00428cb3
commit 763240bd65

@ -192,9 +192,11 @@ public class EntityCertificate {
Collection<List<?>> altNames = certificate.getSubjectAlternativeNames();
if (altNames != null)
for (List altName : altNames)
if (altName.get(0).equals(GeneralName.rfc822Name))
if (altName.get(0).equals(GeneralName.rfc822Name)) {
if (altName.get(1) instanceof String)
result.add((String) altName.get(1));
else if (altName.get(0).equals(GeneralName.otherName) && altName.get(1) instanceof byte[])
} else if (altName.get(0).equals(GeneralName.otherName)) {
if (altName.get(1) instanceof byte[])
try {
ASN1InputStream decoder = new ASN1InputStream((byte[]) altName.get(1));
DLTaggedObject encoded = (DLTaggedObject) decoder.readObject();
@ -210,7 +212,7 @@ public class EntityCertificate {
} catch (Throwable ex) {
Log.w(ex);
}
else
} else
Log.i("Alt type=" + altName.get(0) + " data=" + altName.get(1));
} catch (CertificateParsingException ex) {
Log.e(ex);
@ -252,9 +254,10 @@ public class EntityCertificate {
for (List altName : altNames)
try {
if (altName.get(0).equals(GeneralName.dNSName))
if (altName.get(0).equals(GeneralName.dNSName)) {
if (altName.get(1) instanceof String)
result.add((String) altName.get(1));
else if (altName.get(0).equals(GeneralName.iPAddress))
} else if (altName.get(0).equals(GeneralName.iPAddress))
if (altName.get(1) instanceof String)
result.add((String) altName.get(1));
else {

Loading…
Cancel
Save