Package org.bouncycastle.openssl

Examples of org.bouncycastle.openssl.PEMWriter.writeObject()


        }
       
        bOut = new ByteArrayOutputStream();
        pWrt = new PEMWriter(new OutputStreamWriter(bOut));
       
        pWrt.writeObject(pair.getPrivate());
       
        pWrt.close();
       
        pemRd = new PEMReader(new InputStreamReader(new ByteArrayInputStream(bOut.toByteArray())));
       
View Full Code Here


                                            if (! SSL.isSslCertKeyPresent(_netscalerService, intermediateCertKeyName)) {
                                                byte[] certData= intermediateCert.getEncoded();
                                                StringWriter textWriter = new StringWriter();
                                                PEMWriter pemWriter = new PEMWriter(textWriter);
                                                pemWriter.writeObject(intermediateCert);
                                                pemWriter.flush();

                                                SSL.uploadCert(_ip, _username, _password, intermediateCertFileName, textWriter.toString().getBytes());
                                                SSL.createSslCertKey(_netscalerService, intermediateCertFileName, null, intermediateCertKeyName, null);
                                            }
View Full Code Here

                /*
                 * Write in PEM format (openssl support)
                 */
                PEMWriter pemFormatWriter = new PEMWriter(stringWriter);
                pemFormatWriter.writeObject(keypair.getPrivate());
                pemFormatWriter.close();
                fos.write(stringWriter.toString().getBytes());
            } catch (IOException ioe) {
                throw ioe;
            } finally {
View Full Code Here

                fos = new FileOutputStream(privateKeyFilePath);
                StringWriter stringWriter = new StringWriter();

                /* Write in PEM format (openssl support) */
                PEMWriter pemFormatWriter = new PEMWriter(stringWriter);
                pemFormatWriter.writeObject(keypair.getPrivate());
                pemFormatWriter.close();
                fos.write(stringWriter.toString().getBytes());
            } catch (IOException ioe) {
                throw ioe;
            } finally {
View Full Code Here

  public byte[] getContent() {
    if (ser == null) {
      try {
        StringWriter sw = new StringWriter();
        PEMWriter pemWriter = new PEMWriter(sw);
        pemWriter.writeObject(cer.getCertificate());
        pemWriter.close();
        ser = sw.toString().getBytes("UTF-8");
      } catch (IOException e) {
        log.log(Level.SEVERE, "could not write PEM Serialisation");
      }
View Full Code Here

            try
            {
                for (int i = 0; i != certificates.size(); i++)
                {
                    pWrt.writeObject(certificates.get(i));
                }
           
                pWrt.close();
            }
            catch (Exception e)
View Full Code Here

                /*
                 * Write in PEM format (openssl support)
                 */
                PEMWriter pemFormatWriter = new PEMWriter(stringWriter);
                pemFormatWriter.writeObject(keypair.getPrivate());
                pemFormatWriter.close();
                fos.write(stringWriter.toString().getBytes());
            } catch (IOException ioe) {
                throw ioe;
            } finally {
View Full Code Here

            try
            {
                for (int i = 0; i != certificates.size(); i++)
                {
                    pWrt.writeObject(certificates.get(i));
                }
           
                pWrt.close();
            }
            catch (Exception e)
View Full Code Here

    public static String toPem(KeyPair keyPair) throws IOException {
        StringWriter writer = new StringWriter();
        PEMWriter pemWriter = new PEMWriter(writer, BouncyCastleLoader.getName());
        try {
            pemWriter.writeObject(keyPair);
            pemWriter.flush();
            return writer.toString();
        } finally {
            IoUtils.safeClose(pemWriter);
        }
View Full Code Here

    // }

    public static String serializePem(Object data) throws IOException {
        StringWriter writer = new StringWriter();
        try (PEMWriter pemWriter = new PEMWriter(writer)) {
            pemWriter.writeObject(data);
            pemWriter.flush();
            return writer.toString();
        }
    }
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.