Examples of CertPathBuilderResult


Examples of java.security.cert.CertPathBuilderResult

            throw (NoSuchProviderException) new NoSuchProviderException(
                    "The certProvider " + certProvider
                            + " is not found in the environment.").initCause(e);
        }

        CertPathBuilderResult bldResult = null;
        try {
            // the actual building of the certificate chain is done here
            bldResult = cpBuilder.build(builderParam);
        } catch (CertPathBuilderException e) {
            throw new CertPathBuilderException(strFailed, e);
View Full Code Here

Examples of java.security.cert.CertPathBuilderResult

        Collection selfSignedTAsCerts = trustedSeparated[2];

        String certProvider = (param.getCertProvider() != null) ? param
                .getCertProvider() : param.getProvider();

        CertPathBuilderResult bldResult = buildCertPath(certProvider, newCert,
                selfSignedTAs, trustedCerts);

        // The validation of the certificate path.
        // According to black-box testing, RI keytool doesn't perform
        // the certificate path validation procedure. Therefore this
        // implementation also doesn't validate the certificate chain
        // The path validation procedure can be done in future as an
        // extension of the current functionality.

        // The imported certificate should be included in the chain;
        // The root CA is not included in it.
        X509Certificate[] newChainNoCA = (X509Certificate[]) bldResult
                .getCertPath().getCertificates()
                .toArray(new X509Certificate[0]);

        // get the subject of the root CA which will be the last element of the
        // chain
View Full Code Here

Examples of java.security.cert.CertPathBuilderResult

            throw (NoSuchProviderException) new NoSuchProviderException(
                    "The certProvider " + certProvider
                            + " is not found in the environment.").initCause(e);
        }

        CertPathBuilderResult bldResult = null;
        try {
            // the actual building of the certificate chain is done here
            bldResult = cpBuilder.build(builderParam);
        } catch (CertPathBuilderException e) {
            throw new CertPathBuilderException(strFailed, e);
View Full Code Here

Examples of java.security.cert.CertPathBuilderResult

        PKIXBuilderParameters params = new PKIXBuilderParameters(trustedStore, xcs);
        params.addCertStore(store);
        params.setRevocationEnabled(false);
       
        try {
            CertPathBuilderResult result = pathBuilder.build(params);
            CertPath path = result.getCertPath();
            return path;
        } catch (CertPathBuilderException e) {
            // A certification path is not found, so null is returned.
            return null;
        } catch (InvalidAlgorithmParameterException e) {
View Full Code Here

Examples of java.security.cert.CertPathBuilderResult

        PKIXBuilderParameters params = new PKIXBuilderParameters(trustedStore, xcs);
        params.addCertStore(store);
        params.setRevocationEnabled(false);
       
        try {
            CertPathBuilderResult result = pathBuilder.build(params);
            CertPath path = result.getCertPath();
            return path;
        } catch (CertPathBuilderException e) {
            // A certification path is not found, so null is returned.
            return null;
        } catch (InvalidAlgorithmParameterException e) {
View Full Code Here

Examples of java.security.cert.CertPathBuilderResult

     */
    protected static CertPath processAttrCert1(
        X509AttributeCertificate attrCert, ExtendedPKIXParameters pkixParams)
        throws CertPathValidatorException
    {
        CertPathBuilderResult result = null;
        // find holder PKCs
        Set holderPKCs = new HashSet();
        if (attrCert.getHolder().getIssuer() != null)
        {
            X509CertStoreSelector selector = new X509CertStoreSelector();
            selector.setSerialNumber(attrCert.getHolder().getSerialNumber());
            Principal[] principals = attrCert.getHolder().getIssuer();
            for (int i = 0; i < principals.length; i++)
            {
                try
                {
                    if (principals[i] instanceof X500Principal)
                    {
                        selector.setIssuer(((X500Principal)principals[i])
                            .getEncoded());
                    }
                    holderPKCs.addAll(CertPathValidatorUtilities
                        .findCertificates(selector, pkixParams.getStores()));
                }
                catch (AnnotatedException e)
                {
                    throw new ExtCertPathValidatorException(
                        "Public key certificate for attribute certificate cannot be searched.",
                        e);
                }
                catch (IOException e)
                {
                    throw new ExtCertPathValidatorException(
                        "Unable to encode X500 principal.", e);
                }
            }
            if (holderPKCs.isEmpty())
            {
                throw new CertPathValidatorException(
                    "Public key certificate specified in base certificate ID for attribute certificate cannot be found.");
            }
        }
        if (attrCert.getHolder().getEntityNames() != null)
        {
            X509CertStoreSelector selector = new X509CertStoreSelector();
            Principal[] principals = attrCert.getHolder().getEntityNames();
            for (int i = 0; i < principals.length; i++)
            {
                try
                {
                    if (principals[i] instanceof X500Principal)
                    {
                        selector.setIssuer(((X500Principal) principals[i])
                            .getEncoded());
                    }
                    holderPKCs.addAll(CertPathValidatorUtilities
                        .findCertificates(selector, pkixParams.getStores()));
                }
                catch (AnnotatedException e)
                {
                    throw new ExtCertPathValidatorException(
                        "Public key certificate for attribute certificate cannot be searched.",
                        e);
                }
                catch (IOException e)
                {
                    throw new ExtCertPathValidatorException(
                        "Unable to encode X500 principal.", e);
                }
            }
            if (holderPKCs.isEmpty())
            {
                throw new CertPathValidatorException(
                    "Public key certificate specified in entity name for attribute certificate cannot be found.");
            }
        }
        // verify cert paths for PKCs
        ExtendedPKIXBuilderParameters params = (ExtendedPKIXBuilderParameters) ExtendedPKIXBuilderParameters
            .getInstance(pkixParams);
        CertPathValidatorException lastException = null;
        for (Iterator it = holderPKCs.iterator(); it.hasNext();)
        {
            X509CertStoreSelector selector = new X509CertStoreSelector();
            selector.setCertificate((X509Certificate) it.next());
            params.setTargetConstraints(selector);
            CertPathBuilder builder = null;
            try
            {
                builder = CertPathBuilder.getInstance("PKIX", "BC");
            }
            catch (NoSuchProviderException e)
            {
                throw new ExtCertPathValidatorException(
                    "Support class could not be created.", e);
            }
            catch (NoSuchAlgorithmException e)
            {
                throw new ExtCertPathValidatorException(
                    "Support class could not be created.", e);
            }
            try
            {
                result = builder.build(ExtendedPKIXBuilderParameters
                    .getInstance(params));
            }
            catch (CertPathBuilderException e)
            {
                lastException = new ExtCertPathValidatorException(
                    "Certification path for public key certificate of attribute certificate could not be build.",
                    e);
            }
            catch (InvalidAlgorithmParameterException e)
            {
                // must be a programming error
                throw new RuntimeException(e.getMessage());
            }
        }
        if (lastException != null)
        {
            throw lastException;
        }
        return result.getCertPath();
    }
View Full Code Here

Examples of java.security.cert.CertPathBuilderResult

        {
            throw new CertPathBuilderException(
                    "No attribute certificate found matching targetContraints.");
        }

        CertPathBuilderResult result = null;

        // check all potential target certificates
        targetIter = targets.iterator();
        while (targetIter.hasNext() && result == null)
        {
View Full Code Here

Examples of java.security.cert.CertPathBuilderResult

        tbvPath.add(tbvCert);

        CertificateFactory cFact;
        CertPathValidator validator;
        CertPathBuilderResult builderResult = null;

        try
        {
            cFact = CertificateFactory.getInstance("X.509", "BC");
            validator = CertPathValidator.getInstance("RFC3281", "BC");
View Full Code Here

Examples of java.security.cert.CertPathBuilderResult

  params.addCertStore( CertStore.getInstance( "Collection", intermediates ) );
 
  params.setRevocationEnabled( false );
 
  CertPathBuilder builder = CertPathBuilder.getInstance( "PKIX" );
  CertPathBuilderResult result = builder.build( params );
  return true;
  }
catch( Exception e )
  {
  return false;
View Full Code Here

Examples of java.security.cert.CertPathBuilderResult

        {
            throw new CertPathBuilderException(
                    "No attribute certificate found matching targetContraints.");
        }

        CertPathBuilderResult result = null;

        // check all potential target certificates
        targetIter = targets.iterator();
        while (targetIter.hasNext() && result == null)
        {
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.