%3CLINGO-SUB%20id%3D%22lingo-sub-1616682%22%20slang%3D%22en-US%22%3EChecking%20the%20certificate%20trust%20chain%20for%20an%20HTTPS%20endpoint%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1616682%22%20slang%3D%22en-US%22%3E%3CP%3ESometimes%20our%20client%20apps%2C%20including%20browsers%2C%20are%20unable%20or%20unwilling%20to%20connect%20to%20an%20HTTPS%20site.%20A%20common%20cause%3A%20the%20certificate%20presented%20by%20the%20server%20endpoint%20fails%20the%20validation%3B%20the%20client%20does%20not%20trust%20the%20certificate%20presented%20by%20the%20server.%20This%20article%20is%20a%20continuation%20of%20%3CA%20href%3D%22http%3A%2F%2Flinqto.me%2Fhttps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Flinqto.me%2Fhttps%3C%2FA%3E.%3C%2FP%3E%0A%3CP%20title%3D%22context%22%3E%3CA%20id%3D%22context%22%20target%3D%22_blank%22%20name%3D%22context%22%3E%3C%2FA%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1269595793%22%20id%3D%22toc-hId--1269595793%22%3EA%20bit%20of%20context%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOn%202020%20August%2019%3CSUP%3Eth%3C%2FSUP%3E%2C%20the%20Azure%20SignalR%20Service%20rotated%20(renewed)%20the%20authenticating%20certificate%20used%20by%20its%20endpoints.%20The%20entire%20trust%20chain%20has%20changed.%3CBR%20%2F%3EIn%20some%20situations%2C%20the%20ASRS%20clients%20or%20the%20hubs%20could%20no%20longer%20connect%20to%20the%20service%2C%20with%20an%20error%20like%3A%3C%2FP%3E%0A%3CPRE%3EERROR%20Failed%20to%20connect%20to%20'%3CA%20href%3D%22https%3A%2F%2FresourceName.service.signalr.net%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2FresourceName.service.signalr.net%3C%2FA%3E'%2C%20will%20retry%20after%20the%20back%20off%20period.%3CBR%20%2F%3EError%20detail%3A%20Unable%20to%20connect%20to%20the%20remote%20server.%20The%20remote%20certificate%20is%20invalid%20according%20to%20the%20validation%20procedure.%20Id%3A%20%26lt%3BGUID-here%26gt%3B%3C%2FPRE%3E%0A%3CP%3EOf%20course%2C%20the%20first%20thought%20is%20to%20check%20the%20certificate%20that%20the%20service%20is%20presenting.%3C%2FP%3E%0A%3CP%3EDuring%20the%20TLS%20handshake%2C%20when%20the%20secure%20channel%20is%20established%20for%20HTTPS%2C%20before%20any%20HTTP%20traffic%20can%20take%20place%2C%20the%20server%20is%20presenting%20its%20certificate.%20The%20server%20has%20to%20authenticate%20itself.%20And%20the%20client%20is%20checking%20the%20certificate%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EIs%20the%20certificate%20still%20valid%3F%20Isn%E2%80%99t%20it%20expired%3F%3C%2FLI%3E%0A%3CLI%3EIs%20the%20certificate%20issued%20for%20the%20domain%20that%20the%20server%20claims%20to%20be%3F%20Does%20the%20Subject%20name%20in%20the%20certificate%20match%20the%20site%20name%20(host-name)%20of%20the%20endpoint%20URL%3F%3C%2FLI%3E%0A%3CLI%3EDoes%20the%20client%20trust%20the%20certificate%20chain%3F%20Does%20it%20trust%20the%20issuing%20authority%20or%20the%20entity%20endorsing%20the%20certificate%20authority%3F%3C%2FLI%3E%0A%3CLI%3EWas%20the%20certificate%20revoked%20by%20its%20issuing%20authority%3F%3C%2FLI%3E%0A%3CLI%3EDo%20the%20cryptographic%20details%20match%2C%20key%20and%20algorithms%3F%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EBelow%2C%20we%20treat%20a%20bit%20on%20the%20third%20question%3A%20trusting%20the%20certificate%20chain.%20We%20check%20certificate%20identifiers%20against%20the%20Windows%20certificate%20store.%3C%2FP%3E%0A%3CP%20title%3D%22cert-chain%22%3E%3CA%20id%3D%22cert-chain%22%20target%3D%22_blank%22%20name%3D%22cert-chain%22%3E%3C%2FA%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1217917040%22%20id%3D%22toc-hId-1217917040%22%3ECertificate%20chain%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESo%20what%E2%80%99s%20the%20certificate%E2%80%99s%20trust%20chain%3F%20Well%2C%20the%20certificate%20of%20a%20server%20is%20issued%20by%20an%20authority%20that%20checks%20somehow%20the%20authenticity%20of%20that%20server%20or%20service.%20We%20call%20it%20the%20Certificate%20Authority%20or%20Issuing%20Authority.%20That%20authority%20should%20be%20trusted.%20Or%20we%20should%20trust%2C%20at%20least%2C%20the%20authority%20that%20is%20endorsing%20the%20Issuing%20Authority%2C%20which%20we%20call%20Root%20Authority.%20Sometimes%2C%20this%20chain%20of%20certification%20may%20be%20even%20longer.%3C%2FP%3E%0A%3CP%3EFor%20a%20public%20HTTPS%20endpoint%2C%20we%20could%20use%20an%20online%20service%20to%20check%20its%20certificate.%20For%20my%20Azure%20SignalR%20Service%20instance%2C%20using%20the%20%3CA%20href%3D%22https%3A%2F%2Fwww.ionos.com%2Ftools%2Fssl-checker%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EIonos%20SSL%20Checker%3C%2FA%3E%2C%20I%20get%20the%20following%20chain%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Viorel-Alexandru_0-1598543572178.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F215054iB054F4DF7F960E4E%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Viorel-Alexandru_0-1598543572178.png%22%20alt%3D%22A%20certificate%20trust%20chain%2C%20from%20the%20Root%20Authority%20down%20to%20authenticated%20service%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EA%20certificate%20trust%20chain%2C%20from%20the%20Root%20Authority%20down%20to%20authenticated%20service%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20can%20easily%20see%20the%20entire%20chain%3B%20each%20entity%20is%20identified%20with%20its%20own%20certificate.%20Reading%20from%20bottom%20up%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EThe%20certificate%20of%20the%20service%2C%20used%20to%20authenticate%20to%20its%20clients%3C%2FLI%3E%0A%3CLI%3EThe%20Issuing%20Authority%2C%20the%20one%20that%20signed%20and%20generated%20the%20service%20certificate%3C%2FLI%3E%0A%3CLI%3EThe%20Root%20Authority%2C%20the%20one%20that%20is%20endorsing%20the%20Issuing%20Authority%20to%20release%20certificates%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EThere%20are%20other%20SSL%20certificate%20test%20services%20too%20online%2C%20such%20as%20the%20%3CA%20href%3D%22https%3A%2F%2Fwww.ssllabs.com%2Fssltest%2Fanalyze.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eone%20from%20SSLlabs.com%3C%2FA%3E.%20And%20we%20can%20also%20use%20a%20browser%20or%20even%20a%20network%20trace%20(such%20as%20with%20Wireshark)%20to%20see%20a%20certificate%20chain.%3C%2FP%3E%0A%3CP%20title%3D%22cert-id%22%3E%3CA%20id%3D%22cert-id%22%20target%3D%22_blank%22%20name%3D%22cert-id%22%3E%3C%2FA%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--589537423%22%20id%3D%22toc-hId--589537423%22%3EIdentify%20the%20certificate%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECertificates%20can%20be%20identified%20with%20several%20of%20their%20properties.%20But%2C%20to%20check%20them%20in%20the%20Windows%20certificate%20store%20easily%2C%20we%20could%20use%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EEither%20the%20%3CSTRONG%3E%3CEM%3ESerial%20number%3C%2FEM%3E%3C%2FSTRONG%3E%20of%20the%20certificate%2C%3C%2FLI%3E%0A%3CLI%3EOr%20its%20%3CSTRONG%3E%3CEM%3EThumbprint%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20which%20is%20the%20%3CEM%3ESHA-1%20Fingerprint%20%3CSTRONG%3EHash%3C%2FSTRONG%3E%3C%2FEM%3E%20computed%20from%20the%20certificate%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThe%20%3CSTRONG%3E%3CEM%3ESerial%20number%3C%2FEM%3E%3C%2FSTRONG%3E%20of%20the%20certificate%20is%20displayed%20by%20most%20of%20the%20SSL%20checking%20services.%20Illustrating%20with%20the%20output%20of%20the%20%3CA%20href%3D%22https%3A%2F%2Fwww.ionos.com%2Ftools%2Fssl-checker%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EIonos%20SSL%20Checker%3C%2FA%3E%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Viorel-Alexandru_1-1598543572196.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F215056i42951E7866BB81DC%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Viorel-Alexandru_1-1598543572196.png%22%20alt%3D%22Viorel-Alexandru_1-1598543572196.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMost%20of%20the%20browsers%20allow%20to%20see%20the%20certificate%20of%20an%20HTTPS%20site%2C%20along%20with%20the%20trust%20chain.%20Identifiers%20can%20be%20picked%20from%20there%20too.%20For%20instance%2C%20using%20Firefox%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Viorel-Alexandru_2-1598543572202.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F215055i685C51A7AEA3F641%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Viorel-Alexandru_2-1598543572202.png%22%20alt%3D%22Viorel-Alexandru_2-1598543572202.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Viorel-Alexandru_3-1598543572205.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F215057i34FF3A6344B7EE68%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Viorel-Alexandru_3-1598543572205.png%22%20alt%3D%22Viorel-Alexandru_3-1598543572205.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Viorel-Alexandru_4-1598543572211.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F215059i5F73D6A8E15F2FD9%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Viorel-Alexandru_4-1598543572211.png%22%20alt%3D%22Viorel-Alexandru_4-1598543572211.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Viorel-Alexandru_5-1598543572216.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F215058i6D6CD653A1954DA5%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Viorel-Alexandru_5-1598543572216.png%22%20alt%3D%22Viorel-Alexandru_5-1598543572216.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3ENote%3C%2FEM%3E%3C%2FSTRONG%3E%3CEM%3E%3A%20With%20certificates%20of%20Root%20Authority%2C%20the%20Issuer%20of%20the%20certificate%20is%20the%20authority%20itself%3B%20this%20is%20how%20we%20tell%20that%20this%20is%20a%20Root%20Authority%20certificate.%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%3CEM%3E%26nbsp%3B%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Viorel-Alexandru_6-1598543572223.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F215061iABBD24BA994B4A7E%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Viorel-Alexandru_6-1598543572223.png%22%20alt%3D%22The%20certificate%20Thumprint%20is%20a%20computed%20Hash%2C%20SHA-1%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EThe%20certificate%20Thumprint%20is%20a%20computed%20Hash%2C%20SHA-1%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMicrosoft%20browsers%2C%20like%20Edge%20Chromium%2C%20are%20also%20displaying%20certificates%20in%20a%20window%20that%20is%20familiar%20from%20the%20Windows%20certificate%20store.%3CBR%20%2F%3EThe%20trust%20chain%20can%20be%20navigated%3B%20we%20can%20see%20each%20certificate%2C%20for%20each%20entity%20in%20the%20chain%2C%20to%20check%20if%20they%20are%20OK%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Viorel-Alexandru_7-1598543572226.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F215060iF3AF8D05AC23FB98%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Viorel-Alexandru_7-1598543572226.png%22%20alt%3D%22Viorel-Alexandru_7-1598543572226.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Viorel-Alexandru_8-1598543572230.png%22%20style%3D%22width%3A%20277px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F215062i9D3937DAB4A92B4E%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Viorel-Alexandru_8-1598543572230.png%22%20alt%3D%22Certificate%20fields%20as%20shown%20by%20Windows%20UI%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ECertificate%20fields%20as%20shown%20by%20Windows%20UI%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20we%20can%E2%80%99t%20use%20a%20browser%20or%20an%20online%20service%20%E2%80%93%20maybe%20because%20of%20an%20internal%20environment%20that%20prevents%20getting%20the%20presented%20certificate%20chain%20this%20way%20%E2%80%93%20we%20can%20use%20a%20network%20trace%2C%20such%20as%20one%20taken%20with%20%3CA%20href%3D%22https%3A%2F%2Fwww.wireshark.org%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EWireshark%3C%2FA%3E%3A%3CBR%20%2F%3ELet%E2%80%99s%20remember%20that%2C%20in%20TLS%20negotiation%2C%20after%20Client%20Hello%20and%20Server%20Hello%2C%20the%20server%20would%20present%20its%20certificate%20to%20authenticate%20itself%20to%20the%20client.%3CBR%20%2F%3ESo%2C%20in%20a%20network%20trace%2C%20we%20see%20the%20certificates%2C%20each%20with%20its%20%3CSTRONG%3E%3CEM%3ESerial%20Number%3C%2FEM%3E%3C%2FSTRONG%3E%20and%20%3CSTRONG%3E%3CEM%3EIssuer%3C%2FEM%3E%3C%2FSTRONG%3E%20information%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Viorel-Alexandru_9-1598543572240.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F215063iA9F9011AC3C30206%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Viorel-Alexandru_9-1598543572240.png%22%20alt%3D%22A%20network%20trace%20with%20Wireshark%20reveals%20the%20server%20certificate%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EA%20network%20trace%20with%20Wireshark%20reveals%20the%20server%20certificate%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20title%3D%22check-store%22%3E%3CA%20id%3D%22check-store%22%20target%3D%22_blank%22%20name%3D%22check-store%22%3E%3C%2FA%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1897975410%22%20id%3D%22toc-hId-1897975410%22%3EChecking%20certificate%20store%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20that%20we%20know%20the%20certificate%20chain%2C%20with%20the%20identifiers%20of%20the%20certificates%2C%20we%20should%20check%20if%20our%20client%20accessing%20the%20service%20trusts%20the%20chain.%3C%2FP%3E%0A%3CP%3EMicrosoft%20applications%20and%20frameworks%20would%20use%20the%20Microsoft%20cryptographic%20API%20(CAPI)%2C%20and%20that%20includes%20Microsoft%20browsers.%20Other%20browsers%20or%20technologies%20may%20use%20other%20APIs%20or%20crypto%20libraries%20for%20validating%20certificates.%20But%20Windows%20relies%20on%20its%20certificate%20store.%20So%2C%20we%20need%20to%20check%20if%20an%20issuing%20authority%20or%20its%20endorsing%20authority%20is%20trusted%3A%20does%20its%20certificate%20appear%20in%20the%20certificate%20store%2C%20in%20the%20needed%20location%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1706430412%22%20id%3D%22toc-hId--1706430412%22%3EUsing%20certificates%20console%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EUsing%20the%20UI%2C%20we%20open%20%3CSTRONG%3E%3CEM%3EManage%20%3CU%3EComputer%3C%2FU%3E%20Certificate%3C%2FEM%3E%3C%2FSTRONG%3E%20or%20%3CSTRONG%3E%3CEM%3EManage%20%3CU%3EUser%3C%2FU%3E%20Certificate%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20depending%20if%20the%20client%20is%20a%20service%2C%20like%20an%20IIS-hosted%20Web%20application%2C%20or%20a%20desktop%20application%20running%20under%20a%20user%E2%80%99s%20security%20context.%3C%2FP%3E%0A%3CP%3EOpening%20the%20certificates%20console%2C%20we%20check%20the%20%3CSTRONG%3E%3CEM%3ETrusted%2FThird-Party%20Root%20Certification%20Authorities%3C%2FEM%3E%3C%2FSTRONG%3E%20or%20the%20%3CSTRONG%3E%3CEM%3EIntermediate%20Certification%20Authorities%3C%2FEM%3E%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Viorel-Alexandru_10-1598543572253.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F215064iFFAD83174BEAB5E1%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22Viorel-Alexandru_10-1598543572253.png%22%20alt%3D%22The%20hash%20is%20used%20as%20certificate%20identifier%3B%20same%20certificate%20may%20appear%20in%20multiple%20stores%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EThe%20hash%20is%20used%20as%20certificate%20identifier%3B%20same%20certificate%20may%20appear%20in%20multiple%20stores%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20we%20can%E2%80%99t%20find%20a%20valid%20entity%E2%80%99s%20certificate%20there%2C%20then%20perhaps%20we%20should%20install%20it.%20Luckily%2C%20this%20is%20done%20simply%20opening%20and%20importing%20the%20CER%20file%20of%20an%20authority.%20In%20some%20cases%2C%20a%20PFX%20container%20file%20has%20inside%20certificates%20and%20keys%3B%20it%20is%20common%20that%20entire%20certificate%20chains%20are%20included%20in%20the%20PFX%20container%20%E2%80%93%20importing%20the%20PFX%20may%20install%20all%20the%20contained%20certificates%2C%20including%20those%20of%20issuing%20or%20endorsing%20authorities.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-781082421%22%20id%3D%22toc-hId-781082421%22%3EUsing%20PowerShell%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20Windows%20certificate%20repository%20is%20using%20the%20certificate%20computed%20%3CEM%3ESHA-1%20%3CSTRONG%3EFingerprint%3C%2FSTRONG%3E%3C%2FEM%3E%2F%3CEM%3E%3CSTRONG%3EHash%3C%2FSTRONG%3E%3C%2FEM%3E%2C%20or%20%3CEM%3E%3CSTRONG%3EThumbprint%3C%2FSTRONG%3E%3C%2FEM%3E%2C%20as%20certificate%20identifier.%20This%20can%20be%20seen%20when%20we%20look%20into%20the%20Registry%20location%20where%20Windows%20is%20persisting%20the%20certificates%3A%3C%2FP%3E%0A%3CPRE%3EComputer%5CHKEY_LOCAL_MACHINE%5CSOFTWARE%5CMicrosoft%5CSystemCertificates%3C%2FPRE%3E%0A%3CP%3EBut%20the%20certificates%20can%20also%20be%20searched%20by%20their%20Serial%20Number.%20Look%3A%3C%2FP%3E%0A%3CP%3EAfter%20opening%20a%20PowerShell%20console%2C%20go%20to%20the%20certificate%20repository%20root%3A%3C%2FP%3E%0A%3CPRE%3Ecd%20cert%3A%5C%5C%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERecursively%20search%20for%20the%20certificate%E2%80%A6%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3CBR%20%2F%3E%E2%80%A6%20either%20by%20its%20%3CEM%3E%3CSTRONG%3ESerial%20Number%3C%2FSTRONG%3E%3C%2FEM%3E%3A%3C%2FP%3E%0A%3CPRE%3EGet-ChildItem%20-Recurse%20%7C%20Where-Object%20%7B%24_.SerialNumber%20-eq%20%22033af1e6a711a9a0bb2864b11d09fae5%22%7D%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3CBR%20%2F%3E...%20or%20by%20its%20computed%20%3CEM%3E%3CSTRONG%3EHash%3C%2FSTRONG%3E%3C%2FEM%3E%2C%20or%20%3CEM%3E%3CSTRONG%3EThumbprint%3C%2FSTRONG%3E%3C%2FEM%3E%2C%20used%20as%20%3CEM%3EPath%3C%2FEM%3E%20(or%20item%20name)%20in%20the%20Windows%20certificate%20store%3A%3C%2FP%3E%0A%3CPRE%3EGet-ChildItem%20-Path%20%22%3CSTRONG%3Edf3c24f9bfd666761b268073fe06d1cc8d4f82a4%3C%2FSTRONG%3E%22%20-Recurse%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20example%2C%20I%20get%3A%3C%2FP%3E%0A%3CPRE%3E%26nbsp%3B%26nbsp%3B%26nbsp%3BPSParentPath%3A%20Microsoft.PowerShell.Security%5CCertificate%3A%3ACurrentUser%5CRoot%0AThumbprint%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Subject%0A%3CSTRONG%3EDF3C24F9BFD666761B268073FE06D1CC8D4F82A4%3C%2FSTRONG%3E%26nbsp%3B%20CN%3DDigiCert%20Global%20Root%20G2%2C%20OU%3D%3CA%20href%3D%22http%3A%2F%2Fwww.digicert.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ewww.digicert.com%3C%2FA%3E%2C%20O%3DDigiCert%20Inc%2C%20C%3DUS%0A%26nbsp%3B%0A%26nbsp%3B%26nbsp%3B%20PSParentPath%3A%20Microsoft.PowerShell.Security%5CCertificate%3A%3ACurrentUser%5CAuthRoot%0AThumbprint%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Subject%0A%3CSTRONG%3EDF3C24F9BFD666761B268073FE06D1CC8D4F82A4%3C%2FSTRONG%3E%26nbsp%3B%20CN%3DDigiCert%20Global%20Root%20G2%2C%20OU%3D%3CA%20href%3D%22http%3A%2F%2Fwww.digicert.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ewww.digicert.com%3C%2FA%3E%2C%20O%3DDigiCert%20Inc%2C%20C%3DUS%0A%26nbsp%3B%0A%26nbsp%3B%26nbsp%3B%20PSParentPath%3A%20Microsoft.PowerShell.Security%5CCertificate%3A%3ALocalMachine%5CRoot%0AThumbprint%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Subject%0A%3CSTRONG%3EDF3C24F9BFD666761B268073FE06D1CC8D4F82A4%3C%2FSTRONG%3E%26nbsp%3B%20CN%3DDigiCert%20Global%20Root%20G2%2C%20OU%3D%3CA%20href%3D%22http%3A%2F%2Fwww.digicert.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ewww.digicert.com%3C%2FA%3E%2C%20O%3DDigiCert%20Inc%2C%20C%3DUS%0A%26nbsp%3B%0A%26nbsp%3B%26nbsp%3B%20PSParentPath%3A%20Microsoft.PowerShell.Security%5CCertificate%3A%3ALocalMachine%5CAuthRoot%0AThumbprint%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Subject%0A%3CSTRONG%3EDF3C24F9BFD666761B268073FE06D1CC8D4F82A4%3C%2FSTRONG%3E%26nbsp%3B%20CN%3DDigiCert%20Global%20Root%20G2%2C%20OU%3D%3CA%20href%3D%22http%3A%2F%2Fwww.digicert.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ewww.digicert.com%3C%2FA%3E%2C%20O%3DDigiCert%20Inc%2C%20C%3DUS%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20could%20select%20a%20certain%20Store%20%26amp%3B%20Folder%3A%3C%2FP%3E%0A%3CPRE%3Ecd%20.%5C%5CLocalMachine%5CRoot%5C%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EGet%20all%20the%20properties%20of%20a%20certificate%20from%20there%2C%20if%20you%20need%20to%20check%20other%20properties%20too%3A%3C%2FP%3E%0A%3CPRE%3EGet-ChildItem%20-Path%20%22df3c24f9bfd666761b268073fe06d1cc8d4f82a4%22%20%7C%20Format-List%20-Property%20*%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3EAside%3C%2FEM%3E%3C%2FSTRONG%3E%3CEM%3E%3A%20Just%20in%20case%20you%20are%20wondering%20what%20I%20use%20to%20capture%20screenshots%20for%20illustrating%20my%20articles%2C%20check%20out%20this%20little%20%3C%2FEM%3E%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fp%2Fsharex%2F9nblggh4z1sp%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CEM%3EShareX%3C%2FEM%3E%3C%2FA%3E%3CEM%3E%20application%20in%20Windows%20Store.%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1616682%22%20slang%3D%22en-US%22%3E%3CP%3ECheck%20the%20trust%20when%20the%20client%20doesn't%20handshake%20the%20TLS%20with%20the%20server%3C%2FP%3E%3C%2FLINGO-TEASER%3E

