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
38a3bd84
Commit
38a3bd84
authored
Jun 28, 2017
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use SNI for transparent Endpoint
parent
1a61213f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+12
-6
No files found.
Titanium.Web.Proxy/RequestHandler.cs
View file @
38a3bd84
...
@@ -218,14 +218,20 @@ namespace Titanium.Web.Proxy
...
@@ -218,14 +218,20 @@ namespace Titanium.Web.Proxy
{
{
if
(
endPoint
.
EnableSsl
)
if
(
endPoint
.
EnableSsl
)
{
{
var
sslStream
=
new
SslStream
(
clientStream
);
var
clientSslHelloInfo
=
await
HttpsTools
.
GetClientHelloInfo
(
clientStream
);
clientStream
=
new
CustomBufferedStream
(
sslStream
,
BufferSize
);
//implement in future once SNI supported by SSL stream, for now use the same certificate
if
(
clientSslHelloInfo
!=
null
)
var
certificate
=
CertificateManager
.
CreateCertificate
(
endPoint
.
GenericCertificateName
,
false
);
{
var
sslStream
=
new
SslStream
(
clientStream
);
clientStream
=
new
CustomBufferedStream
(
sslStream
,
BufferSize
);
string
sniHostName
=
clientSslHelloInfo
.
Extensions
.
FirstOrDefault
(
x
=>
x
.
Name
==
"server_name"
)?.
Data
;
//Successfully managed to authenticate the client using the fake certificate
var
certificate
=
CertificateManager
.
CreateCertificate
(
sniHostName
??
endPoint
.
GenericCertificateName
,
false
);
await
sslStream
.
AuthenticateAsServerAsync
(
certificate
,
false
,
SslProtocols
.
Tls
,
false
);
//Successfully managed to authenticate the client using the fake certificate
await
sslStream
.
AuthenticateAsServerAsync
(
certificate
,
false
,
SslProtocols
.
Tls
,
false
);
}
//HTTPS server created - we can now decrypt the client's traffic
//HTTPS server created - we can now decrypt the client's traffic
}
}
...
...
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