• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Mister PKI

SSL Certificates * SSL Tools * Certificate Decoder

  • PKI Training
  • OpenSSL
  • Keytool
  • PKI Tools
    • Apereo CAS
    • SAML
    • OpenID Connect
  • Get expert help

Import keystore into another keystore with Java keytool

March 23, 2022 by Mister PKI Leave a Comment

What is Java keytool?

The Java keytool is a command-line utility used to manage keystores in different formats containing keys and certificates. You can use the java keytool to import a keystore into another keystore. In many respects, the java keytool is a competing utility with openssl for keystore, key, and certificate management. This article will demonstrate how to with keytool import keystore.

Use cases to import a keystore into another keystore.

If you want to consolidate keystores or add a newly generated keystore to an existing keystore, this command will do that for you. This command will also allow you to add a subset of keystore entries and not the entire keystore if desired. Use -srcalias for this functionality. You may also want to convert or import a different store type into another keystore, such as a .JKS into a .P12.

What keytool command do I use to import a keystore into another keystore?

Use this command to import a keystore into another keystore using the java keytool. The result will be an updated keystore with all entries including keys and certificates from the other keystore.

keytool -importkeystore \-srckeystore example2.p12 \
-destkeystore example.p12 \
-srcstoretype PKCS12 \-deststoretype PKCS12 \-srcstorepass changeit \
-deststorepass changeit \
-v

Java keytool options:

-srckeystore – The filename of the keystore to be imported from.

-destkeystore – The filename of the keystore to be imported to.

-srcstorepass – The current keystore password of the source keystore. We recommend leaving this option off and letting keytool prompt you instead of writing your password in plain text here.

-deststorepass – The current keystore password of the destination keystore. We recommend leaving this option off and letting keytool prompt you instead of writing your password in plain text here.

-srcstoretype – Recommended keystore types include PKCS12 and JKS. In this case, the keystore was of type PKCS12.

-deststoretype – Recommended keystore types include PKCS12 and JKS. In this case, the keystore was of type PKCS12.

-v – Verbose output.

import keystore
keytool -importkeystore

Conclusion – Keytool importkeystore

This article has demonstrated how to use the Java keytool importkeystore command. Leave us a comment with any questions or additional examples you would like to see.

Read another post on how to import a certificate into a keystore.

Read all of our blog content.

keytool

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Popular Posts

PKCS12

openssl s_client

Keytool

Keytool list

ECDSA vs RSA

OpenSSL

PKCS7

Certificate Decoder

PKI for DevOps Engineers – Free Training Series

PKI for DevOps Training Hub

Lesson 1 – How TLS and PKI Work

Lesson 2 – Understanding X.509 Certificates

Lesson 3 – Certificate Chains Explained

Lesson 4 – Debug TLS with OpenSSL

Lesson 5 – Verify Certificate Chains

Lesson 6 – Creating CSRs with OpenSSL

Lesson 7 – Working with PKCS12 Certificates

Lesson 8 – Java Keystores and keytool

Lesson 9 – Certificate Expiration Monitoring

Lesson 10 – Automating Certificate Renewal

Lesson 11 – Common TLS Errors

Lesson 12 – PKI Architecture for DevOps

Recent Posts

  • Apache mod_auth_cas: Protect Web Applications with Apereo CAS and Docker
  • Apache mod_auth_mellon: Configure SAML SSO & Docker
  • Configure OpenID Connect (OIDC) in Apereo CAS 7.3 and 8
  • Certificate Ownership Is an Operating Model Problem, Not a Tooling Problem
  • OpenSSL dgst: Create Checksums and Verify Digital Signatures

Footer

  • Twitter
  • YouTube
Mister PKI

Practical security engineering for the systems that establish trust.

Learn OpenSSL Keytool Free training
Work together PKI consulting CAS consulting Sponsored contributions
Site About Support Mister PKI Cookie policy Search
© 2026 Mister PKI Secure systems. Clear guidance.