>keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 36000
What is your first and last name?
  [Unknown]:  SNF4J
What is the name of your organizational unit?
  [Unknown]:  SNF4J.ORG
What is the name of your organization?
  [Unknown]:  SNF4J.ORG
What is the name of your City or Locality?
  [Unknown]:  Andrychow
What is the name of your State or Province?
  [Unknown]:  Malopolska
What is the two-letter country code for this unit?
  [Unknown]:  PL
Is CN=SNF4J, OU=SNF4J.ORG, O=SNF4J.ORG, L=Andrychow, ST=Malopolska, C=PL correct?
  [no]:  yes

Enter key password for <selfsigned>
        (RETURN if same as keystore password):

>keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore2.jks -storepass password -validity 36000
What is your first and last name?
  [Unknown]:  SNF4J2
What is the name of your organizational unit?
  [Unknown]:  SNF4J.ORG
What is the name of your organization?
  [Unknown]:  SNF4J.ORG
What is the name of your City or Locality?
  [Unknown]:  Andrychow
What is the name of your State or Province?
  [Unknown]:  Malopolska
What is the two-letter country code for this unit?
  [Unknown]:  PL
Is CN=SNF4J2, OU=SNF4J.ORG, O=SNF4J.ORG, L=Andrychow, ST=Malopolska, C=PL correct?
  [no]:  yes

Enter key password for <selfsigned>
        (RETURN if same as keystore password):

>

---------------------------------------------
Convert to PKCS12:
---------------------------------------------
>keytool -importkeystore -srckeystore keystore.jks -destkeystore keystore.p12 -srcstoretype jks -deststoretype pkcs12

---------------------------------------------
Convert to PEM:
---------------------------------------------
>openssl pkcs12 -in keystore.p12 -out keystore.pem

>openssl x509 -outform pem -in keystore.pem -out cert.pem

>openssl pkcs8 -in keystore.pem -out key.pem

>openssl pkcs8 -topk8 -in keystore.pem -out enckey.pem -v1 pbeWithSHA1And3-KeyTripleDES-CBC

>openssl pkey -outform pem -in keystore.pem -out pub.pem -pubout

---------------------------------------------
Generate EC key:
---------------------------------------------
>keytool.exe -genkey -keyalg EC -alias selfsigned -keystore keystore_ec.p12 -storepass password -deststoretype pkcs12 -validity 36000 

>openssl pkcs12 -in keystore_ec.p12 -out keystore_ec.pem

>openssl pkcs8 -in keystore_ec.pem -out key_ec.pem

>openssl pkcs8 -topk8 -in keystore_ec.pem -out enckey_ec.pem -v1 pbeWithSHA1And3-KeyTripleDES-CBC

---------------------------------------------
Generate DSA key:
---------------------------------------------
>keytool.exe -genkey -keyalg DSA -alias selfsigned -keystore keystore_dsa.p12 -storepass password -deststoretype pkcs12 -validity 36000 

>openssl pkcs12 -in keystore_dsa.p12 -out keystore_dsa.pem

>openssl pkcs8 -in keystore_dsa.pem -out key_dsa.pem

>openssl pkcs8 -topk8 -in keystore_dsa.pem -out enckey_dsa.pem -v1 pbeWithSHA1And3-KeyTripleDES-CBC
