Skip to content

Commit 50b7397

Browse files
committed
Cert, support for certificates on all platforms
1 parent debdf2c commit 50b7397

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

Protest/Tools/Cert.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ namespace Protest.Tools;
1313

1414
internal static class Cert {
1515
public static byte[] Create(HttpListenerContext ctx, string origin) {
16-
17-
if (!OperatingSystem.IsWindows()) {
18-
return "{\"error\":\"not supported\"}"u8.ToArray();
19-
}
20-
2116
using StreamReader reader = new StreamReader(ctx.Request.InputStream, ctx.Request.ContentEncoding);
2217
string payload = reader.ReadToEnd();
2318

@@ -257,7 +252,6 @@ internal static byte[] Download(HttpListenerContext ctx, Dictionary<string, stri
257252
}
258253
}
259254

260-
[SupportedOSPlatform("windows")]
261255
private static X509Certificate2 CreateSelfSignedCertificate(
262256
string domain,
263257
int rsaKeySize,
@@ -300,7 +294,10 @@ private static X509Certificate2 CreateSelfSignedCertificate(
300294
request.CertificateExtensions.Add(new X509SubjectKeyIdentifierExtension(request.PublicKey, false));
301295

302296
X509Certificate2 certificate = request.CreateSelfSigned(notBefore, notAfter);
303-
certificate.FriendlyName = friendlyName;
297+
298+
if (OperatingSystem.IsWindows()) {
299+
certificate.FriendlyName = friendlyName;
300+
}
304301

305302
return certificate;
306303
}

0 commit comments

Comments
 (0)