org.testifyproject.bouncycastle.openssl.PEMWriter Maven / Gradle / Ivy
package org.testifyproject.bouncycastle.openssl;
import java.org.testifyproject.testifyproject.IOException;
import java.org.testifyproject.testifyproject.Writer;
import org.testifyproject.bouncycastle.openssl.jcajce.JcaMiscPEMGenerator;
import org.testifyproject.bouncycastle.util.org.testifyproject.testifyproject.pem.PemGenerationException;
import org.testifyproject.bouncycastle.util.org.testifyproject.testifyproject.pem.PemObjectGenerator;
import org.testifyproject.bouncycastle.util.org.testifyproject.testifyproject.pem.PemWriter;
/**
* General purpose writer for OpenSSL PEM objects.
* @org.testifyproject.testifyprojectprecated use JcaPEMWriter
*/
public class PEMWriter
extends PemWriter
{
/**
* Base constructor.
*
* @param out output stream to use.
*/
public PEMWriter(Writer out)
{
super(out);
}
/**
* @throws IOException
*/
public void writeObject(
Object obj)
throws IOException
{
writeObject(obj, null);
}
/**
* @param obj
* @param encryptor
* @throws IOException
*/
public void writeObject(
Object obj,
PEMEncryptor encryptor)
throws IOException
{
try
{
super.writeObject(new JcaMiscPEMGenerator(obj, encryptor));
}
catch (PemGenerationException e)
{
if (e.getCause() instanceof IOException)
{
throw (IOException)e.getCause();
}
throw e;
}
}
public void writeObject(
PemObjectGenerator obj)
throws IOException
{
super.writeObject(obj);
}
}