Commit bfd6e9e8 authored by Honfika's avatar Honfika

a

parent 0b64df4f
...@@ -28,6 +28,10 @@ namespace Titanium.Web.Proxy.Network.Certificate ...@@ -28,6 +28,10 @@ namespace Titanium.Web.Proxy.Network.Certificate
private const int certificateValidDays = 1825; private const int certificateValidDays = 1825;
private const int certificateGraceDays = 366; private const int certificateGraceDays = 366;
// The FriendlyName value cannot be set on Unix.
// Set this flag to true when exception detected to avoid further exceptions
private static bool doNotSetFriendlyName;
/// <summary> /// <summary>
/// Makes the certificate. /// Makes the certificate.
/// </summary> /// </summary>
...@@ -126,13 +130,17 @@ namespace Titanium.Web.Proxy.Network.Certificate ...@@ -126,13 +130,17 @@ namespace Titanium.Web.Proxy.Network.Certificate
// Set private key onto certificate instance // Set private key onto certificate instance
var x509Certificate = new X509Certificate2(certificate.GetEncoded()); var x509Certificate = new X509Certificate2(certificate.GetEncoded());
x509Certificate.PrivateKey = DotNetUtilities.ToRSA(rsaparams); x509Certificate.PrivateKey = DotNetUtilities.ToRSA(rsaparams);
if (!doNotSetFriendlyName)
{
try try
{ {
x509Certificate.FriendlyName = subjectName; x509Certificate.FriendlyName = subjectName;
} }
catch (PlatformNotSupportedException) catch (PlatformNotSupportedException)
{ {
// The FriendlyName value cannot be set on Unix. doNotSetFriendlyName = true;
}
} }
return x509Certificate; return x509Certificate;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment