using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Text;
using Org.BouncyCastle.Asn1;
using Org.BouncyCastle.Asn1.CryptoPro;
using Org.BouncyCastle.Asn1.Pkcs;
using Org.BouncyCastle.Asn1.X509;
using Org.BouncyCastle.Asn1.X9;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Generators;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.Math;
using Org.BouncyCastle.Pkcs;
using Org.BouncyCastle.Security;
using Org.BouncyCastle.Security.Certificates;
using Org.BouncyCastle.Utilities.Encoders;
using Org.BouncyCastle.Utilities.IO.Pem;
using Org.BouncyCastle.X509;
namespace Org.BouncyCastle.OpenSsl
{
/// General purpose writer for OpenSSL PEM objects.
public class PemWriter
: Org.BouncyCastle.Utilities.IO.Pem.PemWriter
{
/// The TextWriter object to write the output to.
public PemWriter(
TextWriter writer)
: base(writer)
{
}
public void WriteObject(
object obj)
{
try
{
base.WriteObject(new MiscPemGenerator(obj));
}
catch (PemGenerationException e)
{
if (e.InnerException is IOException)
throw (IOException)e.InnerException;
throw e;
}
}
public void WriteObject(
object obj,
string algorithm,
char[] password,
SecureRandom random)
{
base.WriteObject(new MiscPemGenerator(obj, algorithm, password, random));
}
}
}