Unverified Commit a1ab56e7 authored by mohammadlachgar's avatar mohammadlachgar Committed by GitHub

Add RegexOptions.IgnoreCase (FriendlyName)

parent 33ec65f4
...@@ -48,7 +48,7 @@ namespace Titanium.Web.Proxy.Network.Certificate ...@@ -48,7 +48,7 @@ namespace Titanium.Web.Proxy.Network.Certificate
/// <param name="signingCert">The signing cert.</param> /// <param name="signingCert">The signing cert.</param>
/// <returns>X509Certificate2 instance.</returns> /// <returns>X509Certificate2 instance.</returns>
public X509Certificate2 MakeCertificate(string sSubjectCn, bool isRoot, X509Certificate2 signingCert = null) public X509Certificate2 MakeCertificate(string sSubjectCn, bool isRoot, X509Certificate2 signingCert = null)
{ {
return MakeCertificateInternal(sSubjectCn, isRoot, true, signingCert); return MakeCertificateInternal(sSubjectCn, isRoot, true, signingCert);
} }
...@@ -148,8 +148,8 @@ namespace Titanium.Web.Proxy.Network.Certificate ...@@ -148,8 +148,8 @@ namespace Titanium.Web.Proxy.Network.Certificate
if (!doNotSetFriendlyName) if (!doNotSetFriendlyName)
{ {
try try
{ {
x509Certificate.FriendlyName = System.Text.RegularExpressions.Regex.Replace(subjectName.ToLower(), @"^CN\s*=\s*", ""); x509Certificate.FriendlyName = System.Text.RegularExpressions.Regex.Replace(subjectName, @"^CN\s*=\s*", "", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
} }
catch (PlatformNotSupportedException) catch (PlatformNotSupportedException)
{ {
...@@ -203,16 +203,13 @@ namespace Titanium.Web.Proxy.Network.Certificate ...@@ -203,16 +203,13 @@ namespace Titanium.Web.Proxy.Network.Certificate
else else
{ {
var kp = DotNetUtilities.GetKeyPair(signingCertificate.PrivateKey); var kp = DotNetUtilities.GetKeyPair(signingCertificate.PrivateKey);
return GenerateCertificate(hostName, subjectName, signingCertificate.Subject, validFrom, validTo, issuerPrivateKey: kp.Private); return GenerateCertificate(hostName, subjectName, signingCertificate.Subject, validFrom, validTo, issuerPrivateKey: kp.Private);
} }
} }
/// <summary> /// <summary>
/// Makes the certificate internal. /// Makes the certificate internal.
/// </summary> /// </summary>
......
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