Package org.bouncycastle.tsp

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


        TimeStampResponse response;
        try
        {
            response = new TimeStampResponse(tsaResponse);
            response.validate(request);
        }
        catch (TSPException e)
        {
            throw new IOException(e);
        }
View Full Code Here


           
            // Handle the TSA response
            TimeStampResponse response = new TimeStampResponse(respBytes);
           
            // validate communication level attributes (RFC 3161 PKIStatus)
            response.validate(request);
            PKIFailureInfo failure = response.getFailInfo();
            int value = (failure == null) ? 0 : failure.intValue();
            if (value != 0) {
                // @todo: Translate value of 15 error codes defined by PKIFailureInfo to string
                throw new IOException(MessageLocalization.getComposedMessage("invalid.tsa.1.response.code.2", tsaURL, String.valueOf(value)));
View Full Code Here

      }

      if (replyBytes != null) {
        try {
          TimeStampResponse timeStampResponse = new TimeStampResponse(replyBytes);
          timeStampResponse.validate(timeStampRequest);
        } catch (TSPValidationException e) {
          LogLog.error("TimeStampResponse validation failed.", e);
          e.printStackTrace();
        } catch (TSPException e) {
          LogLog.error("TimeStampResponse failed.", e);
View Full Code Here

           
            // Handle the TSA response
            TimeStampResponse response = new TimeStampResponse(respBytes);
           
            // validate communication level attributes (RFC 3161 PKIStatus)
            response.validate(request);
            PKIFailureInfo failure = response.getFailInfo();
            int value = (failure == null) ? 0 : failure.intValue();
            if (value != 0) {
                // @todo: Translate value of 15 error codes defined by PKIFailureInfo to string
                throw new IOException(MessageLocalization.getComposedMessage("invalid.tsa.1.response.code.2", tsaURL, String.valueOf(value)));
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

    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

    byte[] responseBytes = new byte[(int)responseEntity.getContentLength()];
    responseEntity.getContent().read(responseBytes);
   
    Assert.assertNotNull("Response content", responseBytes);
    TimeStampResponse tsresponse = new TimeStampResponse(responseBytes);
    tsresponse.validate(timeStampRequest);
  }
 
 
  @Test
  public void testServletRequestInBase64ModeWorks() throws IOException, TSPException {
View Full Code Here

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

 
  @Test
  public void binaryStressTest() throws IOException, TSPException {
View Full Code Here

      byte[] responseBytes = new byte[(int)responseEntity.getContentLength()];
      responseEntity.getContent().read(responseBytes);
     
      Assert.assertNotNull("Response content", responseBytes);
      TimeStampResponse tsresponse = new TimeStampResponse(responseBytes);
      tsresponse.validate(timeStampRequest);
    }
  }
 

  @Test
View Full Code Here

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

 
  @Test(expected=TSPException.class)
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.