// @Override
public X509Certificate getCertificateForAddress(InternetAddress dnsHostnameOrIpAddress) {
System.out.println("ArrayCertificateRepository: getCertificateForAddress("+dnsHostnameOrIpAddress.toString()+")");
for(X509Certificate x509 : keystore) {
System.out.println("- x509 subject: "+x509.getSubjectX500Principal().getName());
DN dn = new DN(x509.getSubjectX500Principal().getName());
if( dn.getCommonName() != null && dn.getCommonName().equals(dnsHostnameOrIpAddress.toString()) ) {
System.out.println("- found subject");
return x509;
}
Set<String> alternativeNames = X509Util.alternativeNames(x509);
for(String alternativeName : alternativeNames) {