Examples of PEMWriter


Examples of org.bouncycastle.util.io.pem.PemWriter

    try {
      PrivateKey privateKey = crypter.getPrivateKey();
      PublicKey publicKey = crypter.getPublicKey();
      boolean addLine = false;

      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) {
          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

Examples of org.bouncycastle2.openssl.PEMWriter

                    PKCSObjectIdentifiers.signedData, sd));
        }
        else if (encoding.equalsIgnoreCase("PEM"))
        {
            ByteArrayOutputStream bOut = new ByteArrayOutputStream();
            PEMWriter             pWrt = new PEMWriter(new OutputStreamWriter(bOut));

            try
            {
                for (int i = 0; i != certificates.size(); i++)
                {
                    pWrt.writeObject(certificates.get(i));
                }
           
                pWrt.close();
            }
            catch (Exception e)
            {
                throw new CertificateEncodingException("can't encode certificate for PEM encoded path");
            }
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.