47 lines
1.0 KiB
C#
47 lines
1.0 KiB
C#
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
|
#pragma warning disable
|
|
using System.IO;
|
|
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO.Pem;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.OpenSsl
|
|
{
|
|
/// <remarks>General purpose writer for OpenSSL PEM objects.</remarks>
|
|
public class PemWriter
|
|
: 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 inner)
|
|
throw inner;
|
|
|
|
throw e;
|
|
}
|
|
}
|
|
|
|
public void WriteObject(
|
|
object obj,
|
|
string algorithm,
|
|
char[] password,
|
|
SecureRandom random)
|
|
{
|
|
base.WriteObject(new MiscPemGenerator(obj, algorithm, password, random));
|
|
}
|
|
}
|
|
}
|
|
#pragma warning restore
|
|
#endif
|