Package org.bouncycastle.tsp

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


    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);
    post.setHeader(TimestampServlet.TRANSFER_ENCODING_HEADER, TimestampServlet.TRANSFER_ENCODING_BASE64);
View Full Code Here


  @Test
  public void testTimestamp() throws TSPException {
    KeystoreHandler keystore = KeystoreHelper.getP12Keystore();
   
    TimeStampRequestGenerator generator = new TimeStampRequestGenerator();
    TimeStampRequest timeStampRequest = generator.generate(
        TSPAlgorithms.SHA1, DigestHelper.digest("this is a test message"));
   
    TimeStampResponse response = null;
      response = new Timestamper(keystore).timestamp(timeStampRequest);
    Assert.assertNotNull("Timestamp Response should not be null", response);
View Full Code Here

  @Test(expected=TSPException.class)
  public void testTimestampValidateWithOtherRequest() throws TSPException {
    KeystoreHandler keystore = KeystoreHelper.getP12Keystore();
   
    TimeStampRequestGenerator generator = new TimeStampRequestGenerator();
    TimeStampRequest timeStampRequest = generator.generate(
        TSPAlgorithms.SHA1, DigestHelper.digest("this is a test message"));

    TimeStampRequest timeStampRequest2 = generator.generate(
        TSPAlgorithms.SHA1, DigestHelper.digest("this is a another test message"));
View Full Code Here

   
    TimeStampRequestGenerator generator = new TimeStampRequestGenerator();
    TimeStampRequest timeStampRequest = generator.generate(
        TSPAlgorithms.SHA1, DigestHelper.digest("this is a test message"));

    TimeStampRequest timeStampRequest2 = generator.generate(
        TSPAlgorithms.SHA1, DigestHelper.digest("this is a another test message"));

    TimeStampResponse response = null;
    response = new Timestamper(keystore).timestamp(timeStampRequest);
    Assert.assertNotNull("Timestamp Response should not be null", response);
View Full Code Here

      byte[] hash = ce.computeStringHash(myString, hashAlgorithm);
      TimeStampRequestGenerator reqGen = new TimeStampRequestGenerator();
      reqGen.setCertReq(true);

      // Se podr�an agregar condiciones para cambiar los TSPAlgorithms a SHA256, SHA384, SHA512, etc.
      TimeStampRequest tsReq = reqGen.generate(TSPAlgorithms.SHA1, hash, BigInteger.valueOf(100));
      // Se convierte objeto de TimeStampRequest a arreglo de bytes.
      byte[] tsData = tsReq.getEncoded();

      // Leemos contenido con InputStreamReader
      // URL para abrir conexi�n
View Full Code Here

        String requestPolicy = signatureConfig.getTspRequestPolicy();
        if (requestPolicy != null) {
            requestGenerator.setReqPolicy(new ASN1ObjectIdentifier(requestPolicy));
        }
        ASN1ObjectIdentifier digestAlgoOid = mapDigestAlgoToOID(signatureConfig.getTspDigestAlgo());
        TimeStampRequest request = requestGenerator.generate(digestAlgoOid, digest, nonce);
        byte[] encodedRequest = request.getEncoded();

        // create the HTTP POST request
        Proxy proxy = Proxy.NO_PROXY;
        if (signatureConfig.getProxyUrl() != null) {
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

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

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

    return request;
  }

  protected byte[] getResponseBytes(final byte[] responseBytes) throws IOException {
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

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.