keytools add new alias to keystor (jceks) and delete old

Java Keytool is a command-line tool that is used for managing cryptographic keys, certificates, and keystores in Java-based applications. In Linux, Java Keytool is often used for managing SSL/TLS certificates and securing web applications that run on Java-based servers like Tomcat, GlassFish, and JBoss.

Some of the key features of Java Keytool in Linux include:

  1. Generating key pairs: Java Keytool can be used to generate key pairs, which are used for encryption, decryption, and digital signatures.
  2. Importing and exporting certificates: Java Keytool can import and export certificates, which are used for verifying the authenticity of digital signatures and ensuring secure communications.
  3. Managing keystores: Java Keytool can create, modify, and delete keystores, which are containers for cryptographic keys and certificates.
  4. Configuring SSL/TLS: Java Keytool can be used to configure SSL/TLS connections for Java-based web applications, which are essential for securing data communications.

Some of the most commonly used Java Keytool commands in Linux include:

  • keytool -genkeypair: This command is used to generate a new key pair.
  • keytool -import: This command is used to import a certificate into a keystore.
  • keytool -list: This command is used to list the contents of a keystore.
  • keytool -delete: This command is used to delete a key or certificate from a keystore.

Overall, Java Keytool is an important tool for managing cryptographic keys and certificates in Java-based applications in Linux, and it is essential for securing web applications and ensuring the privacy and integrity of sensitive information.

Before we begin make copy of old keystor like this:

and then we can remove alias:

when you gonna add new alias by keytool:

To be sure, you can check it and see more information like date or fingerprint:

When sometings go wrong, you can also copy backup file.

Good luck!