public SignatureResponse getDigitalSignatureRestService(SignatureRequest request, String clientIp) {
        SignatureResponse response = new SignatureResponse();
        EidSession session = initSession(request, clientIp, response);
        if (session == null) return response;

        // 1. create the digital signature to send back
        // use the private key to create the signature made out of the challenge, the
        // iccpace ephemeral public key and the ephemeral we created in the polymorphic
        // info
        byte[] toSign = KeyUtils.calcDataToSign(request.getChallenge(), session.getEphemeralKey().getQ(),
            session.getIdpicc().data);
        byte[] signature = signatureService.sign(toSign, session.getAtReference(), false);
        response.setSignature(signature);

        // Result OK
        return response;
    }
@Test
    public void getDigitalSignatureRestServiceTest() {
        EidSession session = new EidSession();
        session.setAtReference("SSSSSSSSSSSSSSSS");
        session.setEphemeralKey(ephemeralKey);
        session.setIdpicc(ByteArray.fromBase64("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS"));
        SignatureRequest request = new SignatureRequest();
        request.setHeader(createRequestHeader());
        byte[] signature = "signature".getBytes();

        doReturn(session).when(rdwService).initSession(any(AppRequest.class), eq(localhost), any(AppResponse.class));
        when(signatureService.sign(any(byte[].class), eq("SSSSSSSSSSSSSSSS"), eq(false))).thenReturn(signature);

        SignatureResponse result = rdwService.getDigitalSignatureRestService(request, localhost);

        assertEquals("OK", result.getStatus());
        assertEquals(signature, result.getSignature());
        verify(signatureService, times(1)).sign(any(byte[].class), eq("SSSSSSSSSSSSSSSS"), eq(false));
    }