Commit c1f7c7a6 authored by Arachis's avatar Arachis

Adjusted ProxyServer, and RequestHandler to utilize CertificateManager.

Added CertificateManager.cs to the project.
parent 1f58d0d6
......@@ -55,6 +55,13 @@ namespace Titanium.Web.Proxy
}
}
public static CertificateManager CertManager { get; set; }
static ProxyServer()
{
CertManager = new CertificateManager("Titanium",
"Titanium Root Certificate");
}
public ProxyServer()
{
......@@ -93,7 +100,13 @@ namespace Titanium.Web.Proxy
FireFoxHelper.AddFirefox();
RootCertificateName = RootCertificateName == null ? "DO_NOT_TRUST_FiddlerRoot" : RootCertificateName;
CertificateHelper.InstallCertificate(Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), string.Concat(RootCertificateName, ".cer")));
bool certTrusted = CertManager.CreateTrustedRootCertificate();
if (!certTrusted)
{
// The user didn't want to install the self-signed certificate to the root store.
}
//CertificateHelper.InstallCertificate(Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), string.Concat(RootCertificateName, ".cer")));
if (EnableSSL)
{
......
......@@ -120,7 +120,7 @@ namespace Titanium.Web.Proxy
return;
}
Monitor.Enter(certificateAccessLock);
var _certificate = CertificateHelper.GetCertificate(RootCertificateName, tunnelHostName);
var _certificate = ProxyServer.CertManager.CreateCertificate(tunnelHostName); //CertificateHelper.GetCertificate(RootCertificateName, tunnelHostName);
Monitor.Exit(certificateAccessLock);
SslStream sslStream = null;
......
......@@ -76,6 +76,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Helpers\CertificateManager.cs" />
<Compile Include="Helpers\Firefox.cs" />
<Compile Include="Helpers\SystemProxy.cs" />
<Compile Include="RequestHandler.cs" />
......
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