WeIdentity-Sample国密化部署

2021年3月15日14:39:57BCOS评论521阅读模式

之前基于全国密化搭建了FiSCO BCOS链,但是官网给的WeIdentity-Sample例子是基于非国密的,欲将WeIdentity-Sample在国密下运行,还需要手动修改下。

1.修改代码

WeIdentity-Sample\src\main\java\com\webank\weid\demo\common\util\FileUtil.java

将下面代码中的非国密证书换成国密证书名称即可。

 public static void loadConfigFromEnv() throws BusinessException {
        String buildToolHome = System.getenv("BUILD_TOOL_HOME");

        loadConfig(
            buildToolHome + SLASH_CHARACTER + BUILD_TOOL_RESOURCE_DIR + "fisco.properties",
            RESOURCE_DIR,
            "fisco.properties");
        loadConfig(
            buildToolHome + SLASH_CHARACTER + BUILD_TOOL_RESOURCE_DIR + "gmsdk.key",
            RESOURCE_DIR,
            "gmsdk.key");
        loadConfig(
            buildToolHome + SLASH_CHARACTER + BUILD_TOOL_RESOURCE_DIR + "gmsdk.crt",
            RESOURCE_DIR,
            "gmsdk.crt");
        loadConfig(
            buildToolHome + SLASH_CHARACTER + BUILD_TOOL_RESOURCE_DIR + "gmca.crt",
            RESOURCE_DIR,
            "gmca.crt");
        loadConfig(
            buildToolHome + SLASH_CHARACTER + BUILD_TOOL_RESOURCE_DIR + "weidentity.properties",
            RESOURCE_DIR,
            "weidentity.properties");

        loadConfig(
            buildToolHome + SLASH_CHARACTER + BUILD_TOOL_ADMIN_KEY + "ecdsa_key",
            KEY_DIR,
            "ecdsa_key");

    }

2. 重新编译

cd WeIdentity-Sample
./build.sh

3.启动

./start.sh

注:

若之前部署weid-build-tools,则检查下面变量是否存在。

export $BUILD_TOOL_HOME