protected byte[] engineSign() throws SignatureException { try { byte[] hash = DigestUtil.getDigestResult(digest); return signer.generateSignature(hash); } catch (Exception e) { if (e instanceof IllegalStateException) { throw new SignatureException(e.getMessage()); } throw new SignatureException(e.toString()); } }