Implement runtime self-signed certificate generation for easy testing

- Pulls in Bouncy Castle as an optional dependency and is used only when JDK doesn't have sun.security.x509 package