diff --git a/Directory.Build.props b/Directory.Build.props
index eea3576..64b3a6c 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -2,7 +2,7 @@
2.1.4
enable
- net6.0
+ net7.0
true
github加速神器
https://github.com/dotnetcore/FastGithub
diff --git a/FastGithub.Configuration/FastGithub.Configuration.csproj b/FastGithub.Configuration/FastGithub.Configuration.csproj
index 4afc5f0..c18dd9e 100644
--- a/FastGithub.Configuration/FastGithub.Configuration.csproj
+++ b/FastGithub.Configuration/FastGithub.Configuration.csproj
@@ -1,7 +1,7 @@
-
+
diff --git a/FastGithub.DomainResolve/FastGithub.DomainResolve.csproj b/FastGithub.DomainResolve/FastGithub.DomainResolve.csproj
index 4caca5a..7ae4c7a 100644
--- a/FastGithub.DomainResolve/FastGithub.DomainResolve.csproj
+++ b/FastGithub.DomainResolve/FastGithub.DomainResolve.csproj
@@ -1,11 +1,11 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/FastGithub.Http/FastGithub.Http.csproj b/FastGithub.Http/FastGithub.Http.csproj
index 93653c3..e621b9a 100644
--- a/FastGithub.Http/FastGithub.Http.csproj
+++ b/FastGithub.Http/FastGithub.Http.csproj
@@ -1,7 +1,6 @@
-
-
+
diff --git a/FastGithub.Http/HttpClientHandler.cs b/FastGithub.Http/HttpClientHandler.cs
index f7f5ec8..61310bb 100644
--- a/FastGithub.Http/HttpClientHandler.cs
+++ b/FastGithub.Http/HttpClientHandler.cs
@@ -1,7 +1,6 @@
using FastGithub.Configuration;
using FastGithub.DomainResolve;
using System;
-using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -200,32 +199,15 @@ namespace FastGithub.Http
///
private static IEnumerable ReadDnsNames(X509Certificate? cert)
{
- if (cert == null)
+ if (cert is X509Certificate2 x509)
{
- yield break;
- }
- var parser = new Org.BouncyCastle.X509.X509CertificateParser();
- var x509Cert = parser.ReadCertificate(cert.GetRawCertData());
- var subjects = x509Cert.GetSubjectAlternativeNames();
- if (subjects == null)
- {
- yield break;
- }
-
- foreach (var subject in subjects)
- {
- if (subject is IList list)
+ var extension = x509.Extensions.OfType().FirstOrDefault();
+ if (extension != null)
{
- if (list.Count >= 2 && list[0] is int nameType && nameType == 2)
- {
- var dnsName = list[1]?.ToString();
- if (dnsName != null)
- {
- yield return dnsName;
- }
- }
+ return extension.EnumerateDnsNames();
}
}
+ return Array.Empty();
}
///
diff --git a/FastGithub.HttpServer/Certs/CertService.cs b/FastGithub.HttpServer/Certs/CertService.cs
index 7296fa8..9ae1abe 100644
--- a/FastGithub.HttpServer/Certs/CertService.cs
+++ b/FastGithub.HttpServer/Certs/CertService.cs
@@ -70,12 +70,10 @@ namespace FastGithub.HttpServer.Certs
var subjectName = new X500DistinguishedName($"CN={nameof(FastGithub)}");
this.caCert = CertGenerator.CreateCACertificate(subjectName, notBefore, notAfter);
- var privateKey = this.caCert.GetRSAPrivateKey()?.ExportRSAPrivateKey();
- var privateKeyPem = PemEncoding.Write("RSA PRIVATE KEY", privateKey);
+ var privateKeyPem = this.caCert.GetRSAPrivateKey()?.ExportRSAPrivateKeyPem();
File.WriteAllText(this.CaKeyFilePath, new string(privateKeyPem), Encoding.ASCII);
- var cert = this.caCert.Export(X509ContentType.Cert);
- var certPem = PemEncoding.Write("CERTIFICATE", cert);
+ var certPem = this.caCert.ExportCertificatePem();
File.WriteAllText(this.CaCerFilePath, new string(certPem), Encoding.ASCII);
return true;
diff --git a/FastGithub.HttpServer/FastGithub.HttpServer.csproj b/FastGithub.HttpServer/FastGithub.HttpServer.csproj
index d5c76a3..339d956 100644
--- a/FastGithub.HttpServer/FastGithub.HttpServer.csproj
+++ b/FastGithub.HttpServer/FastGithub.HttpServer.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/FastGithub.PacketIntercept/FastGithub.PacketIntercept.csproj b/FastGithub.PacketIntercept/FastGithub.PacketIntercept.csproj
index 51be4f4..508720b 100644
--- a/FastGithub.PacketIntercept/FastGithub.PacketIntercept.csproj
+++ b/FastGithub.PacketIntercept/FastGithub.PacketIntercept.csproj
@@ -6,8 +6,7 @@
-
-
+
diff --git a/FastGithub/FastGithub.csproj b/FastGithub/FastGithub.csproj
index 6aeb733..57ea9e4 100644
--- a/FastGithub/FastGithub.csproj
+++ b/FastGithub/FastGithub.csproj
@@ -9,8 +9,8 @@
-
-
+
+
@@ -18,10 +18,10 @@
-
-
+
+
-
+