class CertificateAuthorityService {

    List<String> buildPath(X509Certificate certificate,
            Map<String, String> subjectsToIssuers) {
        ArrayList<String> pathElements = new ArrayList<>();
        String current = certificate.getSubjectDN().getName();
        String issuer = certificate.getIssuerDN().getName();
        pathElements.add(current);
        while (!current.equals(issuer) && subjectsToIssuers.containsKey(issuer)) {
            pathElements.add(0, issuer);
            current = issuer;
            issuer = subjectsToIssuers.get(current);
        }
        return pathElements;
    }

    @Autowired public  CertificateAuthorityService(GlobalConfService globalConfService,
            GlobalConfFacade globalConfFacade,
            ClientService clientService,
            SignerProxyFacade signerProxyFacade,
            CurrentSecurityServerId currentSecurityServerId);

}