Friday, October 23, 2009

How to encrypt the password in websphere and how to use PropFilePasswordEncoder command

Content in the example file name is pass.properteis which is located in the C drive

Before conversion of the File
------------------------------------
database_username=db2admin
database_password=tirumal


Use the “PropFilePasswordEncoder.bat” command to encrypt the file

The command syntax is as follows:

PropFilePasswordEncoder "file_name" { passwordPropertiesList
| -SAS } [ -profileName profile ] [ -help | -? ]
Parameters
The following option is available for the PropFilePasswordEncoder command:

file_name
This required parameter specifies the name of the file in which passwords are encoded.

passwordPropertiesList
This parameter is required if you are encoding passwords in property files other than the sas.client.props file. Specify one or more password properties that you want to encode. The password properties list should be delimited by commas.

-SAS
This parameter is required if you are encoding passwords in the sas.client.props file.

-profileName
This parameter is optional. The profile value specifies an application server profile name. The script uses the password encoding algorithm that it retrieves from the specified profile. If you do not specify this parameter, the script uses the default profile.

-help or -?
If you specify this parameter, the script ignores all other parameters and displays usage text.


How to use the command?
Go the profile home in the command prompt
C:\Program Files\IBM\WebSphere\AppServer\profiles\AppSrv01\bin>PropFilePasswordEncoder.bat c:\pass.properties database_password

database_password is the one we need to encrypt.

OUTPUT

#Fri Oct 23 12:46:16 IST 2009
database_username=db2admin
database_password= {xor}KzYtKjI+Mw\=\=