@Test public void simpleTest() { byte[] contentToBeTimestamped = "Hello World!".getBytes(); byte[] digestValue = DSSUtils.digest(DigestAlgorithm.SHA1, contentToBeTimestamped); TimestampResponseDTO timestampResponse = timestampService.getTimestampResponse(DigestAlgorithm.SHA1, digestValue); assertNotNull(timestampResponse); assertTrue(Utils.isArrayNotEmpty(timestampResponse.getBinaries())); }
public TimestampResponseDTO getTimestampResponse(final DigestAlgorithm digestAlgorithm, final byte[] value) throws DSSException { Objects.requireNonNull(tspSource, "TSPSource must be not null!"); LOG.info("Timestamp request in process..."); Objects.requireNonNull(digestAlgorithm, "digestAlgorithm must be not null!"); Objects.requireNonNull(value, "value must be not null!"); TimestampBinary timestampBinary = tspSource.getTimeStampResponse(digestAlgorithm, value); if (timestampBinary != null && Utils.isArrayNotEmpty(timestampBinary.getBytes())) { LOG.info("Timestamp is obtained."); return toTimestampResponseDTO(timestampBinary); } throw new DSSException("The obtained TimestampToken response is null or empty!"); }
RemoteTimestampService { public TimestampResponseDTO getTimestampResponse(final DigestAlgorithm digestAlgorithm, final byte[] value) throws DSSException { Objects.requireNonNull(tspSource, "TSPSource must be not null!"); LOG.info("Timestamp request in process..."); Objects.requireNonNull(digestAlgorithm, "digestAlgorithm must be not null!"); Objects.requireNonNull(value, "value must be not null!"); TimestampBinary timestampBinary = tspSource.getTimeStampResponse(digestAlgorithm, value); if (timestampBinary != null && Utils.isArrayNotEmpty(timestampBinary.getBytes())) { LOG.info("Timestamp is obtained."); return toTimestampResponseDTO(timestampBinary); } throw new DSSException("The obtained TimestampToken response is null or empty!"); } }
RemoteTimestampService { public TimestampResponseDTO getTimestampResponse(final DigestAlgorithm digestAlgorithm, final byte[] value) throws DSSException { Objects.requireNonNull(tspSource, "TSPSource must be not null!"); LOG.info("Timestamp request in process..."); Objects.requireNonNull(digestAlgorithm, "digestAlgorithm must be not null!"); Objects.requireNonNull(value, "value must be not null!"); TimestampBinary timestampBinary = tspSource.getTimeStampResponse(digestAlgorithm, value); if (timestampBinary != null && Utils.isArrayNotEmpty(timestampBinary.getBytes())) { LOG.info("Timestamp is obtained."); return toTimestampResponseDTO(timestampBinary); } throw new DSSException("The obtained TimestampToken response is null or empty!"); }  }
RemoteTimestampService { public TimestampResponseDTO getTimestampResponse(final DigestAlgorithm digestAlgorithm, final byte[] value) throws DSSException { Objects.requireNonNull(tspSource, "TSPSource must be not null!"); LOG.info("Timestamp request in process..."); Objects.requireNonNull(digestAlgorithm, "digestAlgorithm must be not null!"); Objects.requireNonNull(value, "value must be not null!"); TimestampBinary timestampBinary = tspSource.getTimeStampResponse(digestAlgorithm, value); if (timestampBinary != null && Utils.isArrayNotEmpty(timestampBinary.getBytes())) { LOG.info("Timestamp is obtained."); return toTimestampResponseDTO(timestampBinary); } throw new DSSException("The obtained TimestampToken response is null or empty!"); }  void setTSPSource(TSPSource tspSource); TimestampResponseDTO getTimestampResponse(final DigestAlgorithm digestAlgorithm, final byte[] value); }
RemoteTimestampService { public TimestampResponseDTO getTimestampResponse(final DigestAlgorithm digestAlgorithm, final byte[] value) throws DSSException { Objects.requireNonNull(tspSource, "TSPSource must be not null!"); LOG.info("Timestamp request in process..."); Objects.requireNonNull(digestAlgorithm, "digestAlgorithm must be not null!"); Objects.requireNonNull(value, "value must be not null!"); TimestampBinary timestampBinary = tspSource.getTimeStampResponse(digestAlgorithm, value); if (timestampBinary != null && Utils.isArrayNotEmpty(timestampBinary.getBytes())) { LOG.info("Timestamp is obtained."); return toTimestampResponseDTO(timestampBinary); } throw new DSSException("The obtained TimestampToken response is null or empty!"); }  void setTSPSource(TSPSource tspSource); TimestampResponseDTO getTimestampResponse(final DigestAlgorithm digestAlgorithm, final byte[] value);  }