Sometimes our client apps, including browsers, are unable or unwilling to connect to an HTTPS site. A common cause: the certificate presented by the server endpoint fails the validation; the client does not trust the certificate presented by the server. This article is a continuation of http://linqto.me/https.

       

 

 

A bit of context

 

On 2020 August 19th, the Azure SignalR Service rotated (renewed) the authenticating certificate used by its endpoints. The entire trust chain has changed.
In some situations, the ASRS clients or the hubs could no longer connect to the service, with an error like:

ERROR Failed to connect to 'https://resourceName.service.signalr.net', will retry after the back off period.
Error detail: Unable to connect to the remote server. The remote certificate is invalid according to the validation procedure. Id: <GUID-here>

Of course, the first thought is to check the certificate that the service is presenting.

During the TLS handshake, when the secure channel is established for HTTPS, before any HTTP traffic can take place, the server is presenting its certificate. The server has to authenticate itself. And the client is checking the certificate:

  1. Is the certificate still valid? Isn’t it expired?
  2. Is the certificate issued for the domain that the server claims to be? Does the Subject name in the certificate match the site name (host-name) of the endpoint URL?
  3. Does the client trust the certificate chain? Does it trust the issuing authority or the entity endorsing the certificate authority?
  4. Was the certificate revoked by its issuing authority?
  5. Do the cryptographic details match, key and algorithms?

