You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.4 KiB
61 lines
1.4 KiB
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
|
|
{
|
|
/// <remarks>General purpose writer for OpenSSL PEM objects.</remarks>
|
|
public class PemWriter
|
|
: Org.BouncyCastle.Utilities.IO.Pem.PemWriter
|
|
{
|
|
/// <param name="writer">The TextWriter object to write the output to.</param>
|
|
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));
|
|
}
|
|
}
|
|
}
|
|
|