Package java.security.cert

Examples of java.security.cert.CertificateFactory.generateCertPath()


            if (log.isInfoEnabled())
                log.info("Cannot validate from cacerts as the keystore failed to load.");
        } else {
            try {
                CertificateFactory certFact = CertificateFactory.getInstance("X.509");
                CertPath path = certFact.generateCertPath(Arrays.asList(chain));
                PKIXParameters params = new PKIXParameters(trustcacerts);
                params.setRevocationEnabled(false);
                CertPathValidator certPathValidator = CertPathValidator.getInstance(CertPathValidator.getDefaultType());
                CertPathValidatorResult result = certPathValidator.validate(path, params);
                PKIXCertPathValidatorResult pkixResult = (PKIXCertPathValidatorResult) result;
View Full Code Here


        if (trustcacerts == null) {
          throw new CertificateException("No trust store found!");
        } else {
            try {
                CertificateFactory certFact = CertificateFactory.getInstance("X.509");
                CertPath path = certFact.generateCertPath(Arrays.asList(chain));
                PKIXParameters params = new PKIXParameters(trustcacerts);
                params.setRevocationEnabled(false);
                CertPathValidator certPathValidator = CertPathValidator.getInstance(CertPathValidator.getDefaultType());
                CertPathValidatorResult result = certPathValidator.validate(path, params);
                PKIXCertPathValidatorResult pkixResult = (PKIXCertPathValidatorResult) result;
View Full Code Here

                abstractOutputProcessor.createCharactersAndOutputAsEvent(outputProcessorChain, new Base64(76, new byte[]{'\n'}).encodeToString(x509Certificates[0].getEncoded()));
            } else {
                try {
                    CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509", "BC");
                    List<X509Certificate> certificates = Arrays.asList(x509Certificates);
                    abstractOutputProcessor.createCharactersAndOutputAsEvent(outputProcessorChain, new Base64(76, new byte[]{'\n'}).encodeToString(certificateFactory.generateCertPath(certificates).getEncoded()));
                } catch (CertificateException e) {
                    throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e);
                } catch (NoSuchProviderException e) {
                    throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e);
                }
View Full Code Here

            {
                CertPath certPath;
                PKIXCertPathValidatorResult result;
                try
                {
                    certPath = cFact.generateCertPath(tbvPath);
                }
                catch (Exception e)
                {
                    throw new AnnotatedException(
                                            "Certification path could not be constructed from certificate list.",
View Full Code Here

                // chains
                CertPath certPath = null;
                PKIXCertPathValidatorResult result = null;
                try
                {
                    certPath = cFact.generateCertPath(tbvPath);
                }
                catch (Exception e)
                {
                    throw new AnnotatedException(
                        "Certification path could not be constructed from certificate list.",
View Full Code Here

        {
            CertificateFactory cFac = CertificateFactory.getInstance("X.509",
                    "BC");
            arr = os.toByteArray();
            is = new ByteArrayInputStream(arr);
            cFac.generateCertPath(is);
        }
        catch (CertificateException e)
        {
            // ignore okay
        }
View Full Code Here

        X509Certificate finalCert = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(finalCertBin));

            //Testing CertPath generation from List
        List list = new ArrayList();
        list.add(interCert);
        CertPath certPath1 = cf.generateCertPath(list);

            //Testing CertPath encoding as PkiPath
        byte[] encoded = certPath1.getEncoded("PkiPath");

            //Testing CertPath generation from InputStream
View Full Code Here

            //Testing CertPath encoding as PkiPath
        byte[] encoded = certPath1.getEncoded("PkiPath");

            //Testing CertPath generation from InputStream
        ByteArrayInputStream inStream = new ByteArrayInputStream(encoded);
        CertPath certPath2 = cf.generateCertPath(inStream, "PkiPath");

            //Comparing both CertPathes
        if (!certPath2.equals(certPath1))
        {
            fail("CertPath differ after encoding and decoding.");
View Full Code Here

        encoded = certPath1.getEncoded("PKCS7");

            //Testing CertPath generation from InputStream
        inStream = new ByteArrayInputStream(encoded);
        certPath2 = cf.generateCertPath(inStream, "PKCS7");

            //Comparing both CertPathes
        if (!certPath2.equals(certPath1))
        {
            fail("CertPath differ after encoding and decoding.");
View Full Code Here

        encoded = certPath1.getEncoded("PEM");

            //Testing CertPath generation from InputStream
        inStream = new ByteArrayInputStream(encoded);
        certPath2 = cf.generateCertPath(inStream, "PEM");

            //Comparing both CertPathes
        if (!certPath2.equals(certPath1))
        {
            fail("CertPath differ after encoding and decoding.");
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.