Code example for Collection

Methods: sizetoArray

0
            // loading CertificateChain 
            CertificateFactory cf = CertificateFactory.getInstance("X.509");
            InputStream certstream = fullStream (certfile);
 
            Collection c = cf.generateCertificates(certstream) ;
            Certificate[] certs = new Certificate[c.toArray().length];
 
            if (c.size() == 1) {
                certstream = fullStream (certfile);
                System.out.println("One certificate, no chain.");
                Certificate cert = cf.generateCertificate(certstream) ;
                certs[0] = cert;
            } else { 
                System.out.println("Certificate chain length: "+c.size());
                certs = (Certificate[])c.toArray();
            } 
 
            // storing keystore 
            ks.setKeyEntry(defaultalias, ff,
                           keypass.toCharArray(),
Experience pair programming with AI  Get Codota for Java