Below, we treat a bit on the third question: trusting the certificate chain. We check certificate identifiers against the Windows certificate store.

       

 

 

Certificate chain

 

So what’s the certificate’s trust chain? Well, the certificate of a server is issued by an authority that checks somehow the authenticity of that server or service. We call it the Certificate Authority or Issuing Authority. That authority should be trusted. Or we should trust, at least, the authority that is endorsing the Issuing Authority, which we call Root Authority. Sometimes, this chain of certification may be even longer.

For a public HTTPS endpoint, we could use an online service to check its certificate. For my Azure SignalR Service instance, using the Ionos SSL Checker, I get the following chain:

 

A certificate trust chain, from the Root Authority down to authenticated serviceA certificate trust chain, from the Root Authority down to authenticated service

 

 

We can easily see the entire chain; each entity is identified with its own certificate. Reading from bottom up:

  1. The certificate of the service, used to authenticate to its clients
  2. The Issuing Authority, the one that signed and generated the service certificate
  3. The Root Authority, the one that is endorsing the Issuing Authority to release certificates

There are other SSL certificate test services too online, such as the one from SSLlabs.com. And we can also use a browser or even a network trace (such as with Wireshark) to see a certificate chain.

       

 

 

Identify the certificate

 

Certificates can be identified with several of their properties. But, to check them in the Windows certificate store easily, we could use:

  • Either the Serial number of the certificate,
  • Or its Thumbprint, which is the SHA-1 Fingerprint Hash computed from the certificate

