Current location - Quotes Website - Personality signature - Using beanshell script for parameter hash sha1 encryption in MeterSphere interface test
Using beanshell script for parameter hash sha1 encryption in MeterSphere interface test

The requirements are as follows, the token is generated from the third step interface.

Through script

import org.apache.commons.codec.digest.DigestUtils;

//Import org.apache.commons.codec.digest.DigestUtils package;

< p> String sign = DigestUtils.sha1Hex ("${__time}${token}xxxxx").toUpperCase( );

//Define sign=server time+token+fixed password xxxxx; then.toUpperCase( ) is sent in uppercase;

vars.put("sign", sign);?

//The exported signature is used in the fourth interface;

In the 4 cases, you can use ${sign} directly to encrypt using the sign in the previous step