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
e910ff08
Commit
e910ff08
authored
Sep 26, 2016
by
ilushka85
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change Fiddler Name to Titanium + Fix innovcation errors from resaving root cert as not exportable
parent
fef05f52
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
16 deletions
+35
-16
CertEnrollEngine.cs
Titanium.Web.Proxy/Network/CertEnrollEngine.cs
+1
-1
CertificateManager.cs
Titanium.Web.Proxy/Network/CertificateManager.cs
+34
-15
No files found.
Titanium.Web.Proxy/Network/CertEnrollEngine.cs
View file @
e910ff08
...
@@ -171,7 +171,7 @@ namespace Titanium.Web.Proxy.Network
...
@@ -171,7 +171,7 @@ namespace Titanium.Web.Proxy.Network
this
.
typeX509Enrollment
.
InvokeMember
(
"InitializeFromRequest"
,
BindingFlags
.
InvokeMethod
,
null
,
obj15
,
subject
);
this
.
typeX509Enrollment
.
InvokeMember
(
"InitializeFromRequest"
,
BindingFlags
.
InvokeMethod
,
null
,
obj15
,
subject
);
if
(
IsRoot
)
if
(
IsRoot
)
{
{
subject
[
0
]
=
"DO_NOT_TRUST_
FiddlerRoot
-CE"
;
subject
[
0
]
=
"DO_NOT_TRUST_
TitaniumProxy
-CE"
;
this
.
typeX509Enrollment
.
InvokeMember
(
"CertificateFriendlyName"
,
BindingFlags
.
PutDispProperty
,
null
,
obj15
,
subject
);
this
.
typeX509Enrollment
.
InvokeMember
(
"CertificateFriendlyName"
,
BindingFlags
.
PutDispProperty
,
null
,
obj15
,
subject
);
}
}
subject
[
0
]
=
0
;
subject
[
0
]
=
0
;
...
...
Titanium.Web.Proxy/Network/CertificateManager.cs
View file @
e910ff08
...
@@ -6,6 +6,7 @@ using System.Threading;
...
@@ -6,6 +6,7 @@ using System.Threading;
using
System.Linq
;
using
System.Linq
;
using
System.Collections.Concurrent
;
using
System.Collections.Concurrent
;
using
System.IO
;
using
System.IO
;
using
System.Diagnostics
;
namespace
Titanium.Web.Proxy.Network
namespace
Titanium.Web.Proxy.Network
{
{
...
@@ -15,13 +16,13 @@ namespace Titanium.Web.Proxy.Network
...
@@ -15,13 +16,13 @@ namespace Titanium.Web.Proxy.Network
internal
class
CertificateManager
:
IDisposable
internal
class
CertificateManager
:
IDisposable
{
{
private
CertEnrollEngine
certEngine
=
null
;
private
CertEnrollEngine
certEngine
=
null
;
/// <summary>
/// <summary>
/// Cache dictionary
/// Cache dictionary
/// </summary>
/// </summary>
private
readonly
IDictionary
<
string
,
CachedCertificate
>
certificateCache
;
private
readonly
IDictionary
<
string
,
CachedCertificate
>
certificateCache
;
internal
string
Issuer
{
get
;
private
set
;
}
internal
string
Issuer
{
get
;
private
set
;
}
internal
string
RootCertificateName
{
get
;
private
set
;
}
internal
string
RootCertificateName
{
get
;
private
set
;
}
...
@@ -44,21 +45,23 @@ namespace Titanium.Web.Proxy.Network
...
@@ -44,21 +45,23 @@ 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"
))
if
(
File
.
Exists
(
"rootCert.pfx"
))
{
{
try
try
{
{
rootCertificate
=
new
X509Certificate2
(
"rootCert.pfx"
);
rootCertificate
=
new
X509Certificate2
(
"rootCert.pfx"
,
string
.
Empty
,
X509KeyStorageFlags
.
Exportable
);
if
(
rootCertificate
!=
null
)
{
return
true
;
}
}
}
catch
catch
{
{
}
}
}
}
if
(
rootCertificate
==
null
)
rootCertificate
=
CreateCertificate
(
RootCertificateName
,
true
);
{
rootCertificate
=
CreateCertificate
(
RootCertificateName
,
true
);
}
if
(
rootCertificate
!=
null
)
if
(
rootCertificate
!=
null
)
{
{
try
try
...
@@ -67,7 +70,7 @@ namespace Titanium.Web.Proxy.Network
...
@@ -67,7 +70,7 @@ namespace Titanium.Web.Proxy.Network
}
}
catch
catch
{
{
}
}
}
}
return
rootCertificate
!=
null
;
return
rootCertificate
!=
null
;
...
@@ -94,15 +97,31 @@ namespace Titanium.Web.Proxy.Network
...
@@ -94,15 +97,31 @@ namespace Titanium.Web.Proxy.Network
{
{
}
}
X509Certificate2
certificate
=
null
;
X509Certificate2
certificate
=
certEngine
.
CreateCert
(
certificateName
,
isRootCertificate
,
rootCertificate
);
lock
(
string
.
Intern
(
certificateName
))
if
(
certificate
!=
null
&&
!
certificateCache
.
ContainsKey
(
certificateName
))
{
{
certificateCache
.
Add
(
certificateName
,
new
CachedCertificate
()
{
Certificate
=
certificate
});
if
(
certificateCache
.
ContainsKey
(
certificateName
)
==
false
)
{
Debug
.
WriteLine
(
certificateName
);
certificate
=
certEngine
.
CreateCert
(
certificateName
,
isRootCertificate
,
rootCertificate
);
if
(
certificate
!=
null
&&
!
certificateCache
.
ContainsKey
(
certificateName
))
{
certificateCache
.
Add
(
certificateName
,
new
CachedCertificate
()
{
Certificate
=
certificate
});
}
}
else
{
if
(
certificateCache
.
ContainsKey
(
certificateName
))
{
var
cached
=
certificateCache
[
certificateName
];
cached
.
LastAccess
=
DateTime
.
Now
;
return
cached
.
Certificate
;
}
}
}
}
return
certificate
;
return
certificate
;
}
}
...
...
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