|
|
@ -48,6 +48,7 @@ import java.util.Arrays;
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Locale;
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.security.auth.x500.X500Principal;
|
|
|
|
import javax.security.auth.x500.X500Principal;
|
|
|
@ -142,20 +143,23 @@ public class EntityCertificate {
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
X500Name name = new JcaX509CertificateHolder(certificate).getSubject();
|
|
|
|
X500Name name = new JcaX509CertificateHolder(certificate).getSubject();
|
|
|
|
|
|
|
|
if (name != null) {
|
|
|
|
List<RDN> rdns = new ArrayList<>();
|
|
|
|
List<RDN> rdns = new ArrayList<>();
|
|
|
|
rdns.addAll(Arrays.asList(name.getRDNs(BCStyle.CN)));
|
|
|
|
rdns.addAll(Arrays.asList(name.getRDNs(BCStyle.CN)));
|
|
|
|
rdns.addAll(Arrays.asList(name.getRDNs(BCStyle.EmailAddress)));
|
|
|
|
rdns.addAll(Arrays.asList(name.getRDNs(BCStyle.EmailAddress)));
|
|
|
|
for (RDN rdn : rdns) {
|
|
|
|
for (RDN rdn : rdns)
|
|
|
|
for (AttributeTypeAndValue tv : rdn.getTypesAndValues()) {
|
|
|
|
for (AttributeTypeAndValue tv : rdn.getTypesAndValues()) {
|
|
|
|
ASN1Encodable enc = tv.getValue();
|
|
|
|
ASN1Encodable enc = tv.getValue();
|
|
|
|
if (enc != null) {
|
|
|
|
if (enc == null)
|
|
|
|
String email = enc.toString();
|
|
|
|
continue;
|
|
|
|
if (!result.contains(email) &&
|
|
|
|
String email = enc.toString().toLowerCase(Locale.ROOT);
|
|
|
|
Helper.EMAIL_ADDRESS.matcher(email).matches())
|
|
|
|
if (result.contains(email))
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (!Helper.EMAIL_ADDRESS.matcher(email).matches())
|
|
|
|
|
|
|
|
continue;
|
|
|
|
result.add(email);
|
|
|
|
result.add(email);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
Log.e(ex);
|
|
|
|
Log.e(ex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|