{"id":3688,"date":"2014-11-03T13:30:58","date_gmt":"2014-11-03T05:30:58","guid":{"rendered":"http:\/\/rmohan.com\/?p=3688"},"modified":"2014-11-03T13:30:58","modified_gmt":"2014-11-03T05:30:58","slug":"recovering-passwords-from-websphere","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=3688","title":{"rendered":"Recovering passwords from WebSphere"},"content":{"rendered":"<p>WebSphere stores passwords for datasources, security aliassss, etc in an encrypted format in its configuration files. The format, called XOR (exclusive OR), is not a particularly strong encryption algorithm, probably designed just to stop casual snooping. (In contrast WebLogic uses triple-DES encryption.)<\/p>\n<p>(To be precise IBM says WebSphere &#8220;encodes&#8221; paswords, not encrypts them.)<\/p>\n<p>When you forget that password to your development database it can be useful to have the ability to decrypt XOR-encrypted passwords. Fortunately IBM have provided the means to encrypt and decrypt passwords in XOR format (although they probably didn&#8217;t mean to leave the code around for general use).<\/p>\n<p>So lets encrypt the password &#8220;secret&#8221;:<\/p>\n<p>WebSphere 5.x<\/p>\n<p>> cd $WAS_INSTALL_DIR\/lib<br \/>\n> ..\/java\/bin\/java -cp securityimpl.jar:iwsorb.jar com.ibm.ws.security.util.PasswordEncoder secret<br \/>\ndecoded password == &#8220;secret&#8221;, encoded password == &#8220;{xor}LDo8LTor&#8221;<\/p>\n<p>WebSphere 6.0.x<\/p>\n<p>> cd $WAS_INSTALL_DIR\/lib<br \/>\n> ..\/java\/bin\/java -cp securityimpl.jar:iwsorb.jar::ras.jar:wsexception.jar:bootstrap.jar:emf.jar:ffdc.jar com.ibm.ws.security.util.PasswordEncoder secret<br \/>\ndecoded password == &#8220;secret&#8221;, encoded password == &#8220;{xor}LDo8LTor&#8221;<\/p>\n<p>and to decrypt (don&#8217;t forget to prefix the encoded password with &#8220;{xor}&#8221;):<\/p>\n<p>WebSphere 5.x<\/p>\n<p>> cd $WAS_INSTALL_DIR\/lib<br \/>\n> ..\/java\/bin\/java -cp securityimpl.jar:iwsorb.jar com.ibm.ws.security.util.PasswordDecoder {xor}LDo8LTor<br \/>\nencoded password == &#8220;{xor}LDo8LTor&#8221;, decoded password == &#8220;secret&#8221;<\/p>\n<p>WebSphere 6.0.x<\/p>\n<p>> cd $WAS_INSTALL_DIR\/lib<br \/>\n> ..\/java\/bin\/java -cp securityimpl.jar:iwsorb.jar::ras.jar:wsexception.jar:bootstrap.jar:emf.jar:ffdc.jar com.ibm.ws.security.util.PasswordDecoder {xor}LDo8LTor<br \/>\nencoded password == &#8220;{xor}LDo8LTor&#8221;, decoded password == &#8220;secret&#8221;<\/p>\n<p>UPDATE: IBM have heard the cries about poor password security and have added hooks from WebSphere 6.0.2 onwards that allow you to write your own password encryption. One step forward&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WebSphere stores passwords for datasources, security aliassss, etc in an encrypted format in its configuration files. The format, called XOR (exclusive OR), is not a particularly strong encryption algorithm, probably designed just to stop casual snooping. (In contrast WebLogic uses triple-DES encryption.)<\/p>\n<p>(To be precise IBM says WebSphere &#8220;encodes&#8221; paswords, not encrypts them.)<\/p>\n<p>When you [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3688"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3688"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3688\/revisions"}],"predecessor-version":[{"id":3689,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3688\/revisions\/3689"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3688"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3688"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}