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
194a5f6f
Commit
194a5f6f
authored
Sep 26, 2016
by
ilushka85
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for external error logging func - only implemented in cert area
parent
935ca66f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
9 deletions
+44
-9
CertEnrollEngine.cs
Titanium.Web.Proxy/Network/CertEnrollEngine.cs
+2
-2
CertificateManager.cs
Titanium.Web.Proxy/Network/CertificateManager.cs
+20
-7
ProxyServer.cs
Titanium.Web.Proxy/ProxyServer.cs
+22
-0
No files found.
Titanium.Web.Proxy/Network/CertEnrollEngine.cs
View file @
194a5f6f
...
@@ -195,7 +195,7 @@ namespace Titanium.Web.Proxy.Network
...
@@ -195,7 +195,7 @@ namespace Titanium.Web.Proxy.Network
private
X509Certificate2
InternalCreateCert
(
string
sSubjectCN
,
bool
isRoot
,
bool
switchToMTAIfNeeded
,
X509Certificate2
signingCert
=
null
)
private
X509Certificate2
InternalCreateCert
(
string
sSubjectCN
,
bool
isRoot
,
bool
switchToMTAIfNeeded
,
X509Certificate2
signingCert
=
null
)
{
{
X509Certificate2
rCert
=
null
;
X509Certificate2
rCert
=
null
;
if
(
switchToMTAIfNeeded
&&
Thread
.
CurrentThread
.
GetApartmentState
()
!=
ApartmentState
.
MTA
)
if
(
switchToMTAIfNeeded
&&
Thread
.
CurrentThread
.
GetApartmentState
()
!=
ApartmentState
.
MTA
)
{
{
ManualResetEvent
manualResetEvent
=
new
ManualResetEvent
(
false
);
ManualResetEvent
manualResetEvent
=
new
ManualResetEvent
(
false
);
...
@@ -229,7 +229,7 @@ namespace Titanium.Web.Proxy.Network
...
@@ -229,7 +229,7 @@ namespace Titanium.Web.Proxy.Network
}
}
catch
(
Exception
e
)
catch
(
Exception
e
)
{
{
return
null
;
throw
e
;
}
}
return
rCert
;
return
rCert
;
}
}
...
...
Titanium.Web.Proxy/Network/CertificateManager.cs
View file @
194a5f6f
...
@@ -55,22 +55,28 @@ namespace Titanium.Web.Proxy.Network
...
@@ -55,22 +55,28 @@ namespace Titanium.Web.Proxy.Network
return
true
;
return
true
;
}
}
}
}
catch
catch
(
Exception
e
)
{
{
ProxyServer
.
ExceptionFunc
(
e
);
}
}
}
}
rootCertificate
=
CreateCertificate
(
RootCertificateName
,
true
);
try
{
rootCertificate
=
CreateCertificate
(
RootCertificateName
,
true
);
}
catch
(
Exception
e
)
{
ProxyServer
.
ExceptionFunc
(
e
);
}
if
(
rootCertificate
!=
null
)
if
(
rootCertificate
!=
null
)
{
{
try
try
{
{
File
.
WriteAllBytes
(
"rootCert.pfx"
,
rootCertificate
.
Export
(
X509ContentType
.
Pkcs12
));
File
.
WriteAllBytes
(
"rootCert.pfx"
,
rootCertificate
.
Export
(
X509ContentType
.
Pkcs12
));
}
}
catch
catch
(
Exception
e
)
{
{
ProxyServer
.
ExceptionFunc
(
e
);
}
}
}
}
return
rootCertificate
!=
null
;
return
rootCertificate
!=
null
;
...
@@ -102,7 +108,14 @@ namespace Titanium.Web.Proxy.Network
...
@@ -102,7 +108,14 @@ namespace Titanium.Web.Proxy.Network
{
{
if
(
certificateCache
.
ContainsKey
(
certificateName
)
==
false
)
if
(
certificateCache
.
ContainsKey
(
certificateName
)
==
false
)
{
{
certificate
=
certEngine
.
CreateCert
(
certificateName
,
isRootCertificate
,
rootCertificate
);
try
{
certificate
=
certEngine
.
CreateCert
(
certificateName
,
isRootCertificate
,
rootCertificate
);
}
catch
(
Exception
e
)
{
ProxyServer
.
ExceptionFunc
(
e
);
}
if
(
certificate
!=
null
&&
!
certificateCache
.
ContainsKey
(
certificateName
))
if
(
certificate
!=
null
&&
!
certificateCache
.
ContainsKey
(
certificateName
))
{
{
certificateCache
.
Add
(
certificateName
,
new
CachedCertificate
()
{
Certificate
=
certificate
});
certificateCache
.
Add
(
certificateName
,
new
CachedCertificate
()
{
Certificate
=
certificate
});
...
...
Titanium.Web.Proxy/ProxyServer.cs
View file @
194a5f6f
...
@@ -18,6 +18,28 @@ namespace Titanium.Web.Proxy
...
@@ -18,6 +18,28 @@ namespace Titanium.Web.Proxy
/// </summary>
/// </summary>
public
partial
class
ProxyServer
:
IDisposable
public
partial
class
ProxyServer
:
IDisposable
{
{
private
static
Action
<
Exception
>
_exceptionFunc
=
null
;
public
static
Action
<
Exception
>
ExceptionFunc
{
get
{
if
(
_exceptionFunc
!=
null
)
{
return
_exceptionFunc
;
}
else
{
return
(
e
)=>
{
};
}
}
set
{
_exceptionFunc
=
value
;
}
}
public
Func
<
string
,
string
,
Task
<
bool
>>
AuthenticateUserFunc
public
Func
<
string
,
string
,
Task
<
bool
>>
AuthenticateUserFunc
{
{
get
;
get
;
...
...
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