Package org.bouncycastle.util.io.pem

Examples of org.bouncycastle.util.io.pem.PemWriter.writeObject()


    StringWriter stringWriter = new StringWriter();

    try {
      PemWriter writer = new PemWriter(stringWriter);
      PemObjectGenerator pemObject = new PemObject("CERTIFICATE REQUEST", csr.getEncoded());
      writer.writeObject(pemObject);
      writer.close();
    } catch (IOException e) {
      throw new IllegalArgumentException("Error generating PEM", e);
    }
View Full Code Here


            try
            {
                for (int i = 0; i != certificates.size(); i++)
                {
                    pWrt.writeObject(new PemObject("CERTIFICATE", ((X509Certificate)certificates.get(i)).getEncoded()));
                }
           
                pWrt.close();
            }
            catch (Exception e)
View Full Code Here

    Object obj = ks.getCertificate("RootCAPriKey");
    // final Certificate cert =
    // rootca.getCertificate(SslCertificateService.ZAPROXY_JKS_ALIAS);
    final PemWriter pw = new PemWriter(new FileWriter(
            "Fake-ACRoot-Certificate.cer"));
    pw.writeObject(new MiscPEMGenerator(cert));
    pw.flush();
  }
}
View Full Code Here

        StringWriter stringWriter = new StringWriter();

        try {
            PemWriter writer = new PemWriter(stringWriter);
            PemObjectGenerator pemObject = new PemObject("CERTIFICATE REQUEST", csr.getEncoded());
            writer.writeObject(pemObject);
            writer.close();
        } catch (IOException e) {
            throw new IllegalArgumentException("Error generating PEM", e);
        }
View Full Code Here

      PemWriter writer = new PemWriter(new OutputStreamWriter(outputStream));

      if (privateKey != null) {
        PemObjectGenerator generator = new MiscPEMGenerator(privateKey);
        writer.writeObject(generator);
        addLine = true;
      }

      if (publicKey != null) {
        if (addLine) {
View Full Code Here

        if (addLine) {
          outputStream.write(CrypterIOHelper.NEW_LINE.getBytes());
        }

        PemObjectGenerator generator = new MiscPEMGenerator(publicKey);
        writer.writeObject(generator);
      }

      writer.close();
    } catch (IOException e) {
      throw new CrypterException(e);
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.