Package org.jscep.transport

Examples of org.jscep.transport.Transport


    return new URL("http", "localhost", port, PATH);
  }

  private X509Certificate getRecipient() throws Exception {
    GetCaCertRequest req = new GetCaCertRequest();
    Transport transport = new HttpGetTransport(getURL());

    CertStore store = transport.sendRequest(req,
        new GetCaCertResponseHandler());
    Collection<? extends Certificate> certs = store.getCertificates(null);

    if (certs.size() > 0) {
      return (X509Certificate) certs.iterator().next();
View Full Code Here


  }

  @Test
  public void testGetCaCaps() throws Exception {
    GetCaCapsRequest req = new GetCaCapsRequest();
    Transport transport = new HttpGetTransport(getURL());
    Capabilities caps = transport.sendRequest(req,
        new GetCaCapsResponseHandler());

    System.out.println(caps);
  }
View Full Code Here

  }

  @Test
  public void getNextCaCertificateGood() throws Exception {
    GetNextCaCertRequest req = new GetNextCaCertRequest(goodIdentifier);
    Transport transport = new HttpGetTransport(getURL());
    CertStore certs = transport.sendRequest(req,
        new GetNextCaCertResponseHandler(getRecipient()));

    assertThat(certs.getCertificates(null).size(), is(1));
  }
View Full Code Here

  }

  @Test(expected = TransportException.class)
  public void getNextCaCertificateBad() throws Exception {
    GetNextCaCertRequest req = new GetNextCaCertRequest(badIdentifier);
    Transport transport = new HttpGetTransport(getURL());
    CertStore certs = transport.sendRequest(req,
        new GetNextCaCertResponseHandler(getRecipient()));

    assertThat(certs.getCertificates(null).size(), is(1));
  }
View Full Code Here

    PkcsPkiEnvelopeDecoder envDecoder = new PkcsPkiEnvelopeDecoder(sender,
        priKey);
    PkiMessageDecoder decoder = new PkiMessageDecoder(getRecipient(),
        envDecoder);

    Transport transport = new HttpGetTransport(getURL());
    Transaction t = new NonEnrollmentTransaction(transport, encoder,
        decoder, iasn, MessageType.GET_CRL);
    State s = t.send();

    assertThat(s, is(State.CERT_ISSUED));
View Full Code Here

    PkcsPkiEnvelopeDecoder envDecoder = new PkcsPkiEnvelopeDecoder(sender,
        priKey);
    PkiMessageDecoder decoder = new PkiMessageDecoder(getRecipient(),
        envDecoder);

    Transport transport = new HttpGetTransport(getURL());
    Transaction t = new NonEnrollmentTransaction(transport, encoder,
        decoder, iasn, MessageType.GET_CERT);
    State s = t.send();

    assertThat(s, is(State.CERT_NON_EXISTANT));
View Full Code Here

    PkcsPkiEnvelopeDecoder envDecoder = new PkcsPkiEnvelopeDecoder(sender,
        priKey);
    PkiMessageDecoder decoder = new PkiMessageDecoder(getRecipient(),
        envDecoder);

    Transport transport = new HttpGetTransport(getURL());
    Transaction t = new EnrollmentTransaction(transport, encoder, decoder,
        csr);

    State s = t.send();
    assertThat(s, is(State.CERT_ISSUED));
View Full Code Here

    PkcsPkiEnvelopeDecoder envDecoder = new PkcsPkiEnvelopeDecoder(sender,
        priKey);
    PkiMessageDecoder decoder = new PkiMessageDecoder(getRecipient(),
        envDecoder);

    Transport transport = new HttpGetTransport(getURL());
    Transaction t = new EnrollmentTransaction(transport, encoder, decoder,
        csr);

    State s = t.send();
    assertThat(s, is(State.CERT_ISSUED));
View Full Code Here

    PkcsPkiEnvelopeDecoder envDecoder = new PkcsPkiEnvelopeDecoder(sender,
        priKey);
    PkiMessageDecoder decoder = new PkiMessageDecoder(getRecipient(),
        envDecoder);

    Transport transport = new HttpGetTransport(getURL());
    EnrollmentTransaction trans = new EnrollmentTransaction(transport,
        encoder, decoder, csr);
    State state = trans.send();
    assertThat(state, is(State.CERT_REQ_PENDING));
View Full Code Here

   */
  public Capabilities getCaCapabilities(final String profile) {
    LOGGER.debug("Determining capabilities of SCEP server");
    // NON-TRANSACTIONAL
    final GetCaCapsRequest req = new GetCaCapsRequest(profile);
    final Transport trans = new HttpGetTransport(url);
    try {
      return trans.sendRequest(req, new GetCaCapsResponseHandler());
    } catch (TransportException e) {
      LOGGER.warn("Transport problem when determining capabilities.  Using empty capabilities.");
      return new Capabilities();
    }
  }
View Full Code Here

TOP

Related Classes of org.jscep.transport.Transport

Copyright © 2018 www.massapicom. 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.