Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Titanium-Web-Proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Titanium-Web-Proxy
Commits
0934a004
Commit
0934a004
authored
Jul 07, 2015
by
justcoding121
Committed by
justcoding121
Jul 07, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge cleanup
Remove outdated files. Don't install certificate if not using HTTPS
parent
9dc9db4e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
197 additions
and
278 deletions
+197
-278
Certificate.cs
Titanium.Web.Proxy/Helpers/Certificate.cs
+0
-80
ProxyServer.cs
Titanium.Web.Proxy/ProxyServer.cs
+197
-197
Titanium.Web.Proxy.csproj
Titanium.Web.Proxy/Titanium.Web.Proxy.csproj
+0
-1
No files found.
Titanium.Web.Proxy/Helpers/Certificate.cs
deleted
100644 → 0
View file @
9dc9db4e
using
System
;
using
System.Security.Cryptography.X509Certificates
;
using
System.Diagnostics
;
using
System.Threading
;
namespace
Titanium.Web.Proxy.Helpers
{
public
class
CertificateHelper
{
private
static
X509Store
store
;
public
static
X509Certificate2
GetCertificate
(
string
RootCertificateName
,
string
Hostname
)
{
if
(
store
==
null
)
{
store
=
new
X509Store
(
StoreName
.
My
,
StoreLocation
.
CurrentUser
);
store
.
Open
(
OpenFlags
.
ReadOnly
);
}
var
CachedCertificate
=
GetCertifiateFromStore
(
RootCertificateName
,
Hostname
);
if
(
CachedCertificate
==
null
)
CreateClientCertificate
(
RootCertificateName
,
Hostname
);
return
GetCertifiateFromStore
(
RootCertificateName
,
Hostname
);
}
private
static
X509Certificate2
GetCertifiateFromStore
(
string
RootCertificateName
,
string
Hostname
)
{
X509Certificate2Collection
certificateCollection
=
store
.
Certificates
.
Find
(
X509FindType
.
FindBySubjectName
,
Hostname
,
true
);
foreach
(
var
certificate
in
certificateCollection
)
{
if
(
certificate
.
SubjectName
.
Name
.
StartsWith
(
"CN="
+
Hostname
)
&&
certificate
.
IssuerName
.
Name
.
StartsWith
(
"CN="
+
RootCertificateName
))
return
certificate
;
}
return
null
;
}
private
static
void
CreateClientCertificate
(
string
RootCertificateName
,
string
Hostname
)
{
Process
process
=
new
Process
();
// Stop the process from opening a new window
process
.
StartInfo
.
RedirectStandardOutput
=
true
;
process
.
StartInfo
.
UseShellExecute
=
false
;
process
.
StartInfo
.
CreateNoWindow
=
true
;
// Setup executable and parameters
process
.
StartInfo
.
FileName
=
@"makecert.exe"
;
process
.
StartInfo
.
Arguments
=
@" -pe -ss my -n ""CN="
+
Hostname
+
@", O=DO_NOT_TRUST, OU=Created by http://www.fiddler2.com"" -sky exchange -in "
+
RootCertificateName
+
" -is my -eku 1.3.6.1.5.5.7.3.1 -cy end -a sha1 -m 132 -b 06/26/2014"
;
// Go
process
.
Start
();
process
.
WaitForExit
();
}
public
static
void
InstallCertificate
(
string
certificatePath
)
{
X509Certificate2
certificate
=
new
X509Certificate2
(
certificatePath
);
X509Store
store
=
new
X509Store
(
StoreName
.
Root
,
StoreLocation
.
CurrentUser
);
store
.
Open
(
OpenFlags
.
ReadWrite
);
store
.
Add
(
certificate
);
store
.
Close
();
X509Store
store1
=
new
X509Store
(
StoreName
.
My
,
StoreLocation
.
CurrentUser
);
store1
.
Open
(
OpenFlags
.
ReadWrite
);
store1
.
Add
(
certificate
);
store1
.
Close
();
}
}
}
Titanium.Web.Proxy/ProxyServer.cs
View file @
0934a004
This diff is collapsed.
Click to expand it.
Titanium.Web.Proxy/Titanium.Web.Proxy.csproj
View file @
0934a004
...
...
@@ -81,7 +81,6 @@
<Compile
Include=
"Helpers\SystemProxy.cs"
/>
<Compile
Include=
"RequestHandler.cs"
/>
<Compile
Include=
"ResponseHandler.cs"
/>
<Compile
Include=
"Helpers\Certificate.cs"
/>
<Compile
Include=
"Helpers\CustomBinaryReader.cs"
/>
<Compile
Include=
"Helpers\NetFramework.cs"
/>
<Compile
Include=
"Helpers\Compression.cs"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment