Examples of generateCertificate()


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

        exceptionPlease(STRICT, "foo.co.jp", x509);
        exceptionPlease(DEFAULT, "\u82b1\u5b50.co.jp", x509);
        exceptionPlease(STRICT, "\u82b1\u5b50.co.jp", x509);

        in = new ByteArrayInputStream(X509_WILD_FOO_BAR_HANAKO);
        x509 = (X509Certificate) cf.generateCertificate(in);
        // try the foo.com variations
        exceptionPlease(DEFAULT, "foo.com", x509);
        exceptionPlease(STRICT, "foo.com", x509);
        DEFAULT.verify("www.foo.com", x509);
        STRICT.verify("www.foo.com", x509);
View Full Code Here

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

    }

    public void testSubjectAlt() throws Exception {
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
        InputStream in = new ByteArrayInputStream(X509_MULTIPLE_SUBJECT_ALT);
        X509Certificate x509 = (X509Certificate) cf.generateCertificate(in);
       
        X509HostnameVerifier verifier = SSLSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER;
       
        assertEquals("CN=localhost, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=CH",
                x509.getSubjectDN().getName());
View Full Code Here

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

        InputStream in1, in2, in3;
        in1 = new ByteArrayInputStream(X509_FOO);
        in2 = new ByteArrayInputStream(X509_INTERMEDIATE_CA);
        in3 = new ByteArrayInputStream(X509_ROOT_CA);
        X509Certificate[] chain = new X509Certificate[3];
        chain[0] = (X509Certificate) cf.generateCertificate(in1);
        chain[1] = (X509Certificate) cf.generateCertificate(in2);
        chain[2] = (X509Certificate) cf.generateCertificate(in3);

        ks.setKeyEntry("RSA_KEY", pk, pwd, chain);
        ks.setCertificateEntry("CERT", chain[2]); // Let's trust ourselves. :-)
View Full Code Here

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

        in1 = new ByteArrayInputStream(X509_FOO);
        in2 = new ByteArrayInputStream(X509_INTERMEDIATE_CA);
        in3 = new ByteArrayInputStream(X509_ROOT_CA);
        X509Certificate[] chain = new X509Certificate[3];
        chain[0] = (X509Certificate) cf.generateCertificate(in1);
        chain[1] = (X509Certificate) cf.generateCertificate(in2);
        chain[2] = (X509Certificate) cf.generateCertificate(in3);

        ks.setKeyEntry("RSA_KEY", pk, pwd, chain);
        ks.setCertificateEntry("CERT", chain[2]); // Let's trust ourselves. :-)
View Full Code Here

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

        in2 = new ByteArrayInputStream(X509_INTERMEDIATE_CA);
        in3 = new ByteArrayInputStream(X509_ROOT_CA);
        X509Certificate[] chain = new X509Certificate[3];
        chain[0] = (X509Certificate) cf.generateCertificate(in1);
        chain[1] = (X509Certificate) cf.generateCertificate(in2);
        chain[2] = (X509Certificate) cf.generateCertificate(in3);

        ks.setKeyEntry("RSA_KEY", pk, pwd, chain);
        ks.setCertificateEntry("CERT", chain[2]); // Let's trust ourselves. :-)

        KeyManagerFactory kmfactory = KeyManagerFactory.getInstance(KeyManagerFactory
View Full Code Here

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

        // Fill the first element.
        try {
            CertificateFactory cf =
                    CertificateFactory.getInstance("X.509");
            X509Certificate cert = (X509Certificate)
                    cf.generateCertificate(bais);
            jsseCerts =  new X509Certificate[1];
            jsseCerts[0] = cert;
        } catch(java.security.cert.CertificateException e) {
            // Certificate convertion failed.
            return;
View Full Code Here

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


    private static X509Certificate generateCertificate( byte[] data ) throws Exception
    {
        CertificateFactory cf = CertificateFactory.getInstance( "X.509" ); //$NON-NLS-1$
        Certificate certificate = cf.generateCertificate( new ByteArrayInputStream( data ) );
        if ( certificate instanceof X509Certificate )
        {
            return ( X509Certificate ) certificate;
        }
View Full Code Here

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

                        cf = CertificateFactory.getInstance("X.509",
                                clientCertProvider);
                    }
                    while(bais.available() > 0) {
                        X509Certificate cert = (X509Certificate)
                        cf.generateCertificate(bais);
                        if(jsseCerts == null) {
                            jsseCerts = new X509Certificate[1];
                            jsseCerts[0] = cert;
                        } else {
                            X509Certificate [] temp = new X509Certificate[jsseCerts.length+1];
View Full Code Here

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

                        for (int i = 0; i < certLength; i++) {
                            byte[] data = SSLSocket.getInfoB(socket, SSL.SSL_INFO_CLIENT_CERT_CHAIN + i);
                            CertificateFactory cf =
                                CertificateFactory.getInstance("X.509");
                            ByteArrayInputStream stream = new ByteArrayInputStream(data);
                            certs[i] = (X509Certificate) cf.generateCertificate(stream);
                        }
                    }
                    if (certs != null) {
                        request.setAttribute
                            (AprEndpoint.CERTIFICATE_KEY, certs);
View Full Code Here

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

                        for (int i = 0; i < certLength; i++) {
                            byte[] data = SSLSocket.getInfoB(socket, SSL.SSL_INFO_CLIENT_CERT_CHAIN + i);
                            CertificateFactory cf =
                                CertificateFactory.getInstance("X.509");
                            ByteArrayInputStream stream = new ByteArrayInputStream(data);
                            certs[i] = (X509Certificate) cf.generateCertificate(stream);
                        }
                    }
                    if (certs != null) {
                        request.setAttribute
                            (AprEndpoint.CERTIFICATE_KEY, certs);
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.