Convert JKS to PKCS12

SelfSigned JKS file can be generated for a development environment but the JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry-standard format using “keytool -importkeystore -srckeystore keystore.jks -destkeystore keystore.jks -deststoretype pkcs12

Generate Self signed JKS

D:\>keytool -genkey -keyalg RSA -alias -keystore narayanatutorial.jks -storepass Admin1234 -validity 365 -keysize 2048
What is your first and last name?
  [Unknown]:  narayana tutorial
What is the name of your organizational unit?
  [Unknown]:  online java tutorial
What is the name of your organization?
  [Unknown]:  narayanatutorial
What is the name of your City or Locality?
  [Unknown]:  bangalore
What is the name of your State or Province?
  [Unknown]:  karnataka
What is the two-letter country code for this unit?
  [Unknown]:  in
Is CN=narayana tutorial, OU=online java tutorial, O=narayanatutorial, L=bangalore, ST=karnataka, C=in correct?
  [no]:  yes

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

The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore narayanatutorial.jks -destkeystore narayanatutorial.jks -deststoretype pkcs12".

Self Signed JKS Generation

narayanatutorial.jks file generated, now we can convert JKS to PKCS12 using the following command

keytool -importkeystore -srckeystore narayanatutorial.jks -destkeystore narayanatutorial_NEW.jks -deststoretype pkcs12

Convert JKS to PKCS12

Convert JKS to PKCS12
D:\>keytool -importkeystore -srckeystore narayanatutorial.jks -destkeystore narayanatutorial_NEW.jks -deststoretype pkcs12
Importing keystore narayanatutorial.jks to narayanatutorial_NEW.jks...
Enter destination keystore password:
Re-enter new password:
Enter source keystore password:
Entry for alias successfully imported.
Import command completed:  1 entries successfully imported, 0 entries failed or cancelled


For more details click here

The Author


Hello! I am Narayanaswamy founder and admin of I have been working in IT industry more than 7 years. NarayanaTutorial is my web technologies blog. My specialties are Java / J2EE, Spring, Hibernate, Struts, Webservices, PHP, Oracle, MySQL, SQLServer, Web Hosting and Website Development. I am a self learner and passionate about training and writing. I am always trying my best to share my knowledge through my blog.

Leave a Reply