blob: 58b6156d56ed78e58c570852c990a56ca7905216 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
using System.IO;
using Org.BouncyCastle.Security;
using Org.BouncyCastle.Utilities.IO.Pem;
namespace 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)
{
WriteObject(obj, null, null, null);
}
public void WriteObject(object obj, string algorithm, char[] password, SecureRandom random)
{
try
{
base.WriteObject(new MiscPemGenerator(obj, algorithm, password, random));
}
catch (PemGenerationException e)
{
if (e.InnerException is IOException inner)
throw inner;
throw e;
}
}
}
}
|