use of xades4j.providers.TimeStampTokenProvider.TimeStampTokenRes in project xades4j by luisgoncalves.
the class DataGenBaseTimeStamp method generatePropertyData.
@Override
public final PropertyDataObject generatePropertyData(TProp prop, PropertiesDataGenerationContext ctx) throws PropertyDataGenerationException {
Algorithm c14n = this.algsProvider.getCanonicalizationAlgorithmForTimeStampProperties();
try {
TimeStampDigestInput digestInput = this.tsInputFactory.newTimeStampDigestInput(c14n);
addPropSpecificTimeStampInput(prop, digestInput, ctx);
TimeStampTokenRes tsTknRes = this.tsTokenProvider.getTimeStampToken(digestInput.getBytes(), this.algsProvider.getDigestAlgorithmForTimeStampProperties());
return createPropDataObj(prop, c14n, tsTknRes, ctx);
} catch (UnsupportedAlgorithmException ex) {
throw new PropertyDataGenerationException(prop, ex.getMessage(), ex);
} catch (CannotAddDataToDigestInputException ex) {
throw new PropertyDataGenerationException(prop, "cannot create time stamp input", ex);
} catch (TimeStampTokenGenerationException ex) {
throw new PropertyDataGenerationException(prop, "cannot get a time-stamp", ex);
}
}
use of xades4j.providers.TimeStampTokenProvider.TimeStampTokenRes in project xades4j by luisgoncalves.
the class HttpTimeStampTokenProviderTest method testGetTimeStampToken.
@Test
public void testGetTimeStampToken() throws Exception {
System.out.println("getTimeStampToken");
byte[] tsDigestInput = "TestDigestInput".getBytes();
String digestAlgUri = MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA1;
HttpTimeStampTokenProvider instance = new HttpTimeStampTokenProvider(new DefaultMessageDigestProvider(), new TSAHttpData("http://tss.accv.es:8318/tsa"));
TimeStampTokenRes result = instance.getTimeStampToken(tsDigestInput, digestAlgUri);
assertNotNull(result);
assertNotNull(result.encodedTimeStampToken);
assertNotNull(result.timeStampTime);
}
Aggregations