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
648a5d28
Commit
648a5d28
authored
May 11, 2017
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename certificateCacheManager => certificateManager
parent
a0a6e678
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
22 deletions
+24
-22
CertificateManager.cs
Titanium.Web.Proxy/Network/CertificateManager.cs
+4
-4
ProxyServer.cs
Titanium.Web.Proxy/ProxyServer.cs
+18
-16
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+2
-2
No files found.
Titanium.Web.Proxy/Network/CertificateManager.cs
View file @
648a5d28
...
...
@@ -31,9 +31,9 @@ namespace Titanium.Web.Proxy.Network
/// </summary>
internal
class
CertificateManager
:
IDisposable
{
private
const
string
D
efaultRootCertificateIssuer
=
"Titanium"
;
private
const
string
d
efaultRootCertificateIssuer
=
"Titanium"
;
private
const
string
D
efaultRootRootCertificateName
=
"Titanium Root Certificate Authority"
;
private
const
string
d
efaultRootRootCertificateName
=
"Titanium Root Certificate Authority"
;
private
readonly
ICertificateMaker
certEngine
;
...
...
@@ -70,8 +70,8 @@ namespace Titanium.Web.Proxy.Network
certEngine
=
new
WinCertificateMaker
();
}
Issuer
=
issuer
??
D
efaultRootCertificateIssuer
;
RootCertificateName
=
rootCertificateName
??
D
efaultRootRootCertificateName
;
Issuer
=
issuer
??
d
efaultRootCertificateIssuer
;
RootCertificateName
=
rootCertificateName
??
d
efaultRootRootCertificateName
;
certificateCache
=
new
ConcurrentDictionary
<
string
,
CachedCertificate
>();
}
...
...
Titanium.Web.Proxy/ProxyServer.cs
View file @
648a5d28
...
...
@@ -32,7 +32,7 @@ namespace Titanium.Web.Proxy
/// <summary>
/// Manages certificates used by this proxy
/// </summary>
private
CertificateManager
certificate
Cache
Manager
{
get
;
set
;
}
private
CertificateManager
certificateManager
{
get
;
set
;
}
/// <summary>
/// An default exception log func
...
...
@@ -74,35 +74,37 @@ namespace Titanium.Web.Proxy
/// </summary>
public
X509Certificate2
RootCertificate
{
get
{
return
certificate
Cache
Manager
.
RootCertificate
;
}
set
{
certificate
Cache
Manager
.
RootCertificate
=
value
;
}
get
{
return
certificateManager
.
RootCertificate
;
}
set
{
certificateManager
.
RootCertificate
=
value
;
}
}
/// <summary>
/// Name of the root certificate issuer
/// Name of the root certificate issuer
/// (This is valid only when RootCertificate property is not set)
/// </summary>
public
string
RootCertificateIssuerName
{
get
{
return
certificate
Cache
Manager
.
Issuer
;
}
get
{
return
certificateManager
.
Issuer
;
}
set
{
CreateCertificateCacheManager
(
certificate
Cache
Manager
.
RootCertificateName
,
value
);
CreateCertificateCacheManager
(
certificateManager
.
RootCertificateName
,
value
);
certValidated
=
null
;
}
}
/// <summary>
/// Name of the root certificate
/// (This is valid only when RootCertificate property is not set)
/// If no certificate is provided then a default Root Certificate will be created and used
/// The provided root certificate
has to be in the
proxy exe directory with the private key
///
The root certificate file should
be named as "rootCert.pfx"
/// The provided root certificate
will be stored in
proxy exe directory with the private key
///
Root certificate file will
be named as "rootCert.pfx"
/// </summary>
public
string
RootCertificateName
{
get
{
return
certificate
Cache
Manager
.
RootCertificateName
;
}
get
{
return
certificateManager
.
RootCertificateName
;
}
set
{
CreateCertificateCacheManager
(
value
,
certificate
Cache
Manager
.
Issuer
);
CreateCertificateCacheManager
(
value
,
certificateManager
.
Issuer
);
certValidated
=
null
;
}
}
...
...
@@ -447,14 +449,14 @@ namespace Titanium.Web.Proxy
Listen
(
endPoint
);
}
certificate
Cache
Manager
.
ClearIdleCertificates
(
CertificateCacheTimeOutMinutes
);
certificateManager
.
ClearIdleCertificates
(
CertificateCacheTimeOutMinutes
);
proxyRunning
=
true
;
}
private
void
CreateCertificateCacheManager
(
string
rootCertificateName
,
string
rootCertificateIssuerName
)
{
certificate
Cache
Manager
=
new
CertificateManager
(
CertificateEngine
,
certificateManager
=
new
CertificateManager
(
CertificateEngine
,
rootCertificateIssuerName
,
rootCertificateName
,
ExceptionFunc
);
}
...
...
@@ -462,11 +464,11 @@ namespace Titanium.Web.Proxy
{
if
(!
certValidated
.
HasValue
)
{
certValidated
=
certificate
Cache
Manager
.
CreateTrustedRootCertificate
();
certValidated
=
certificateManager
.
CreateTrustedRootCertificate
();
if
(
TrustRootCertificate
)
{
certificate
Cache
Manager
.
TrustRootCertificate
(
ExceptionFunc
);
certificateManager
.
TrustRootCertificate
(
ExceptionFunc
);
}
}
}
...
...
@@ -520,7 +522,7 @@ namespace Titanium.Web.Proxy
ProxyEndPoints
.
Clear
();
certificate
Cache
Manager
?.
StopClearIdleCertificates
();
certificateManager
?.
StopClearIdleCertificates
();
proxyRunning
=
false
;
}
...
...
@@ -648,7 +650,7 @@ namespace Titanium.Web.Proxy
Stop
();
}
certificate
Cache
Manager
?.
Dispose
();
certificateManager
?.
Dispose
();
}
/// <summary>
...
...
Titanium.Web.Proxy/RequestHandler.cs
View file @
648a5d28
...
...
@@ -115,7 +115,7 @@ namespace Titanium.Web.Proxy
sslStream
=
new
SslStream
(
clientStream
,
true
);
var
certificate
=
endPoint
.
GenericCertificate
??
certificate
Cache
Manager
.
CreateCertificate
(
httpRemoteUri
.
Host
,
false
);
var
certificate
=
endPoint
.
GenericCertificate
??
certificateManager
.
CreateCertificate
(
httpRemoteUri
.
Host
,
false
);
//Successfully managed to authenticate the client using the fake certificate
await
sslStream
.
AuthenticateAsServerAsync
(
certificate
,
false
,
...
...
@@ -185,7 +185,7 @@ namespace Titanium.Web.Proxy
var
sslStream
=
new
SslStream
(
clientStream
,
true
);
//implement in future once SNI supported by SSL stream, for now use the same certificate
var
certificate
=
certificate
Cache
Manager
.
CreateCertificate
(
endPoint
.
GenericCertificateName
,
false
);
var
certificate
=
certificateManager
.
CreateCertificate
(
endPoint
.
GenericCertificateName
,
false
);
try
{
...
...
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