The Serial number of the certificate is displayed by most of the SSL checking services. Illustrating with the output of the Ionos SSL Checker:

 

Viorel-Alexandru_1-1598543572196.png

 

Most of the browsers allow to see the certificate of an HTTPS site, along with the trust chain. Identifiers can be picked from there too. For instance, using Firefox:

 

Viorel-Alexandru_2-1598543572202.png

 

Viorel-Alexandru_3-1598543572205.png

 

Viorel-Alexandru_4-1598543572211.png

 

Viorel-Alexandru_5-1598543572216.png

 

Note: With certificates of Root Authority, the Issuer of the certificate is the authority itself; this is how we tell that this is a Root Authority certificate.

 

The certificate Thumprint is a computed Hash, SHA-1The certificate Thumprint is a computed Hash, SHA-1

 

 

Microsoft browsers, like Edge Chromium, are also displaying certificates in a window that is familiar from the Windows certificate store.
The trust chain can be navigated; we can see each certificate, for each entity in the chain, to check if they are OK:

 

Viorel-Alexandru_7-1598543572226.png

 

Certificate fields as shown by Windows UICertificate fields as shown by Windows UI

 

 

If we can’t use a browser or an online service – maybe because of an internal environment that prevents getting the presented certificate chain this way – we can use a network trace, such as one taken with Wireshark:
Let’s remember that, in TLS negotiation, after Client Hello and Server Hello, the server would present its certificate to authenticate itself to the client.
So, in a network trace, we see the certificates, each with its Serial Number and Issuer information:

 

