Package java.security.cert

Examples of java.security.cert.CertStore


  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();
    } else {
      return null;
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

      Certificate[] chain = testStore
        .getCertificateChain((String) config[0]);
      List<Certificate> certList = Arrays.asList(chain);
      CertStoreParameters storeParams = new CollectionCertStoreParameters(
        certList);
      CertStore store = CertStore.getInstance("Collection", storeParams);

      config[0] = store;
      config[1] = "CN=" + config[1];
      config[2] = "CN=" + config[2];
      config[3] = "CN=" + config[3];
View Full Code Here

      } else if (response.isSuccess()) {
        // The entity has been enrolled
        System.out.println("Success!");
 
        // Convert the store to a certificate chain
        CertStore store = response.getCertStore();
        Collection<? extends Certificate> certs = store
            .getCertificates(null);
        Certificate[] chain = new Certificate[certs.size()];
 
        int i = 0;
        for (Certificate certificate : certs) {
View Full Code Here

                        "Exception searching in X.509 CRL store.", e);
                }
            }
            else
            {
                CertStore store = (CertStore)obj;

                try
                {
                    crls.addAll(store.getCRLs(crlSelect));
                    foundValidStore = true;
                }
                catch (CertStoreException e)
                {
                    lastException = new AnnotatedException(
View Full Code Here

                        "Problem while picking certificates from X.509 store.", e);
                }
            }
            else
            {
                CertStore certStore = (CertStore)obj;

                try
                {
                    certs.addAll(certStore.getCertificates(certSelect));
                }
                catch (CertStoreException e)
                {
                    throw new AnnotatedException(
                        "Problem while picking certificates from certificate store.",
View Full Code Here

    private static AssertionResult verifySignature(SMIMEAssertionTestElement testElement, SMIMESignedParser s, String name)
            throws CMSException {
        AssertionResult res = new AssertionResult(name);

        try {
            CertStore certs = s.getCertificatesAndCRLs("Collection", "BC"); // $NON-NLS-1$  // $NON-NLS-2$
            SignerInformationStore signers = s.getSignerInfos();
            Iterator<?> signerIt = signers.getSigners().iterator();

            if (signerIt.hasNext()) {

                SignerInformation signer = (SignerInformation) signerIt.next();
                Iterator<?> certIt = certs.getCertificates(signer.getSID()).iterator();

                if (certIt.hasNext()) {
                    // the signer certificate
                    X509Certificate cert = (X509Certificate) certIt.next();
View Full Code Here

    // NON-TRANSACTIONAL
    // CA and RA public key distribution
    final GetCaCertRequest req = new GetCaCertRequest(profile);
    final Transport trans = new HttpGetTransport(url);

    CertStore store;
    try {
      store = trans.sendRequest(req, new GetCaCertResponseHandler());
    } catch (TransportException e) {
      throw new ClientException(e);
    }
View Full Code Here

    LOGGER.debug("Retriving next CA certificate from CA");
    // NON-TRANSACTIONAL
    if (!getCaCapabilities(profile).isRolloverSupported()) {
      throw new UnsupportedOperationException();
    }
    final CertStore store = getCaCertificate(profile);
    // The CA or RA
    CertStoreInspector certs = CertStoreInspector.getInstance(store);
    final X509Certificate signer = certs.getSigner();

    final Transport trans = new HttpGetTransport(url);
View Full Code Here

TOP

Related Classes of java.security.cert.CertStore

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.