Decode punycode in certificates

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

@ -194,7 +194,7 @@ public class EntityCertificate {
for (List altName : altNames) for (List altName : altNames)
if (altName.get(0).equals(GeneralName.rfc822Name)) { if (altName.get(0).equals(GeneralName.rfc822Name)) {
if (altName.get(1) instanceof String) if (altName.get(1) instanceof String)
result.add((String) altName.get(1)); result.add(MessageHelper.fromPunyCode((String) altName.get(1)));
} else if (altName.get(0).equals(GeneralName.otherName)) { } else if (altName.get(0).equals(GeneralName.otherName)) {
if (altName.get(1) instanceof byte[]) if (altName.get(1) instanceof byte[])
try { try {
@ -206,7 +206,7 @@ public class EntityCertificate {
int at = otherName.indexOf('@'); int at = otherName.indexOf('@');
int dot = otherName.lastIndexOf('.'); int dot = otherName.lastIndexOf('.');
if (at >= 0 && dot > at) // UTF-8 accepted, so basic test only if (at >= 0 && dot > at) // UTF-8 accepted, so basic test only
result.add(otherName); result.add(MessageHelper.fromPunyCode(otherName));
else else
Log.w("Ignoring otherName=" + otherName); Log.w("Ignoring otherName=" + otherName);
} catch (Throwable ex) { } catch (Throwable ex) {
@ -234,7 +234,7 @@ public class EntityCertificate {
continue; continue;
if (!Helper.EMAIL_ADDRESS.matcher(email).matches()) if (!Helper.EMAIL_ADDRESS.matcher(email).matches())
continue; continue;
result.add(email); result.add(MessageHelper.fromPunyCode(email));
} }
} }
} catch (Throwable ex) { } catch (Throwable ex) {

Loading…
Cancel
Save