Package java.security.cert

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


        // Register Bouncy Castle provider.
        Security.addProvider(new BouncyCastleProvider());

        // Load root certificates from file.
        CertificateFactory factory = CertificateFactory.getInstance("X.509");
        Collection<? extends Certificate> collection = factory.generateCertificates(
            new FileInputStream(rootCertificatesFileName));
        ArrayList<X509Certificate> rootCertificates = new ArrayList<X509Certificate>();
        for (Object object : collection) {
            rootCertificates.add((X509Certificate) object);
        }
View Full Code Here


        // Initialize a Bouncy Castle security provider.
        Security.addProvider(new BouncyCastleProvider());

        // Parse the root certificates file.
        CertificateFactory factory = CertificateFactory.getInstance("X.509");
        Collection<? extends Certificate> root = factory.generateCertificates(
            new FileInputStream(rootCertificatesFileName));
        ArrayList<X509Certificate> rootCertificates = new ArrayList<X509Certificate>();
        for (Object object : root) {
            rootCertificates.add((X509Certificate) object);
        }
View Full Code Here

        // Initialize a Bouncy Castle security provider.
        Security.addProvider(new BouncyCastleProvider());

        // Parse the root certificates file.
        CertificateFactory factory = CertificateFactory.getInstance("X.509");
        Collection<? extends Certificate> root = factory.generateCertificates(
            new FileInputStream(rootCertificatesFileName));
        ArrayList<X509Certificate> rootCertificates = new ArrayList<X509Certificate>();
        for (Object object : root) {
            rootCertificates.add((X509Certificate) object);
        }
View Full Code Here

    private static Collection<? extends Certificate>
    loadCertificates(final java.io.InputStream is)
        throws IOException, CertificateException {

        final CertificateFactory factory = CertificateFactory.getInstance("X.509");
        return factory.generateCertificates(is);
    }

    /**
     * This method converts the JAXB KeyManagersType into a list of
     * JSSE KeyManagers.
View Full Code Here

                                    COSString certString = (COSString)cert.getDictionaryObject(
                                        COSName.getPDFName( "Cert" ) );
                                    byte[] certData = certString.getBytes();
                                    CertificateFactory factory = CertificateFactory.getInstance( "X.509" );
                                    ByteArrayInputStream certStream = new ByteArrayInputStream( certData );
                                    Collection certs = factory.generateCertificates( certStream );
                                    System.out.println( "certs=" + certs );
                                }
                                else if( subFilter.getName().equals( "adbe.pkcs7.sha1" ) )
                                {
                                    COSString certString = (COSString)cert.getDictionaryObject(
View Full Code Here

                                    COSString certString = (COSString)cert.getDictionaryObject(
                                        COSName.CONTENTS );
                                    byte[] certData = certString.getBytes();
                                    CertificateFactory factory = CertificateFactory.getInstance( "X.509" );
                                    ByteArrayInputStream certStream = new ByteArrayInputStream( certData );
                                    Collection certs = factory.generateCertificates( certStream );
                                    System.out.println( "certs=" + certs );
                                }
                                else
                                {
                                    System.err.println( "Unknown certificate type:" + subFilter );
View Full Code Here

        } catch (java.security.cert.CertificateException e) {
            throw new Error(e);
        }
        String fileType = null;
        try {// read certs from PKCS#7 file
            final Collection<? extends Certificate> c = cf.generateCertificates(new FileInputStream(fileName));
            if ( c!=null && !c.isEmpty() ) {
                Iterator<? extends Certificate> i = c.iterator();
                while (i.hasNext()) {
                    if ( putSignEntityCard(i.next(), adm, newSignEntity) ) {
                        fileType = "PKCS#7";
View Full Code Here

      //setting security provider as BouncyCastle
      java.security.Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());

      //retrieving public certificate
      CertificateFactory cf = CertificateFactory.getInstance("X509");
      Collection col = cf.generateCertificates(certFile);
      KeyStore kall = KeyStore.getInstance(KeyStore.getDefaultType());
      kall.load(null, null);

      //retrieves every certificate in the file, but for this case, there is only one
      for (Iterator it = col.iterator(); it.hasNext();) {
View Full Code Here

      //setting security provider as BouncyCastle
      java.security.Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());

      //retrieving public certificate
      CertificateFactory cf = CertificateFactory.getInstance("X509");
      Collection col = cf.generateCertificates(certFile);
      KeyStore kall = KeyStore.getInstance(KeyStore.getDefaultType());
      kall.load(null, null);

      //retrieves every certificate in the file, but for this case, there is only one
      for (Iterator it = col.iterator(); it.hasNext();) {
View Full Code Here

        // load the cert chain
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
        ByteArrayInputStream bais = new ByteArrayInputStream(certChain);

        Collection certCol = cf.generateCertificates(bais);
        Certificate[] certs = new Certificate[certCol.toArray().length];
        if (certCol.size() == 1) {
            Debug.log("Single certificate; no chain", module);
            bais = new ByteArrayInputStream(certChain);
            Certificate cert = cf.generateCertificate(bais);
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.