Examples of generateCertificate()


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

  public X509Certificate[] parse(InputStream is) {
    List<X509Certificate> certs = Lists.newArrayList();
    try {
      CertificateFactory x509CertificateFactory = getX509CertificateFactory();
      while (is.available() > 0) {
        X509Certificate cert = (X509Certificate) x509CertificateFactory.generateCertificate(is);
        certs.add(cert);
      }
    } catch (CertificateException ce) {
      throw new IllegalArgumentException("Not an X509 certificate", ce);
    } catch (IOException e) {
View Full Code Here

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

  }

  private static X509Certificate toX509(Certificate certificate) {
    try {
      CertificateFactory cf = CertificateFactory.getInstance("X.509");
      X509Certificate cert = (X509Certificate) cf.generateCertificate(new ByteArrayInputStream(certificate
          .getEncoded()));
      return cert;
    } catch (IOException e) {
      throw new IllegalArgumentException("Error converting certificate", e);
    } catch (CertificateException e) {
View Full Code Here

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

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

            InputStream in = new FileInputStream(caCertFile);

            try {
                X509Certificate cert = (X509Certificate)certFac.generateCertificate(in);
                ks.setCertificateEntry(CA_ALIAS, cert);
                caCertificate = cert;
            } finally {
                try {
                    in.close();
View Full Code Here

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

                try {
                    lastUpdate = certFile.lastModified();
                    InputStream in = new FileInputStream(certFile);
                    try {
                        CertificateFactory certFac = CertificateFactory.getInstance("X.509");
                        cert = (X509Certificate) certFac.generateCertificate(in);
                    } finally {
                        try {
                            in.close();
                        } catch (IOException ex) {
                        // Ignore
View Full Code Here

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

    public void encryptBody(Certificate PublicKey) {
        InputStream inStream = new ByteArrayInputStream(PublicKey.getCertificate());
        CertificateFactory cf;
        try {
            cf = CertificateFactory.getInstance("X.509");
            X509Certificate cert = (X509Certificate) cf.generateCertificate(inStream);
            RSAPublicKey key = (RSAPublicKey) cert.getPublicKey();

            Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
            cipher.init(Cipher.ENCRYPT_MODE, key);
View Full Code Here

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

    private void checkCircProcessing()
        throws Exception
    {
        CertificateFactory cf = CertificateFactory.getInstance("X.509", "BC");

        X509Certificate caCert = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(circCA));
        X509Certificate crlCaCert = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(circCRLCA));
        X509CRL crl = (X509CRL)cf.generateCRL(new ByteArrayInputStream(circCRL));

        List list = new ArrayList();
View Full Code Here

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

        throws Exception
    {
        CertificateFactory cf = CertificateFactory.getInstance("X.509", "BC");

        X509Certificate caCert = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(circCA));
        X509Certificate crlCaCert = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(circCRLCA));
        X509CRL crl = (X509CRL)cf.generateCRL(new ByteArrayInputStream(circCRL));

        List list = new ArrayList();

        list.add(caCert);
View Full Code Here

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

        throws Exception
    {
        CertificateFactory cf = CertificateFactory.getInstance("X.509", "BC");

            // initialise CertStore
        X509Certificate rootCert = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(CertPathTest.rootCertBin));
        X509Certificate interCert = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(CertPathTest.interCertBin));
        X509Certificate finalCert = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(CertPathTest.finalCertBin));
        X509CRL rootCrl = (X509CRL)cf.generateCRL(new ByteArrayInputStream(CertPathTest.rootCrlBin));
        X509CRL interCrl = (X509CRL)cf.generateCRL(new ByteArrayInputStream(CertPathTest.interCrlBin));
        List list = new ArrayList();
View Full Code Here

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

    {
        CertificateFactory cf = CertificateFactory.getInstance("X.509", "BC");

            // initialise CertStore
        X509Certificate rootCert = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(CertPathTest.rootCertBin));
        X509Certificate interCert = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(CertPathTest.interCertBin));
        X509Certificate finalCert = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(CertPathTest.finalCertBin));
        X509CRL rootCrl = (X509CRL)cf.generateCRL(new ByteArrayInputStream(CertPathTest.rootCrlBin));
        X509CRL interCrl = (X509CRL)cf.generateCRL(new ByteArrayInputStream(CertPathTest.interCrlBin));
        List list = new ArrayList();
        list.add(rootCert);
View Full Code Here

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

        CertificateFactory cf = CertificateFactory.getInstance("X.509", "BC");

            // initialise CertStore
        X509Certificate rootCert = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(CertPathTest.rootCertBin));
        X509Certificate interCert = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(CertPathTest.interCertBin));
        X509Certificate finalCert = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(CertPathTest.finalCertBin));
        X509CRL rootCrl = (X509CRL)cf.generateCRL(new ByteArrayInputStream(CertPathTest.rootCrlBin));
        X509CRL interCrl = (X509CRL)cf.generateCRL(new ByteArrayInputStream(CertPathTest.interCrlBin));
        List list = new ArrayList();
        list.add(rootCert);
        list.add(interCert);
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.