For those trying to replace the self-signed key and certificate in OH2.5 the steps above need a little modification. This is what has worked for me. NB. OH is designed with few security layers in place and it uses a default password “openhab” both for the keystore and the key itself. The name of the key has to be “mykey” unless you change other config files. Feel free to figure out how to change it, but do not expect much in terms of increasing the overall security. The only advantage of using a proper certificate, like LE in this case, is to avoid browser warnings and/or having to install CAs into them, while at least having browser-OH traffic encrypted. While this is useful and important part of security hygiene, it is also merely a drop in the ocean in terms of home automation security, which is still very, very poor no matter the provider nowadays. Rant end.
openssl pkcs12 -nodes -passout pass:openhab \
-inkey YOUR_PRIVATE_KEY \
-in YOUR_CERTIFICATE \
-export -name mykey \
-out SOMEWHERE/oh.pkcs12
keytool -delete -alias mykey -deststorepass openhab \
-keystore /var/db/openhab2/userdata/etc/keystore
keytool -importkeystore -srcstorepass openhab \
-srckeystore SOMEWHERE/oh.pkcs12 \
-srcstoretype PKCS12 -deststoretype jks \
-alias mykey -destalias mykey -deststorepass openhab \
-destkeystore /var/db/openhab2/userdata/etc/keystore