Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Commit 974307a

Browse files
authored
Merge 5e2fdbb into c963bc5
2 parents c963bc5 + 5e2fdbb commit 974307a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/Titanium.Web.Proxy/Network/Certificate/BCCertificateMaker.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using Org.BouncyCastle.Security;
1717
using Org.BouncyCastle.Utilities;
1818
using Org.BouncyCastle.X509;
19+
using Titanium.Web.Proxy.Helpers;
1920
using Titanium.Web.Proxy.Shared;
2021
using X509Certificate = Org.BouncyCastle.X509.X509Certificate;
2122

@@ -166,7 +167,19 @@ private static X509Certificate2 generateCertificate(string hostName,
166167
private static X509Certificate2 withPrivateKey(X509Certificate certificate, AsymmetricKeyParameter privateKey)
167168
{
168169
const string password = "password";
169-
var store = new Pkcs12Store();
170+
Pkcs12Store store = null;
171+
172+
if(RunTime.IsRunningOnMono)
173+
{
174+
Pkcs12StoreBuilder builder = new Pkcs12StoreBuilder();
175+
builder.SetUseDerEncoding(true);
176+
store = builder.Build();
177+
}
178+
else
179+
{
180+
store = new Pkcs12Store();
181+
}
182+
170183
var entry = new X509CertificateEntry(certificate);
171184
store.SetCertificateEntry(certificate.SubjectDN.ToString(), entry);
172185

0 commit comments

Comments
 (0)