A network trace with Wireshark reveals the server certificateA network trace with Wireshark reveals the server certificate

 

       

 

 

Checking certificate store

 

Now that we know the certificate chain, with the identifiers of the certificates, we should check if our client accessing the service trusts the chain.

Microsoft applications and frameworks would use the Microsoft cryptographic API (CAPI), and that includes Microsoft browsers. Other browsers or technologies may use other APIs or crypto libraries for validating certificates. But Windows relies on its certificate store. So, we need to check if an issuing authority or its endorsing authority is trusted: does its certificate appear in the certificate store, in the needed location?

 

Using certificates console

 

Using the UI, we open Manage Computer Certificate or Manage User Certificate, depending if the client is a service, like an IIS-hosted Web application, or a desktop application running under a user’s security context.

Opening the certificates console, we check the Trusted/Third-Party Root Certification Authorities or the Intermediate Certification Authorities.

 

The hash is used as certificate identifier; same certificate may appear in multiple storesThe hash is used as certificate identifier; same certificate may appear in multiple stores

 

 

If we can’t find a valid entity’s certificate there, then perhaps we should install it. Luckily, this is done simply opening and importing the CER file of an authority. In some cases, a PFX container file has inside certificates and keys; it is common that entire certificate chains are included in the PFX container – importing the PFX may install all the contained certificates, including those of issuing or endorsing authorities.

 

