[M4A] Clear RemoteCertificateChainErrors if Android validates the chain.
authorJonathan Pryor <jonpryor@vt.edu>
Thu, 13 Sep 2012 18:46:59 +0000 (14:46 -0400)
committerJonathan Pryor <jonpryor@vt.edu>
Thu, 13 Sep 2012 18:46:59 +0000 (14:46 -0400)
commit1249082309ffbff6cec2708c43336750b038f9b6
tree346f920673727c20769f5752d509a4c135ca6133
parent52970c3a2ce9afc7b07da03f331f2cbc94039c36
[M4A] Clear RemoteCertificateChainErrors if Android validates the chain.

The problem: Mono for Android 4.2.5 horribly broke SSL support:

http://lists.ximian.com/pipermail/monodroid/2012-September/012213.html

Why? Because of ad89f72f (kinda): As Mono for Android doesn't provide
or use its own set of SSL root certificates (opting instead to just
let Android worry about it), the `chain.Build()` method will ALWAYS
result in SslPolicyErrors.RemoteCertificateChainErrors being returned
from GetErrorsFromChain().

The world before ad89f72f "masked" this because errors & status11 were
always cleared if Android accepted the chain; however, clearing these
out masked other bugs, such as #5706 (in which https://74.125.224.134
is accepted as valid when it can't be valid, by definition).

The fix is to clear out SslPolicyErrors.RemoteCertificateChainErrors
if Android accepts the certificate chain. Any other errors are left
unchanged, thus keeping #5706 fixed.
mcs/class/System/System.Net/ServicePointManager.cs