Search code examples
androidsslandroid-ndkpoco

POCO library hanging on android when using ssl


I built openssl and POCO library for android. In my app I am trying to use SSL. The problem is when I create the handler, it hangs and never returns. It happens regardless of which type of certificate handler I use. What could be going wrong here?

My code:

Poco::Net::initializeSSL();
// Creating this handler is where it hangs.
SharedPtr<Poco::Net::InvalidCertificateHandler> pCert = new AcceptCertificateHandler(false);
//It never gets to this line.
Context::Ptr pContext = new Context(Context::CLIENT_USE, "", "", "", Context::VERIFY_NONE, 9, true, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");

Solution

  • I actually got this to work by building POCO using Android make files (.mk) instead of using the standalone toolchain like I was. I don't know what the difference was but it works properly now.