Using PowerShell

 

The Windows certificate repository is using the certificate computed SHA-1 Fingerprint/Hash, or Thumbprint, as certificate identifier. This can be seen when we look into the Registry location where Windows is persisting the certificates:

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SystemCertificates

But the certificates can also be searched by their Serial Number. Look:

After opening a PowerShell console, go to the certificate repository root:

cd cert:\\

 

Recursively search for the certificate…

 
… either by its Serial Number:

Get-ChildItem -Recurse | Where-Object {$_.SerialNumber -eq "033af1e6a711a9a0bb2864b11d09fae5"}

 
... or by its computed Hash, or Thumbprint, used as Path (or item name) in the Windows certificate store:

Get-ChildItem -Path "df3c24f9bfd666761b268073fe06d1cc8d4f82a4" -Recurse

 

For example, I get:

   PSParentPath: Microsoft.PowerShell.Security\Certificate::CurrentUser\Root
Thumbprint                                Subject
DF3C24F9BFD666761B268073FE06D1CC8D4F82A4  CN=DigiCert Global Root G2, OU=www.digicert.com, O=DigiCert Inc, C=US
 
   PSParentPath: Microsoft.PowerShell.Security\Certificate::CurrentUser\AuthRoot
Thumbprint                                Subject
DF3C24F9BFD666761B268073FE06D1CC8D4F82A4  CN=DigiCert Global Root G2, OU=www.digicert.com, O=DigiCert Inc, C=US
 
   PSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\Root
Thumbprint                                Subject
DF3C24F9BFD666761B268073FE06D1CC8D4F82A4  CN=DigiCert Global Root G2, OU=www.digicert.com, O=DigiCert Inc, C=US
 
   PSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\AuthRoot
Thumbprint                                Subject
DF3C24F9BFD666761B268073FE06D1CC8D4F82A4  CN=DigiCert Global Root G2, OU=www.digicert.com, O=DigiCert Inc, C=US

 

We could select a certain Store & Folder:

cd .\\LocalMachine\Root\

 

Get all the properties of a certificate from there, if you need to check other properties too:

Get-ChildItem -Path "df3c24f9bfd666761b268073fe06d1cc8d4f82a4" | Format-List -Property *

 

 

 

Aside: Just in case you are wondering what I use to capture screenshots for illustrating my articles, check out this little ShareX application in Windows Store.