./wsadmin.sh -lang jython -conntype none -c 'import com.ibm.ws.security.util.PasswordDecoder as pd; pd.main(["{xor}KzosK25tbH4n"]);'
./wsadmin.sh -lang jython -conntype none -c 'import com.ibm.ws.security.util.PasswordEncoder as pd; pd.main(["test123!x"]);'
-
decode
echo 'KzosK25tbH4n' | perl -e 'use MIME::Base64; print join("", map { chr(ord($_) ^ 0x5f); } split("", decode_base64(<>)))'
-
result:
test123!x
-
encode
echo 'test123!x' | perl -e 'use MIME::Base64; print "{xor}",encode_base64(join("", map { ord($_)!=10?(chr(ord($_) ^ 0x5f)):()} split("", <>)));'
-
result:
{xor}KzosK25tbH4n
Note2Self
map { ord($_)!=10?(chr(ord($_) ^ 0x5f)):() ...
is required during encode to remove any linefeed. It is better and safer than trying to remember and usingecho -n <password>
to suppress the linefeed in the first place.