-
-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from shibayan/fix-cert-chain
Fixed an issue where intermediate certificates were not included
- Loading branch information
Showing
3 changed files
with
26 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
AzureKeyVault.LetsEncrypt/Internal/X509Certificate2Extension.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using System.Security.Cryptography.X509Certificates; | ||
|
||
namespace AzureKeyVault.LetsEncrypt.Internal | ||
{ | ||
internal static class X509Certificate2Extension | ||
{ | ||
private static ReadOnlySpan<byte> Separator => new byte[] { 0x0A, 0x0A }; | ||
|
||
public static void ImportFromPem(this X509Certificate2Collection collection, byte[] rawData) | ||
{ | ||
var rawDataSpan = rawData.AsSpan(); | ||
|
||
var separator = rawDataSpan.IndexOf(Separator); | ||
|
||
collection.Add(new X509Certificate2(rawDataSpan.Slice(0, separator).ToArray())); | ||
collection.Add(new X509Certificate2(rawDataSpan.Slice(separator + 2).ToArray())); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters