Skip to content

Commit

Permalink
try fix for issuer subject key issue
Browse files Browse the repository at this point in the history
Signed-off-by: lemccomb <117306942+lemccomb@users.noreply.github.com>
  • Loading branch information
lemccomb authored Aug 3, 2023
1 parent 8537680 commit 9e0da5c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CoseSignTool/CoseSign1.Tests.Common/TestCertificateUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public static X509Certificate2 CreateCertificate(
// support, so it needs to be copied from the Subject Key
// Identifier of the signing certificate and massaged slightly.
// AuthorityKeyIdentifier is "KeyID=<subject key identifier>"
byte[] issuerSubjectKey = issuingCa.Extensions?["Subject Key Identifier"]?.RawData ?? throw new ArgumentOutOfRangeException(nameof(issuingCa), @"Issuing CA did not a ""Subject Key Identifier"" extension present");
// byte[] issuerSubjectKey = issuingCa.Extensions?["Subject Key Identifier"]?.RawData ?? throw new ArgumentOutOfRangeException(nameof(issuingCa), @"Issuing CA did not a ""Subject Key Identifier"" extension present");
byte[] issuerSubjectKey = issuingCa.Extensions.First(x => x is X509SubjectKeyIdentifierExtension)?.RawData ?? throw new ArgumentOutOfRangeException(nameof(issuingCa), @"Issuing CA did not a ""Subject Key Identifier"" extension present");
ArraySegment<byte> segment = new(issuerSubjectKey, 2, issuerSubjectKey.Length - 2);
byte[] authorityKeyIdentifier = new byte[segment.Count + 4];
// these bytes define the "KeyID" part of the AuthorityKeyIdentifer
Expand Down

0 comments on commit 9e0da5c

Please sign in to comment.