Commit c1f7c7a6 authored by Arachis's avatar Arachis

Adjusted ProxyServer, and RequestHandler to utilize CertificateManager.

Added CertificateManager.cs to the project.
parent 1f58d0d6
......@@ -53,8 +53,15 @@ namespace Titanium.Web.Proxy
{
return ((IPEndPoint)listener.LocalEndpoint).Port;
}
}
public static CertificateManager CertManager { get; set; }
static ProxyServer()
{
CertManager = new CertificateManager("Titanium",
"Titanium Root Certificate");
}
public ProxyServer()
{
......@@ -92,8 +99,14 @@ namespace Titanium.Web.Proxy
SystemProxyHelper.EnableProxyHTTP("localhost", ListeningPort);
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")));
RootCertificateName = RootCertificateName == null ? "DO_NOT_TRUST_FiddlerRoot" : RootCertificateName;
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)
{
......
......@@ -119,8 +119,8 @@ namespace Titanium.Web.Proxy
return;
}
Monitor.Enter(certificateAccessLock);
var _certificate = CertificateHelper.GetCertificate(RootCertificateName, tunnelHostName);
Monitor.Enter(certificateAccessLock);
var _certificate = ProxyServer.CertManager.CreateCertificate(tunnelHostName); //CertificateHelper.GetCertificate(RootCertificateName, tunnelHostName);
Monitor.Exit(certificateAccessLock);
SslStream sslStream = null;
......
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