class TokenCertificateService {

    public void registerAuthCert(String hash, String securityServerAddress) throws CertificateNotFoundException,
            GlobalConfOutdatedException, InvalidCertificateException,
            SignCertificateNotSupportedException, KeyNotFoundException, ActionNotPossibleException {
        CertificateInfo certificateInfo = getCertificateInfo(hash);
        auditLogTokenKeyAndCert(hash, certificateInfo, false);
        verifyAuthCert(certificateInfo);
        verifyCertAction(PossibleActionEnum.REGISTER, certificateInfo, hash);
        try {
            Integer requestId = managementRequestSenderService.sendAuthCertRegisterRequest(securityServerAddress,
                    certificateInfo.getCertificateBytes());
            auditDataHelper.put(ADDRESS, securityServerAddress);
            auditDataHelper.putManagementRequestId(requestId);
            auditDataHelper.put(CERT_STATUS, CertificateInfo.STATUS_REGINPROG);
            signerProxyFacade.setCertStatus(certificateInfo.getId(), CertificateInfo.STATUS_REGINPROG);
        } catch (GlobalConfOutdatedException | CodedException e) {
            throw e;
        } catch (Exception e) {
            throw new SignerNotReachableException("Could not register auth cert", e);
        }
    }

    @Autowired @SuppressWarnings("checkstyle:ParameterNumber") public  TokenCertificateService(SignerProxyFacade signerProxyFacade, ClientService clientService,
            CertificateAuthorityService certificateAuthorityService, KeyService keyService, DnFieldHelper dnFieldHelper,
            GlobalConfService globalConfService, GlobalConfFacade globalConfFacade, ClientRepository clientRepository,
            ManagementRequestSenderService managementRequestSenderService, ServerConfService serverConfService,
            PossibleActionsRuleEngine possibleActionsRuleEngine, TokenService tokenService,
            SecurityHelper securityHelper, AuditDataHelper auditDataHelper,
            AuditEventHelper auditEventHelper);

}