Package org.bouncycastle.tsp

Examples of org.bouncycastle.tsp.TimeStampRequestGenerator.generate()


        // generate TSA request
        TimeStampRequestGenerator tsaGenerator = new TimeStampRequestGenerator();
        tsaGenerator.setCertReq(true);
        ASN1ObjectIdentifier oid = getHashObjectIdentifier(digest.getAlgorithm());
        TimeStampRequest request = tsaGenerator.generate(oid, hash, BigInteger.valueOf(nonce));

        // get TSA response
        byte[] tsaResponse = getTSAResponse(request.getEncoded());

        TimeStampResponse response;
View Full Code Here


            // Setup the time stamp request
            TimeStampRequestGenerator tsqGenerator = new TimeStampRequestGenerator();
            tsqGenerator.setCertReq(true);
            // tsqGenerator.setReqPolicy("1.3.6.1.4.1.601.10.3.1");
            BigInteger nonce = BigInteger.valueOf(System.currentTimeMillis());
            TimeStampRequest request = tsqGenerator.generate(new ASN1ObjectIdentifier(DigestAlgorithms.getAllowedDigests(digestAlgorithm)), imprint, nonce);
            byte[] requestBytes = request.getEncoded();
           
            // Call the communications layer
            respBytes = getTSAResponse(requestBytes);
           
View Full Code Here

        digestBytes = FileTools.readFiletoBuffer(infile);
      }
      MessageDigest dig = MessageDigest.getInstance(TSPAlgorithms.SHA1, "BC");
      dig.update(digestBytes);
      byte[] digest = dig.digest();
      TimeStampRequest timeStampRequest = timeStampRequestGenerator.generate(TSPAlgorithms.SHA1, digest, BigInteger.valueOf(nonce));

      // create a singular HttpClient object
      HttpClient client = new HttpClient();

      //establish a connection within 5 seconds
View Full Code Here

            // Setup the time stamp request
            TimeStampRequestGenerator tsqGenerator = new TimeStampRequestGenerator();
            tsqGenerator.setCertReq(true);
            // tsqGenerator.setReqPolicy("1.3.6.1.4.1.601.10.3.1");
            BigInteger nonce = BigInteger.valueOf(System.currentTimeMillis());
            TimeStampRequest request = tsqGenerator.generate(new ASN1ObjectIdentifier(DigestAlgorithms.getAllowedDigests(digestAlgorithm)), imprint, nonce);
            byte[] requestBytes = request.getEncoded();
           
            // Call the communications layer
            respBytes = getTSAResponse(requestBytes);
           
View Full Code Here

    TimeStampRequestGenerator generator = new TimeStampRequestGenerator();
    generator.setCertReq(true);

    BigInteger nonce = BigInteger.valueOf(System.currentTimeMillis());
    TimeStampRequest request = generator.generate(BouncyCastleTimeStampClient.RSA_OID, digest, nonce);

    return request;
  }

}
View Full Code Here

    CloseableHttpClient client = builder.build();
    HttpHost host = new HttpHost(hostname, port);
    HttpPost post = new HttpPost("/tsa");
   
    TimeStampRequestGenerator generator = new TimeStampRequestGenerator();
    TimeStampRequest timeStampRequest = generator.generate(TSPAlgorithms.SHA1, DigestHelper.digest("this is a test message"));
   
    ByteArrayEntity entity = new ByteArrayEntity(timeStampRequest.getEncoded());
   
    post.setHeader("Content-Type", TimestampServlet.TIMESTAMP_QUERY_CONTENT_TYPE);
    post.setHeader(TimestampServlet.TRANSFER_ENCODING_HEADER, TimestampServlet.TRANSFER_ENCODING_BINARY);
View Full Code Here

    CloseableHttpClient client = builder.build();
    HttpHost host = new HttpHost(hostname, port);
    HttpPost post = new HttpPost("/tsa");
   
    TimeStampRequestGenerator generator = new TimeStampRequestGenerator();
    TimeStampRequest timeStampRequest = generator.generate(TSPAlgorithms.SHA1, DigestHelper.digest("this is a test message"));
   
    ByteArrayEntity entity = new ByteArrayEntity(Base64.encode(timeStampRequest.getEncoded()));
   
    post.setHeader("Content-Type", TimestampServlet.TIMESTAMP_QUERY_CONTENT_TYPE);
    post.setHeader(TimestampServlet.TRANSFER_ENCODING_HEADER, TimestampServlet.TRANSFER_ENCODING_BASE64);
View Full Code Here

    CloseableHttpClient client = builder.build();
    HttpHost host = new HttpHost(hostname, port);
   
    for (int i = 0; i < maxStress; i++) {
      TimeStampRequestGenerator generator = new TimeStampRequestGenerator();
      TimeStampRequest timeStampRequest = generator.generate(TSPAlgorithms.SHA1, DigestHelper.digest("this is a test message " + i));
     
      ByteArrayEntity entity = new ByteArrayEntity(timeStampRequest.getEncoded());
     
      HttpPost post = new HttpPost("/tsa");
      post.setHeader("Content-Type", TimestampServlet.TIMESTAMP_QUERY_CONTENT_TYPE);
View Full Code Here

   
    for (int i = 0; i < maxStress; i++) {
      HttpPost post = new HttpPost("/tsa");
     
      TimeStampRequestGenerator generator = new TimeStampRequestGenerator();
      TimeStampRequest timeStampRequest = generator.generate(TSPAlgorithms.SHA1, DigestHelper.digest("this is a test message " + i));
     
      ByteArrayEntity entity = new ByteArrayEntity(Base64.encode(timeStampRequest.getEncoded()));
     
      post.setHeader("Content-Type", TimestampServlet.TIMESTAMP_QUERY_CONTENT_TYPE);
      post.setHeader(TimestampServlet.TRANSFER_ENCODING_HEADER, TimestampServlet.TRANSFER_ENCODING_BASE64);
View Full Code Here

    CloseableHttpClient client = builder.build();
    HttpHost host = new HttpHost(hostname, port);
    HttpPost post = new HttpPost("/tsa");
   
    TimeStampRequestGenerator generator = new TimeStampRequestGenerator();
    TimeStampRequest timeStampRequest = generator.generate(TSPAlgorithms.SHA1, DigestHelper.digest("this is a test message"));
    TimeStampRequest otherTimeStampRequest = generator.generate(TSPAlgorithms.SHA1, DigestHelper.digest("this is another test message"));
   
    ByteArrayEntity entity = new ByteArrayEntity(Base64.encode(timeStampRequest.getEncoded()));
   
    post.setHeader("Content-Type", TimestampServlet.TIMESTAMP_QUERY_CONTENT_TYPE);
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.