Category Archives: Mac

Add charles certificate to JVM

This is an example how to do that on a Mac:

sudo keytool -import -noprompt -alias charles-$(date +%Y%m%d%H%M%S) -file "Downloads/charles-ssl-proxying-certificate.pem" -keystore "/Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home/lib/security/cacerts" -storepass changeit


Add charles ssl proxy certificates to JDK on a mac

First you need to run charles and enable SSL proxying. The see which JDK is used by your application and add the certificate to the cacerts file:

curl -s http://ssl.charles/ --proxy > cert_file
sudo keytool -import -noprompt -alias charles-$(date +%Y%m%d%H%M%S) \
  -file cert_file \
  -keystore /Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home/lib/security/cacerts \
  -storepass changeit
rm cert_file