Commit f9091d97 authored by ilushka85's avatar ilushka85
parents 743038ef b1c68c4e
...@@ -45,11 +45,13 @@ namespace Titanium.Web.Proxy.Network ...@@ -45,11 +45,13 @@ namespace Titanium.Web.Proxy.Network
/// <returns>true if succeeded, else false</returns> /// <returns>true if succeeded, else false</returns>
internal bool CreateTrustedRootCertificate() internal bool CreateTrustedRootCertificate()
{ {
if (File.Exists("rootCert.pfx")) var fileName = Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location),"rootCert.pfx");
if (File.Exists(fileName))
{ {
try try
{ {
rootCertificate = new X509Certificate2("rootCert.pfx", string.Empty, X509KeyStorageFlags.Exportable); rootCertificate = new X509Certificate2(fileName, string.Empty, X509KeyStorageFlags.Exportable);
if (rootCertificate != null) if (rootCertificate != null)
{ {
return true; return true;
...@@ -72,7 +74,7 @@ namespace Titanium.Web.Proxy.Network ...@@ -72,7 +74,7 @@ namespace Titanium.Web.Proxy.Network
{ {
try try
{ {
File.WriteAllBytes("rootCert.pfx", rootCertificate.Export(X509ContentType.Pkcs12)); File.WriteAllBytes(fileName, rootCertificate.Export(X509ContentType.Pkcs12));
} }
catch(Exception e) catch(Exception e)
{ {
......
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