本文整理汇总了Java中com.alibaba.cobar.manager.util.EncryptUtil.encrypt方法的典型用法代码示例。如果您正苦于以下问题:Java EncryptUtil.encrypt方法的具体用法?Java EncryptUtil.encrypt怎么用?Java EncryptUtil.encrypt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.cobar.manager.util.EncryptUtil
的用法示例。
在下文中一共展示了EncryptUtil.encrypt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import com.alibaba.cobar.manager.util.EncryptUtil; //导入方法依赖的package包/类
private boolean write(CobarDO cobar) {
try {
writePrefix(false);
xsl.startTag(null, "cobar");
xsl.text("\n");
writeProperty("id", String.valueOf(cobar.getId()));
writeProperty("clusterId", String.valueOf(cobar.getClusterId()));
writeProperty("name", cobar.getName());
writeProperty("status", cobar.getStatus());
writeProperty("host", cobar.getHost());
writeProperty("serverPort", String.valueOf(cobar.getServerPort()));
writeProperty("port", String.valueOf(cobar.getPort()));
writeProperty("user", cobar.getUser());
String password = EncryptUtil.encrypt(cobar.getPassword());
writeProperty("password", password);
writeProperty("time_diff", cobar.getTime_diff());
writePrefix(true);
xsl.endTag(null, "cobar");
xsl.text("\n");
return true;
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
return false;
}
示例2: testEncrypt
import com.alibaba.cobar.manager.util.EncryptUtil; //导入方法依赖的package包/类
@Test
public void testEncrypt() {
String src = "test";
String encrySrc = EncryptUtil.encrypt(src);
Assert.assertEquals(encrySrc, EncryptUtil.encrypt(src));
Assert.assertEquals(src, EncryptUtil.decrypt(encrySrc));
}