Skip to content

Commit

Permalink
Gracefully handle HTTPS website binding with unbound certificate.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyca15 committed Mar 8, 2017
1 parent 823e32b commit 757b251
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ private static object ToJsonModel(Binding binding)
if (binding.Protocol.Equals("https")) {
X509Certificate2 cert = null;
IEnumerable<X509Certificate2> certs = CertificateHelper.GetCertificates(CertificateHelper.STORE_NAME, CertificateHelper.STORE_LOCATION);
string thumbprint = BitConverter.ToString(binding.CertificateHash)?.Replace("-", string.Empty);
string thumbprint = binding.CertificateHash == null ? null : BitConverter.ToString(binding.CertificateHash)?.Replace("-", string.Empty);

foreach (var c in certs) {
if (c.Thumbprint.Equals(thumbprint, StringComparison.OrdinalIgnoreCase)) {
Expand Down

0 comments on commit 757b251

Please sign in to comment.