Some people are developers. Some of them have secure sites. What's more incredible, some want to test their websites on mobile phones with a environment as similar as possible to the production one, so they want to use a self-signed SSL certificate. Then, why it's so difficult to do it?
After much trial and error, here's a bulletproof guide to do in on Linux:
- Open Firefox (I suppose it's also possible with Chrome, but it's easier for me with FF)
- Visit your development site with a self-signed SSL certificate.
- Click on the certificate (next to the site name)
- Click on "More information"
- Click on "View certificate"
- Click on "Details"
- Click on "Export..."
- Choose "X.509 Certificate whith chain (PEM)", select the folder and name to save it and click "Save"
- Go to command line, to the directory where you downloaded the pem file and execute "openssl x509 -inform PEM -outform DM -in <certificatename>.pem -out <certificatename>.crt"
- Copy the .crt file to the root of the /sdcard folder inside your Android device
- Inside your Android device, Settings > Security > Install from storage. It should detect the certificate and let you add it to the device
- Browse to your development site. The first time it should ask you to confirm the security exception. That's all. The certificate should work with any browser installed on your Android (Browser, Chrome, Opera, Dolphin...)
Remember that if you're serving your static files from a different domain (we all are page speed bitches) you also need to add the certificate for that domain.