Package org.bouncycastle.tsp

Examples of org.bouncycastle.tsp.TimeStampResponse.validate()


   
    Assert.assertNotNull("Response content", responseBytes);
   
    responseBytes = Base64.decode(responseBytes);
    TimeStampResponse tsresponse = new TimeStampResponse(responseBytes);
    tsresponse.validate(timeStampRequest);
    tsresponse.validate(otherTimeStampRequest); // This will fail
  }
 

  @AfterClass
View Full Code Here


    Assert.assertNotNull("Response content", responseBytes);
   
    responseBytes = Base64.decode(responseBytes);
    TimeStampResponse tsresponse = new TimeStampResponse(responseBytes);
    tsresponse.validate(timeStampRequest);
    tsresponse.validate(otherTimeStampRequest); // This will fail
  }
 

  @AfterClass
  public static void stopServer() throws Exception {
View Full Code Here

    TimeStampResponse response = null;
      response = new Timestamper(keystore).timestamp(timeStampRequest);
    Assert.assertNotNull("Timestamp Response should not be null", response);
    Assert.assertNotNull("Timestamp token should not be null", response.getTimeStampToken());
   
    response.validate(timeStampRequest);
  }

 
  @Test(expected=TSPException.class)
  public void testTimestampValidateWithOtherRequest() throws TSPException {
View Full Code Here

    TimeStampResponse response = null;
    response = new Timestamper(keystore).timestamp(timeStampRequest);
    Assert.assertNotNull("Timestamp Response should not be null", response);
    Assert.assertNotNull("Timestamp token should not be null", response.getTimeStampToken());
   
    response.validate(timeStampRequest);
    response.validate(timeStampRequest2);
  }
 

View Full Code Here

    response = new Timestamper(keystore).timestamp(timeStampRequest);
    Assert.assertNotNull("Timestamp Response should not be null", response);
    Assert.assertNotNull("Timestamp token should not be null", response.getTimeStampToken());
   
    response.validate(timeStampRequest);
    response.validate(timeStampRequest2);
  }
 


}
View Full Code Here

            input.close();
          }

          try {
            TimeStampResponse timeStampResponse = new TimeStampResponse(buffer);
            timeStampResponse.validate(tsReq);
            System.out.println(timeStampValidatedSuccess);
          }
          catch (TSPValidationException e) {
            System.out.println(timeStampValidatedFailed);
            e.printStackTrace();
View Full Code Here

            throw new RuntimeException("Content-Length is zero");
        }

        // TSP response parsing and validation
        TimeStampResponse timeStampResponse = new TimeStampResponse(bos.toByteArray());
        timeStampResponse.validate(request);

        if (0 != timeStampResponse.getStatus()) {
            LOG.log(POILogger.DEBUG, "status: " + timeStampResponse.getStatus());
            LOG.log(POILogger.DEBUG, "status string: " + timeStampResponse.getStatusString());
            PKIFailureInfo failInfo = timeStampResponse.getFailInfo();
View Full Code Here

    try {
      TimeStampRequest timeStampRequest = new TimeStampRequest(request);
      TimeStampResponseGenerator timeStampResponseGenerator = new TimeStampResponseGenerator(this.timeStampTokenGenerator, TSPAlgorithms.ALLOWED);
      TimeStampResponse timeStampResponse = timeStampResponseGenerator.generate(timeStampRequest, this.getSerialNumber(), new Date());

      timeStampResponse.validate(timeStampRequest);

      return timeStampResponse.getEncoded();
    } catch (Exception e) {
      throw new TimeStampException(e);
    }
View Full Code Here

    try {
      TimeStampRequest timeStampRequest = new TimeStampRequest(request);
      TimeStampResponseGenerator timeStampResponseGenerator = new TimeStampResponseGenerator(this.timeStampTokenGenerator, TSPAlgorithms.ALLOWED);
      TimeStampResponse timeStampResponse = timeStampResponseGenerator.generate(timeStampRequest, this.getSerialNumber(), new Date());

      timeStampResponse.validate(timeStampRequest);

      return timeStampResponse.getEncoded();
    } catch (Exception e) {
      throw new TimeStampException(e);
    }
View Full Code Here

  }

  protected TimeStampResponse getTimeStampResponse(final TimeStampRequest request, final byte[] responseBytes) throws IOException, TSPException {
    TimeStampResponse response = new TimeStampResponse(responseBytes);

    response.validate(request);
    PKIFailureInfo failure = response.getFailInfo();

    if ((failure != null) && (failure.intValue() != 0)) {
      throw new IllegalStateException("Failure Status " + failure.intValue());
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.