Search code examples
javaencryptionsilktest

Encrypting a password for use with SetPasswordText()


I am implementing UI tests with Silk4J. To log in I used the SetText() method until now. However, using a plain text password in my source code is not such a good idea.

Now I found that there is also SetPasswordText() [MicroFocus], which takes an encrypted password as parameter.

Unfortunately the documentation does not specify a way to convert my plaintext password into an encyrpted password. How can I do that?

I found a website mentioning a tool, but that tool does not exist on my machine. It also mentions an Encrypt() method, but for Java, I need at least a class name to access that method.


Solution

  • There isn't any way in the UI to encrypt your password. You have two options:

    1. Record entering text into the password field. This will record the text entered using the setPasswordText() method, which you can copy and paste into your test.

    2. Write a short test that calls Agent.encrypt(). This will return the encrypted version of the text passed in. Copy the return value of this method into your original test.