Groovy 如何在Katalon中使用脚本模式加密密码文本输入?

Groovy 如何在Katalon中使用脚本模式加密密码文本输入?,groovy,password-encryption,katalon-studio,Groovy,Password Encryption,Katalon Studio,我有一个csv,上面有我需要检查登录名的用户和密码列表 是否有任何方法可以在中使用脚本模式加密密码文本输入 卡塔隆 我在上找到了答案,但他们使用IDE的工具手动完成了这项工作,就像您在这里看到的一样 我想创建一个脚本,为每个(用户,密码)加密密码并使用加密密码登录 @Keyword def login(user, password, url){ WebUI.navigateToUrl(url) WebUI.setText(findTestObject

我有一个csv,上面有我需要检查登录名的用户和密码列表

是否有任何方法可以在中使用脚本模式加密密码文本输入 卡塔隆

我在上找到了答案,但他们使用IDE的工具手动完成了这项工作,就像您在这里看到的一样

我想创建一个脚本,为每个
(用户,密码)
加密密码并使用加密密码登录

@Keyword
    def  login(user, password, url){

        WebUI.navigateToUrl(url)

        WebUI.setText(findTestObject('Object Repository/Page_Sign in  My Page/input_SigninFormemail'),user)
        def password_encript = Encrypt(password)// Fictitious method that I would like to get

        WebUI.setEncryptedText(findTestObject('Object Repository/Page_Sign in  My Page/input_SigninFormpassword'), password_encript)

        WebUI.click(findTestObject('Object Repository/Page_Sign in  My Page/input_yt0'))

    }
在Katalon中是否有类似于
加密(密码)
的方法? 有没有办法在代码中实现这一点


提前感谢。

所以要使用Java加密:带文本和密钥的河豚。 以下是我的解决方案:

public static String encrypt(String strClearText,String strKey) throws Exception{
String strData="";
//streData-在这里您可以放置您的数据

try {
    SecretKeySpec skeyspec=new SecretKeySpec(strKey.getBytes(),"Blowfish");
    Cipher cipher=Cipher.getInstance("Blowfish");
    cipher.init(Cipher.ENCRYPT_MODE, skeyspec);
    byte[] encrypted=cipher.doFinal(strClearText.getBytes());
    strData=new String(encrypted);

} catch (Exception e) {
    e.printStackTrace();
    throw new Exception(e);
}
return strData;

}

我在调查其他Katalon加密问题时遇到了这个问题,我想我可能会提供一些后期见解

“setEncryptedText(TestObject,encryptedText)”方法允许您以加密形式存储敏感文本,然后在输入web应用程序时解密

既然您的方法以明文形式作为字符串传递“password”,那么为什么不让函数执行以下操作:

WebUI.setText(findTestObject('Object Repository/Page_Sign in  My Page/input_SigninFormpassword'), password)

我正在寻找接收输入文本并返回加密文本的内容,在这种情况下,您可以告诉我应该在
streartext
strKey
中设置什么,请记住,此解决方案应该适用于katalon,并且用于登录网站如果我们从setEncryptedText更改为setText,则会生成另一个错误:(