예제 #1
1
  @Override
  public WSDocument extendSignature(
      final WSDocument signedDocument, final WSParameters wsParameters) throws DSSException {

    String exceptionMessage;
    try {
      if (LOG.isInfoEnabled()) {

        LOG.info("WsExtendSignature: begin");
      }
      final SignatureParameters params = createParameters(wsParameters);
      final DocumentSignatureService service =
          getServiceForSignatureLevel(params.getSignatureLevel());
      final DSSDocument dssDocument = service.extendDocument(signedDocument, params);
      final WSDocument wsDocument = new WSDocument(dssDocument);
      if (LOG.isInfoEnabled()) {

        LOG.info("WsExtendSignature: end");
      }
      return wsDocument;
    } catch (Throwable e) {
      e.printStackTrace();
      exceptionMessage = e.getMessage();
    }
    LOG.info("WsExtendSignature: end with exception");
    throw new DSSException(exceptionMessage);
  }
예제 #2
1
  @Override
  public byte[] getDataToSign(final WSDocument document, final WSParameters wsParameters)
      throws DSSException {

    String exceptionMessage;
    try {
      if (LOG.isInfoEnabled()) {

        LOG.info("WsGetDataToSign: begin");
      }
      final SignatureParameters params = createParameters(wsParameters);
      final DocumentSignatureService service =
          getServiceForSignatureLevel(params.getSignatureLevel());
      final byte[] dataToSign = service.getDataToSign(document, params);
      if (LOG.isInfoEnabled()) {

        LOG.info("WsGetDataToSign: end");
      }
      return dataToSign;
    } catch (Throwable e) {
      e.printStackTrace();
      exceptionMessage = e.getMessage();
    }
    LOG.info("WsGetDataToSign: end with exception");
    throw new DSSException(exceptionMessage);
  }