This documentation is for WSO2 Carbon 4.4.3. View documentation for the latest release.

Skip to end of metadata
Go to start of metadata

Cipher Tool is developed by WSO2 for encrypting sensitive data in files stored in a file system. Thereby, Cipher Tool can be used in WSO2 products as well as in non-WSO2 environments. However, in order to use the Cipher Tool in a WSO2 product or any other environment, product developers must ensure that Cipher Tool is enabled in the respective product build. The instructions on this page explain how developers can install the Cipher Tool feature when building a product.

 Cipher Tool consists of the following files:

  • org.wso2.ciphertool-1.0.0-wso2v3.jar: This is the JAR of the Cipher Tool.

  • ciphertool.bat: The script for running the tool on Windows.

  • The script for running the tool on Linux.

  • This file contains the secret alias, file and the xpath of the sensitive data that should be encrypted. In the case of WSO2 products, the default file that is shipped with a pack should contain the sensitive data in the file system of that particular product.

  • This file contains the secret aliases with the encrypted values. In the case of WSO2 products, the default file that is shipped with a pack should contain the data relevant to the respective product.

  • This file contains the configurations for non-WSO2 environments. 

You can find the source code of Cipher Tool here.

 See the following topics:

Enabling Cipher Tool for WSO2 products

WSO2 products use the Cipher Tool for encrypting passwords in configuration files. The tool uses the Secure Vault implementation that is built into Carbon. Cipher Tool is available as a separate feature that can be installed in each product. Given below are the instructions for installing the Cipher Tool feature in a WSO2 product using the pom.xml. 

  1. In the pom.xml of the p2-profile-gen, the Cipher Tool features needs to be added under <featureArtifacts> as given below.

  2. Under the "default" profile, the Cipher Tool feature ID needs to be added as given below:

  3. In the bin.xml (in distribution), the location in the product pack to which the Cipher Tool Jar and its configuration files should be copied is mentioned as given below. Note that ${cipher.tool.version} refers to the Cipher Tool version:

  4. Now you must create the and files for your product and store them in the <PRODUCT_HOME>/repsoistory/conf/security directory. Note that these two files are always product specific. This is because the type and number of passwords in configuration files that require encryption may be different in each product. Therefore, each product team should create these files with the information that is relevant to the product. For example, shown below are the and files that are created for Carbon Kernel.



    Note the following when you update the file:

    For Carbon 4.4.x, you will be using a new version of the Cipher tool (1.0.0-wso2v3). This new version provides the capability of encrypting passwords that are specified as property values as well as attribute values in configuration files. Consider the following examples:

    • A password specified as a property value: <Property name="ConnectionPassword">admin</Property>
    • A password specified as an attribute value: <Connector protocol="org.apache.coyote.http11.Http11NioProtocol" password="wso2carbon" />

    Note that with the previous version of the Cipher tool (1.0.0-wso2v2), which was valid for Carbon 4.2.0, it was only possible to encrypt property values. 

    With the new Cipher tool for Carbon 4.4.x, when you set the xpath to the password you want to encrypt, you need to use the 'true/false' setting depending on whether the password is defined as a property value or an attribute value. For property values, the xpath should be followed by 'false' and for attribute values, the xpath should be followed by 'true'. Consider the following examples from the file in Carbon Kernel:

If you have developed your WSO2 product with the configurations given above, the Cipher Tool feature will be installed. Alternatively, you can also install this feature using the management console of a Carbon product. See the following topics for more information:

Enabling Cipher Tool for non-WSO2 environments

The cipher tool can only encrypt the password. Therefore in a non-WSO2 environment, the decrypting code needs to be written. Follow the steps given below to configure and run Cipher Tool.

  1. Download the latest released org.wso2.ciphertool-{version}.jar from the nexus repository.

  2. Copy the following configuration files from Github to a folder called “conf” where your Cipher Tool Jar is placed:




  3. Now, you must update the and the files with information on the configuration files and the passwords that you want to encrypt.

    • Update the file with the location of the file (this can be the absolute path or the relative path from the .jar file) and the XPath of the value to be encrypted.

    • The file should contains the secret aliases with the encrypted values.

  4. Update the file. This file is used in a non-WSO2 environment to get the location of the Keystore, the Keystore type, Key alias, location of the and In this case, Cipher Tool also returns the file name (along with the path) where it should create the file.

  5. To run the tool, execute the following command:

  • No labels