Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Locate makecert.exe next to the assembly #33

Merged
merged 1 commit into from
Jan 16, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Titanium.Web.Proxy/Helpers/CertificateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Diagnostics;
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;
using System.Reflection;

namespace Titanium.Web.Proxy.Helpers
{
Expand Down Expand Up @@ -112,14 +113,16 @@ protected virtual void CreateCertificate(string[] args)
{
using (var process = new Process())
{
if (!File.Exists("makecert.exe"))
string file = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "makecert.exe");

if (!File.Exists(file))
throw new Exception("Unable to locate 'makecert.exe'.");

process.StartInfo.Verb = "runas";
process.StartInfo.Arguments = args != null ? args[0] : string.Empty;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.FileName = "makecert.exe";
process.StartInfo.FileName = file;

process.Start();
process.WaitForExit();
Expand Down