From 50b1c85b503408eb244f3ee555ad0ca13f71c846 Mon Sep 17 00:00:00 2001 From: xljiulang <366193849@qq.com> Date: Sun, 18 Sep 2022 02:14:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=97=A0SubjectKeyIdentifier?= =?UTF-8?q?=E7=9A=84ca=E8=AF=81=E4=B9=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FastGithub.HttpServer/Certs/CertGenerator.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/FastGithub.HttpServer/Certs/CertGenerator.cs b/FastGithub.HttpServer/Certs/CertGenerator.cs index b1ed7f3..8bb00ff 100644 --- a/FastGithub.HttpServer/Certs/CertGenerator.cs +++ b/FastGithub.HttpServer/Certs/CertGenerator.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Net; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; @@ -136,11 +135,11 @@ namespace FastGithub.HttpServer.Certs private static X509Extension GetAuthorityKeyIdentifierExtension(X509Certificate2 certificate) - { + { + var extension = new X509SubjectKeyIdentifierExtension(certificate.PublicKey, false); #if NET7_0_OR_GREATER - return X509AuthorityKeyIdentifierExtension.CreateFromCertificate(certificate, true, false); + return X509AuthorityKeyIdentifierExtension.CreateFromSubjectKeyIdentifier(extension); #else - var extension = certificate.Extensions.OfType().First(); var subjectKeyIdentifier = extension.RawData.AsSpan(2); var rawData = new byte[subjectKeyIdentifier.Length + 4]; rawData[0] = 0x30;