Commit a5a04e9a authored by Honfika's avatar Honfika

fast BC

parent 147d7234
...@@ -44,7 +44,6 @@ namespace Titanium.Web.Proxy.Network.Certificate ...@@ -44,7 +44,6 @@ namespace Titanium.Web.Proxy.Network.Certificate
/// Makes the certificate. /// Makes the certificate.
/// </summary> /// </summary>
/// <param name="sSubjectCn">The s subject cn.</param> /// <param name="sSubjectCn">The s subject cn.</param>
/// <param name="isRoot">if set to <c>true</c> [is root].</param>
/// <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, X509Certificate2? signingCert = null) public X509Certificate2 MakeCertificate(string sSubjectCn, X509Certificate2? signingCert = null)
......
...@@ -24,6 +24,8 @@ namespace Titanium.Web.Proxy.Network ...@@ -24,6 +24,8 @@ namespace Titanium.Web.Proxy.Network
/// </summary> /// </summary>
BouncyCastle = 0, BouncyCastle = 0,
BouncyCastleFast = 2,
/// <summary> /// <summary>
/// Uses Windows Certification Generation API and only valid in Windows OS. /// Uses Windows Certification Generation API and only valid in Windows OS.
/// Observed to be faster than BouncyCastle. /// Observed to be faster than BouncyCastle.
...@@ -68,9 +70,19 @@ namespace Titanium.Web.Proxy.Network ...@@ -68,9 +70,19 @@ namespace Titanium.Web.Proxy.Network
{ {
if (certEngineValue == null) if (certEngineValue == null)
{ {
certEngineValue = engine == CertificateEngine.BouncyCastle switch (engine)
? (ICertificateMaker)new BCCertificateMaker(ExceptionFunc) {
: new WinCertificateMaker(ExceptionFunc); case CertificateEngine.BouncyCastle:
certEngineValue = new BCCertificateMaker(ExceptionFunc);
break;
case CertificateEngine.BouncyCastleFast:
certEngineValue = new BCCertificateMakerFast(ExceptionFunc);
break;
case CertificateEngine.DefaultWindows:
default:
certEngineValue = new WinCertificateMaker(ExceptionFunc);
break;
}
} }
return certEngineValue; return certEngineValue;
......
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