Skip to content

Instantly share code, notes, and snippets.

@CorneAussems
Last active July 19, 2018 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CorneAussems/cdeb1d0966237ece0138779a0ac8e135 to your computer and use it in GitHub Desktop.
Save CorneAussems/cdeb1d0966237ece0138779a0ac8e135 to your computer and use it in GitHub Desktop.
Create Liferay Tunnel tunneling.servlet.shared.secret Hex
/**
https://dev.liferay.com/en/discover/portal/-/knowledge_base/7-0/enabling-remote-live-staging
tunneling.servlet.shared.secret=6162636465666768696a6b6c6d6e6f70
tunneling.servlet.shared.secret.hex=true
**/
import com.liferay.portal.kernel.security.pwd.*
import com.liferay.portal.util.*
try {
println("tunneling.servlet.encryption.algorithm="+PropsUtil.get("tunneling.servlet.encryption.algorithm"));
println("company.encryption.key.size="+PropsUtil.get("company.encryption.key.size"));
println("tunneling.servlet.shared.secret.hex="+PropsUtil.get("tunneling.servlet.shared.secret.hex"));
println("tunneling.servlet.shared.secret="+PropsUtil.get(" tunneling.servlet.shared.secret"));
println("passwords.encryption.algorithm="+PropsUtil.get("passwords.encryption.algorithm"));
} catch (Exception e) {
println( e )
}
try{
String algorithm = PasswordEncryptorUtil.getDefaultPasswordAlgorithmType();
out.println("Algorithm"+algorithm);
String pwdEnc = PasswordEncryptorUtil.encrypt("TEXTTEXTTEXT");
out.println("Password encrypted:"+pwdEnc);
AES aesClient = new AES("client");
SecretKey AESKey = aesClient.getEncodedSecret();
String hexPwd = org.apache.commons.codec.binary.Hex.encodeHexString(pwdEnc.getBytes());
out.println("Password hexed:"+hexPwd);
}catch(e){
out.println("Oops:"+e)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment