Just Sharing Knowledge on Robotics, Electronics and Programming

Tuesday, April 23, 2019

Android Keystore From Letsencrypt


Download: https://bouncycastle.org/download/bcprov-jdk15on-161.jar
place the file above in the same folder of certtificate

export CLASSPATH=bcprov-jdk15on-161.jar
if [ -a $CERTSTORE ]; then
    rm $CERTSTORE || exit 1
keytool \
      -import \
      -v \
      -trustcacerts \
      -alias 0 \
      -file <(openssl x509 -in cert.pem) \
      -keystore $CERTSTORE \
      -storetype BKS \
      -provider org.bouncycastle.jce.provider.BouncyCastleProvider \
      -providerpath /usr/share/java/bcprov.jar \
      -storepass whisper

How To Install Let’s Encrypt on Ubuntu and Export Jetty Keystore

Step 1 Install Letencryptt:
sudo apt-get install letsencrypt

step 2. download Certbot

sudo wget https://dl.eff.org/certbot-auto -O /usr/sbin/certbot-auto sudo chmod a+x /usr/sbin/certbot-auto

step 3. SSL certificate

sudo certbot-auto certonly --standalone -d example.com  -d www.example.com
# the "auth" aka "certonly" subcommand
# convert certificate chain + private key to the PKCS#12 file format
openssl pkcs12 -export -out keystore.pkcs12 -in fullchain.pem -inkey privkey.pem
# convert PKCS#12 file into Java keystore format
keytool -importkeystore -srckeystore keystore.pkcs12 -srcstoretype PKCS12 -destkeystore keystore.jks
# don't need the PKCS#12 file anymore
rm keystore.pkcs12
# Now use "keystore.jks" as keystore in jetty with the keystore password you specfied when you ran
# the "keytool" command
# input: fullchain.pem and privkey.pem as generated by the "letsencrypt-auto" script when run with

Saturday, April 20, 2019

Maven error :Perhaps you are running on a JRE rather than a JDK?

I've been facing the same issue with java 8 (ubuntu 16.04), trying to compile using mvn command line.
I verified my $JAVA_HOME, java -version and mvn -version. Everything seems to be okay pointing to /usr/lib/jvm/java-8-openjdk-amd64.
It appears that java-8-openjdk-amd64 is not completly installed by default and only contains the JRE (despite its name "jdk").
Re-installing the JDK did the trick.
sudo apt-get install openjdk-8-jdk