Package org.jscep.transport.response

Examples of org.jscep.transport.response.Capabilities


  Assert.assertTrue(caps.isRenewalSupported());
    }

    @Test
    public void testNextCANotSupported() {
  Capabilities caps = new Capabilities();
  Assert.assertFalse(caps.isRolloverSupported());
    }
View Full Code Here


  Assert.assertFalse(caps.isRolloverSupported());
    }

    @Test
    public void testNextCASupported() {
  Capabilities caps = new Capabilities(Capability.GET_NEXT_CA_CERT);
  Assert.assertTrue(caps.isRolloverSupported());
    }
View Full Code Here

  Assert.assertTrue(caps.isRolloverSupported());
    }

    @Test
    public void testContains() {
  Capabilities caps = new Capabilities(Capability.GET_NEXT_CA_CERT);
  assertTrue(caps.contains(Capability.GET_NEXT_CA_CERT));
    }
View Full Code Here

    public void testNoAlgorithmSupportYieldsDefaultCipher() {
  Provider[] providers = Security.getProviders();
  for (Provider provider : providers) {
      Security.removeProvider(provider.getName());
  }
  Capabilities caps = new Capabilities(Capability.TRIPLE_DES);
  assertThat(caps.getStrongestCipher(), is("DES"));

  for (Provider provider : providers) {
      Security.addProvider(provider);
  }
    }
View Full Code Here

    public void testNoAlgorithmSupportYieldsDefaultDigest() {
  Provider[] providers = Security.getProviders();
  for (Provider provider : providers) {
      Security.removeProvider(provider.getName());
  }
  Capabilities caps = new Capabilities(Capability.SHA_512);
  assertThat(caps.getStrongestMessageDigest(), is(nullValue()));

  for (Provider provider : providers) {
      Security.addProvider(provider);
  }
    }
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

      // place in production code.
      DefaultCallbackHandler handler = new DefaultCallbackHandler(
          new OptimisticCertificateVerifier());
      Client client = new Client(getUrl(), handler);
      // Get the capabilities of the SCEP server
      Capabilities caps = client.getCaCapabilities();
 
      // We construct a Bouncy Castle digital signature provider early on,
      // so it can be reused later.
      JcaContentSignerBuilder signerBuilder;
      if (caps.contains(Capability.SHA_1)) {
        signerBuilder = new JcaContentSignerBuilder("SHA1withRSA");
      } else {
        signerBuilder = new JcaContentSignerBuilder("MD5withRSA");
      }
 
View Full Code Here

    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

  }

  private PkiMessageEncoder getEncoder(X509Certificate identity,
      PrivateKey priKey, String profile) throws ClientException {
    CertStore store = getCaCertificate(profile);
    Capabilities caps = getCaCapabilities(profile);
    CertStoreInspector certs = CertStoreInspector.getInstance(store);
    X509Certificate recipientCertificate = certs.getRecipient();
    PkcsPkiEnvelopeEncoder envEncoder = new PkcsPkiEnvelopeEncoder(
        recipientCertificate, caps.getStrongestCipher());

    String sigAlg = caps.getStrongestSignatureAlgorithm();
    return new PkiMessageEncoder(priKey, identity, envEncoder, sigAlg);
  }
View Full Code Here

TOP

Related Classes of org.jscep.transport.response.Capabilities

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.