static String extractCNFromDN(String dn) {
        LOGGER.debug(() -> "extractCNFromDN DN = " + dn);

        if (dn == null) {
            return null;
        }
        final StringTokenizer attributes = new StringTokenizer(dn, ",");
        final Map<String, String> map = new HashMap<>();
        while (attributes.hasMoreTokens()) {
            final String token = attributes.nextToken();
            if (token.contains("=")) {
                final String[] parts = token.split("=");
                if (parts.length == 2) {
                    map.put(parts[0].trim().toUpperCase(), parts[1].trim());
                }
            }
        }
        final String cn = map.get("CN");
        LOGGER.debug(() -> "extractCNFromDN CN = " + cn);

        return cn;
    }
Given a DN pull out the CN. E.g.
"CN=some.server.co.uk, OU=servers, O=some organisation, C=GB" Would
return "some.server.co.uk"

@return null or the CN name
stroom-util/src/main/java/stroom/util/cert/CertificateExtractor.java