This documentation is for WSO2 Carbon 4.4.0. View documentation for the latest release.
Page Comparison - Encrypting Passwords with Cipher Tool (v.24 vs v.25) - Carbon 4.4.0 - WSO2 Documentation
Due to a known issue do not use JDK1.8.0_151 with WSO2 products. Use JDK 1.8.0_144 until JDK 1.8.0_162-ea is released.

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

The instructions on this page explains explain how plain text passwords in configuration files can be encrypted using the secure vault implementation that is built into WSO2 products. Note that you can customize the default secure vault configurations in the product by implementing a new secret repository, call back handler etc. See the related topics for information about secure vaultRead about the Secure Vault implementation in WSO2 products.


The default keystore that is shipped with your WSO2 product (i.e. wso2carbon.jks) is assumed to be the keystore used for encrypting plain text passwords. See the related topics for information this link for details on how to set up and configure new keystores for encrypting plain text passwords.


Passwords are encrypted by executing the Cipher Tool. You must install and configure the Cipher Tool as explained below:



For the Cipher Tool to be installable in a WSO2 product, the product should be build with the relevant Cipher Tool configurations. If you are a developer who is building a Carbon product, see the topic on enabling Cipher Tool for password encryption for instructions on how to include Cipher Tool related configurations in your product build.

  1. In any WSO2 product that is based

    on  Carbon

    on Carbon 4.4.0 or a later version, you can install the Cipher Tool feature from the WSO2 feature repository. See Installing Features for instructions on how features are installed from the WSO2 feature repository.


    If you are a developer who is building a Carbon product, see the topic on enabling Cipher Tool for password encryption for instructions on how to include the Cipher Tool feature in your product build.

  2. Open the file and the file from the <PRODUCT_HOME>/repository/conf/security folder. 
  3. In any WSO2 product that is based on Carbon 4.4.0 or a later version, the following files should be updated with the required information: 
    • The cipher- and cipher-

    files should already include
    •  file should contain information about the files in which the passwords (that require encryption) are located. Either the relative path or the absolute path of each file starting from <PRODUCT_HOME> should be given. The last value that follows the file path is set to 'true' or 'false' (which is a boolean value), which indicates whether or note the value to be encrypted is an attribute. 

      By default, the file that is shipped with your product pack will contain information on the most common passwords that require encryption. For example, see the default

    • file that

    • is created for Carbon Kernel

    • :

      Code Block
      # Important: This properties file contains all the aliases to be used in carbon components. If any property need to be secured, you need to add alias name, file name and the xpath as follows:.
      # The value goes as, the <file_name>//<xpath>,<true/false>
      # where <file_name> - is the file (along with the file path) to be secured,
      #       <xpath> - is the xpath to the property value to be secured
      #       <true / false> - This is true if the last parameter in the xpath is parameter (starts with [ and ends with ]) and you want its value to be replaced with "password"
    • The file should contain the secret alias names and the corresponding plain text passwords (enclosed within square brackets). For example, see the default file that is created for Carbon Kernel:

      Code Block
      # By default, This file contains the secret alias names and the plain text passwords enclosed with '[]' brackets
      # In Production environments, It is recommend to replace these plain text password by the encrypted values. CipherTool can be used for it.

    If required, you can edit the information in these files. That is, if there are other passwords from configuration files that you want to encrypt, you can add the details to these files. For example, in WSO2 Storage Server, you will want to configure the "root" password in the rss-config.xml file. 

    • Add the following to the file:

      Code Block
      #rss-config.xml passwords #RSSConfiguration.DEFAULT.WSO2RSS1.Password=rss-config.xml//RSSConfiguration/Environments/Environment[Name='DEFAULT'
      Add the following to the file:
      Code Block
      #rss-config.xml passwords

Step 2
Step 2
Step 2: Encrypting the passwords

  1. Open a command prompt and go to the <PRODUCT_HOME>/bin directory, where we stored the ciphertoolthe script. Run  

  2. Run the script using one of the following commands:


    the command

    given below to simply execute the script. You will be required to provide the keystore password (for authentication) in a later step.

    prompt as shown below:

    Code Block
    ./ -Dconfigure
  3. Use the command given below if you want to provide the keystore password as you run the script. The default keystore password is "wso2carbon".

    Code Block
    ./ -Dconfigure -Dpassword=wso2carbon
  4. Note

    The Cipher Tool reads the alias values and their corresponding plain text passwords from the file. Shown below is an example of an alias and the corresponding plain text password (in square brackets):

    Code Block

    If a password is not specified in the file for an alias, the user needs to provide it through the command-line. Check whether the alias is a known password alias in Carbon configurations. If the tool modifies the configuration element and file, you must replace the configuration element with the alias name. Define a Secret Callback in the configuration file and add proper name spaces for defining the Secure Vault.

  5. This step is required only if you did not provide the keystore password in step 1. The following message will be prompted, requesting for the keystore passwordWhen the above command is executed, the following message is prompted:  "[Please Enter Primary KeyStore Password of Carbon Server : ]". Enter the keystore password (which is "wso2carbon" for the default keystore). If  If the script execution completed successfully, you will see the following message: "Secret Configurations are written to the property file successfully".

  6. Now, to verify the password encryption: 
    • Open the file and see that the plain text passwords are replaced by a cipher value


      Open the relevant configuration files (e.g., rss-config.xml file) and see that the passwords are encrypted. 

    • Open the file stored in from the <PRODUCT_HOME>/repository/conf/security/ folder and see that the default configurations are changed.

If you have encrypted passwords as explained above, note that these passwords have to be decrypted again for the server to be usable. That is, the passwords have to be resolved by a system administrator during server startup. See the topic on resolving passwords in the related topicsThe Resolving Passwords topic explains how encrypted passwords are resolved.

Changing encrypted passwords


  1. Be sure to shut down the server.

  2. Open a command prompt and go to the <PRODUCT_HOME>/bin directory, where we have stored the script.

  3. Execute the following command:

    Code Block
    ./ -Dchange
  4. It will prompt for the primary keystore password. Enter the keystore password (which is "wso2carbon" for the default keystore).

  5. The alias values of all the passwords that you encrypted will now be shown in a numbered list. 

  6. The system will then prompt you to select the alias of the password which you want to change. Enter the list number of the password alias.

  7. The system will then prompt you (twice) to enter the new password. Enter your new password.

  8. The password should now be changed and encrypted.

Related Topics


  1. encrypted


  1. .