rfc2822/davdroid — pull request #194 by ducktayp (2014-03-09 23:26:09+00:00)
Title: Added support for self-signed certificates using MemorizingTrustManager

This patch integrates MemorizingTrustManager as suggested in https://github.com/rfc2822/davdroid/issues/3

MemorizingTrustManager is included as a git submodule (so updates should be automatically included when pulling).

The patch is mildly invasive because the android context is required inside TlsSniSocketFactory.java in order to display the certificate accept/reject dialog; this was implemented by passing it in the constructor to TlsSniSocketFactory, and in turn required changes up the chain until a class is reached that has access to an android context.

This isn't extensively tested, but it works on my phone with a self-signed certificate that does not have the CA extension set (importing this type of certificate into the android trust store did not help, as it is considered a "client" certificate). I tested on Cyanogenmod 11 M3.