Skip to content

Commit dae1517

Browse files
.cer extensions accepted in load method too
1 parent 5e979fd commit dae1517

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Concerto/CertificateFileStore.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public static class CertificateFileStore
2020
/// <param name="cert">A certificate to save.</param>
2121
/// <param name="path">
2222
/// The path to the destination file. The file extension is important and defines the format
23-
/// of the encoding (currently we support only PKCS12 (.pfx) and PEM (.pem) formats). If it's PEM
23+
/// of the encoding (currently we support only PKCS12 (.pfx) and PEM (.pem, .cer) formats). If it's PEM
2424
/// a new file will be created next to the certificate file with a .key extension.
2525
/// </param>
2626
/// <param name="chain">
@@ -126,7 +126,7 @@ private static void SavePemCertificate(CertificateChainWithPrivateKey certChainW
126126
/// </summary>
127127
/// <param name="path">
128128
/// A path to the certificate file. The format of the encoding is guessed from
129-
/// the file extension. Only PKCS12 (.pfx) and PEM (.pem) formats are recognized.
129+
/// the file extension. Only PKCS12 (.pfx) and PEM (.pem, .cer) formats are recognized.
130130
/// </param>
131131
/// <returns>The certificate representation.</returns>
132132
public static CertificateChainWithPrivateKey LoadCertificate(string path)
@@ -138,6 +138,7 @@ public static CertificateChainWithPrivateKey LoadCertificate(string path)
138138

139139
return Path.GetExtension(path) switch {
140140
var s when string.IsNullOrEmpty(s) || string.Equals(".pem", s, StringComparison.OrdinalIgnoreCase)
141+
|| string.Equals(".cer", s, StringComparison.OrdinalIgnoreCase)
141142
=> LoadPemCertificate(path),
142143
var s when string.Equals(".pfx", s, StringComparison.OrdinalIgnoreCase) => LoadPfxCertificate(path),
143144
var s => throw new ArgumentException(

0 commit comments

Comments
 (0)