Package java.security.cert

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


                list.add(certs[i]);
            }
        }
        try {
            CertificateFactory factory = CertificateFactory.getInstance("X.509");
            CertPath path = factory.generateCertPath(list);
            return path.getEncoded();
        } catch (CertificateEncodingException e) {
            throw new WSSecurityException(
                WSSecurityException.SECURITY_TOKEN_UNAVAILABLE, "encodeError", null, e
            );
View Full Code Here


        try {
            // Generate cert path
            List certList = Arrays.asList(certs);
            CertificateFactory factory = CertificateFactory.getInstance("X.509");
            CertPath path = factory.generateCertPath(certList);

            // Use the certificates in the keystore as TrustAnchors
            PKIXParameters param = new PKIXParameters(this.keystore);

            // Do not check a revocation list
View Full Code Here

            for (int i = 0; i < certificates.length; i++) {
                list.add(certificates[i]);
            }
            CertificateFactory certificateFactory = CertificateFactory
                    .getInstance("X.509");
            certPath = certificateFactory.generateCertPath(list);

            X509Certificate firstCertificate = (X509Certificate) certificates[0];
            principal = new X500Principal(firstCertificate.getSubjectDN()
                    .getName());
View Full Code Here

        CertificateFactory factory = CertificateFactory.getInstance("X.509");

        ByteArrayInputStream bais = new ByteArrayInputStream(encoding);

        CertPath cert_path = factory.generateCertPath(bais);

        encoding = cert_path.getEncoded("PKCS7");

        X509CertPathImpl cpath = X509CertPathImpl
                .getInstance(encoding, "PKCS7");
View Full Code Here

        List certificates;
        for (int i=0; i<good.length; i++) {
            bais = new ByteArrayInputStream(
                    (good[i][0] + pkiPath + good[i][1]).getBytes("UTF-8"));

            certificates = factory.generateCertPath(bais).getCertificates();
            assertEquals("The size of the list differs from expected",
                    2, certificates.size());

            if (publicKey != null) {
                // verify the signatures
View Full Code Here

            bais = new ByteArrayInputStream(
                    (good[i][0] + pkiPath + good[i][1]).getBytes("UTF-8"));

            certificates =
                factory.generateCertPath(bais, "PkiPath").getCertificates();
            assertEquals("The size of the list differs from expected",
                    2, certificates.size());

            if (publicKey != null) {
                // verify the signatures
View Full Code Here

            bais = new ByteArrayInputStream(
                    (good[i][0] + pkcs7so + good[i][1]).getBytes("UTF-8"));

            certificates =
                factory.generateCertPath(bais, "PKCS7").getCertificates();
            assertEquals("The size of the list differs from expected",
                    2, certificates.size());

            if (publicKey != null) {
                // verify the signatures
View Full Code Here

        // testing empty PkiPath structure (ASN.1 such as 0x30, 0x00)
        bais = new ByteArrayInputStream(
                (good[0][0] + "MAB=" + good[0][1]).getBytes("UTF-8")); // "MABCDEFG"
        assertEquals("The size of the list differs from expected",
                0, factory.generateCertPath(bais, "PkiPath")
                                .getCertificates().size());

        // testing with bad PEM content
        for (int i=0; i<bad_content.length; i++) {
            bais = new ByteArrayInputStream(
View Full Code Here

        // testing with bad PEM content
        for (int i=0; i<bad_content.length; i++) {
            bais = new ByteArrayInputStream(
                    (good[0][0] + bad_content[i] + good[0][1]).getBytes("UTF-8"));
            try {
                factory.generateCertPath(bais);
                fail("Expected exception was not thrown");
            } catch (Exception e) { }
            bais = new ByteArrayInputStream(
                    (good[0][0] + bad_content[i] + good[0][1]).getBytes("UTF-8"));
            try {
View Full Code Here

                fail("Expected exception was not thrown");
            } catch (Exception e) { }
            bais = new ByteArrayInputStream(
                    (good[0][0] + bad_content[i] + good[0][1]).getBytes("UTF-8"));
            try {
                factory.generateCertPath(bais, "PkiPath");
                fail("Expected exception was not thrown");
            } catch (Exception e) { }
            bais = new ByteArrayInputStream(
                    (good[0][0] + bad_content[i] + good[0][1]).getBytes("UTF-8"));
            try {
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.