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
c30b918b
Unverified
Commit
c30b918b
authored
Feb 23, 2018
by
mohammadlachgar
Committed by
GitHub
Feb 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete spaces and new lines(entr)
parent
a1ab56e7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
10 deletions
+4
-10
BCCertificateMaker.cs
Titanium.Web.Proxy/Network/Certificate/BCCertificateMaker.cs
+4
-10
No files found.
Titanium.Web.Proxy/Network/Certificate/BCCertificateMaker.cs
View file @
c30b918b
using
System
;
using
System
;
using
System.Collections
;
using
System.IO
;
using
System.IO
;
using
System.Reflection
;
using
System.Security.Cryptography.X509Certificates
;
using
System.Security.Cryptography.X509Certificates
;
using
System.Threading
;
using
System.Threading
;
using
Org.BouncyCastle.Asn1
;
using
Org.BouncyCastle.Asn1
;
...
@@ -70,7 +68,7 @@ namespace Titanium.Web.Proxy.Network.Certificate
...
@@ -70,7 +68,7 @@ namespace Titanium.Web.Proxy.Network.Certificate
string
issuerName
,
DateTime
validFrom
,
string
issuerName
,
DateTime
validFrom
,
DateTime
validTo
,
int
keyStrength
=
2048
,
DateTime
validTo
,
int
keyStrength
=
2048
,
string
signatureAlgorithm
=
"SHA256WithRSA"
,
string
signatureAlgorithm
=
"SHA256WithRSA"
,
AsymmetricKeyParameter
issuerPrivateKey
=
null
,
X509Certificate2
cloneCertificate
=
null
)
AsymmetricKeyParameter
issuerPrivateKey
=
null
)
{
{
// Generating Random Numbers
// Generating Random Numbers
var
randomGenerator
=
new
CryptoApiRandomGenerator
();
var
randomGenerator
=
new
CryptoApiRandomGenerator
();
...
@@ -107,7 +105,6 @@ namespace Titanium.Web.Proxy.Network.Certificate
...
@@ -107,7 +105,6 @@ namespace Titanium.Web.Proxy.Network.Certificate
keyPairGenerator
.
Init
(
keyGenerationParameters
);
keyPairGenerator
.
Init
(
keyGenerationParameters
);
var
subjectKeyPair
=
keyPairGenerator
.
GenerateKeyPair
();
var
subjectKeyPair
=
keyPairGenerator
.
GenerateKeyPair
();
certificateGenerator
.
SetPublicKey
(
subjectKeyPair
.
Public
);
certificateGenerator
.
SetPublicKey
(
subjectKeyPair
.
Public
);
// Set certificate intended purposes to only Server Authentication
// Set certificate intended purposes to only Server Authentication
...
@@ -137,7 +134,7 @@ namespace Titanium.Web.Proxy.Network.Certificate
...
@@ -137,7 +134,7 @@ namespace Titanium.Web.Proxy.Network.Certificate
rsa
.
Exponent2
,
rsa
.
Coefficient
);
rsa
.
Exponent2
,
rsa
.
Coefficient
);
#if NET45
#if NET45
// Set private key onto certificate instance
X509Certificate2
// Set private key onto certificate instance
var
x509Certificate
=
new
X509Certificate2
(
certificate
.
GetEncoded
());
var
x509Certificate
=
new
X509Certificate2
(
certificate
.
GetEncoded
());
x509Certificate
.
PrivateKey
=
DotNetUtilities
.
ToRSA
(
rsaparams
);
x509Certificate
.
PrivateKey
=
DotNetUtilities
.
ToRSA
(
rsaparams
);
#else
#else
...
@@ -202,11 +199,8 @@ namespace Titanium.Web.Proxy.Network.Certificate
...
@@ -202,11 +199,8 @@ namespace Titanium.Web.Proxy.Network.Certificate
}
}
else
else
{
{
var
kp
=
DotNetUtilities
.
GetKeyPair
(
signingCertificate
.
PrivateKey
);
var
kp
=
DotNetUtilities
.
GetKeyPair
(
signingCertificate
.
PrivateKey
);
return
GenerateCertificate
(
hostName
,
subjectName
,
signingCertificate
.
Subject
,
validFrom
,
validTo
,
issuerPrivateKey
:
kp
.
Private
);
return
GenerateCertificate
(
hostName
,
subjectName
,
signingCertificate
.
Subject
,
validFrom
,
validTo
,
issuerPrivateKey
:
kp
.
Private
);
}
}
}
}
...
...
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