From ca768d676bdb966cf5bc486c888060aaae975323 Mon Sep 17 00:00:00 2001 From: youwenbusi <1245549353@qq.com> Date: Fri, 12 Aug 2022 20:49:09 +0800 Subject: [PATCH 1/2] promote suite --- VERSION | 2 +- authorityIssuer.address | 2 +- build.gradle | 21 +++++++--- cptController.address | 2 +- dist/conf/fisco.properties.tpl | 6 +-- evidenceController.address | 2 +- hash | 2 +- public_key | 2 +- specificIssuer.address | 2 +- .../contract/deploy/v2/DeployEvidenceV2.java | 4 +- .../contract/deploy/v3/DeployContractV3.java | 6 +-- .../contract/deploy/v3/DeployEvidenceV3.java | 4 +- .../weid/service/fisco/v2/WeServerV2.java | 16 ++++---- .../weid/service/fisco/v3/WeServerV3.java | 16 ++++---- .../fiscov3/EvidenceServiceEngineV3.java | 14 ++----- .../engine/fiscov3/WeIdServiceEngineV3.java | 2 +- .../com/webank/weid/util/DataToolUtils.java | 4 +- src/main/resources/ecdsa_key | 1 - src/main/resources/ecdsa_key.pub | 1 - src/main/resources/fisco.properties | 41 ++++++------------- src/main/resources/fisco.properties.tpl | 2 +- src/main/resources/{sm2_key => private_key} | 0 .../resources/{sm2_key.pub => public_key} | 0 .../auth/TestGetAllAuthorityIssuerList.java | 3 +- .../weid/full/auth/TestIsAuthorityIssuer.java | 4 +- .../full/cpt/TestRegisterCptArgsWithId.java | 2 +- .../full/evidence/TestCreateEvidence.java | 8 ++-- .../weid/full/evidence/TestGetEvidence.java | 5 ++- src/test/resources/ecdsa_key.pub | 1 - src/test/resources/fisco.properties.tpl | 18 +------- src/test/resources/{sm2_key => private_key} | 0 .../resources/{sm2_key.pub => public_key} | 0 weIdContract.address | 2 +- 33 files changed, 84 insertions(+), 111 deletions(-) delete mode 100644 src/main/resources/ecdsa_key delete mode 100644 src/main/resources/ecdsa_key.pub rename src/main/resources/{sm2_key => private_key} (100%) rename src/main/resources/{sm2_key.pub => public_key} (100%) delete mode 100644 src/test/resources/ecdsa_key.pub rename src/test/resources/{sm2_key => private_key} (100%) rename src/test/resources/{sm2_key.pub => public_key} (100%) diff --git a/VERSION b/VERSION index 31ffa3320..f9e6ae892 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.8.5-rc.1-SNAPSHOT \ No newline at end of file +1.8.5-rc.8-SNAPSHOT \ No newline at end of file diff --git a/authorityIssuer.address b/authorityIssuer.address index c44b4475a..48f0cdd03 100644 --- a/authorityIssuer.address +++ b/authorityIssuer.address @@ -1 +1 @@ -0x05f806a27d3e0fb397d297ebdadd909906a964c3 \ No newline at end of file +0x2e460A0D87e81DdAce31A7402a2adc0bd6A6B215 \ No newline at end of file diff --git a/build.gradle b/build.gradle index d85dcda86..726004a3e 100644 --- a/build.gradle +++ b/build.gradle @@ -93,7 +93,7 @@ List logger = [ // junit test List junit = [ - "junit:junit:4.12" + "junit:junit:4.13.1" ] List apache_commons = [ @@ -116,6 +116,11 @@ List json = [ "com.networknt:json-schema-validator:1.0.71", ] +def gson_version = "2.8.9" +List gson = [ + "com.google.code.gson:gson:$gson_version" +] + List mysql_driver = [ "mysql:mysql-connector-java:8.0.20", // todo runtime "org.apache.commons:commons-dbcp2:2.5.0" @@ -136,11 +141,11 @@ List rpc = [ ] List pdfbox = [ - "org.apache.pdfbox:pdfbox:2.0.16" + "org.apache.pdfbox:pdfbox:2.0.24" ] List protobuf = [ - "com.google.protobuf:protobuf-java:3.9.1" + "com.google.protobuf:protobuf-java:3.19.2" ] List caffeine = [ @@ -160,11 +165,15 @@ configurations { all*.exclude group: "io.netty", module: "netty-tcnative" } +configurations.all { + resolutionStrategy.cacheChangingModulesFor 0, 'seconds' +} + dependencies { localDeps 'org.projectlombok:lombok:1.18.10' if (!gradle.startParameter.isOffline()) { - compile logger, lombok, apache_commons, json, mysql_driver, redisson, zxing, rpc, pdfbox, protobuf, caffeine, oval - compile("com.webank:weid-contract-java:1.3.0-rc.2-SNAPSHOT") + compile logger, lombok, apache_commons, json, mysql_driver, redisson, zxing, rpc, pdfbox, protobuf, caffeine, oval, gson + compile("com.webank:weid-contract-java:1.3.0-rc.4-SNAPSHOT") compile fileTree(dir: 'lib', include: '*.jar') implementation 'com.google.guava:guava:31.1-jre' @@ -173,7 +182,7 @@ dependencies { implementation group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.4.15' annotationProcessor lombok - testCompile logger, lombok, apache_commons, json, junit, jmockit, rpc, pdfbox, protobuf, caffeine, oval, spring + testCompile logger, lombok, apache_commons, json, junit, jmockit, rpc, pdfbox, protobuf, caffeine, oval, spring, gson testAnnotationProcessor lombok } if (gradleVer.startsWith("4")) { diff --git a/cptController.address b/cptController.address index b30cb112f..cf6faf6d5 100644 --- a/cptController.address +++ b/cptController.address @@ -1 +1 @@ -0xe38b97db6c945c8ec37390dc1e8868ea094dc161 \ No newline at end of file +0x0c88cC8fF27717519e5a5b34E4c07A96E7454316 \ No newline at end of file diff --git a/dist/conf/fisco.properties.tpl b/dist/conf/fisco.properties.tpl index 0c9df65ab..32042f80d 100644 --- a/dist/conf/fisco.properties.tpl +++ b/dist/conf/fisco.properties.tpl @@ -2,7 +2,7 @@ ####################################################################################################### # # -# fisco bcos version config # +# fisco bcos 2 or 3 version config # # # ####################################################################################################### # Version @@ -53,8 +53,8 @@ group.id=1 # fisco bcos node cert related config # # # ####################################################################################################### -# Fisco-Bcos sdk SSL encrypt type, false:ECDSA, true:SM2 -sdk.sm-crypto=false +# Fisco-Bcos sdk SSL encrypt type, false:ECDSA, true:SaM2 +sdk.sm-crypto=${SDK_SM_CRYPTO} # fisco-bcos sdk cert path contains[ca.crt,sdk.crt,sdk.key] # if sdk.sm-crypto is true, contains [gm] directory, and gm dir contains [gmca.crt,gmsdk.crt,gmsdk.key,gmensdk.crt,gmensdk.key] sdk.cert-path=conf diff --git a/evidenceController.address b/evidenceController.address index 98b790bba..8a49e62cd 100644 --- a/evidenceController.address +++ b/evidenceController.address @@ -1 +1 @@ -0x5e5ca44c585b927d0cd13ceb32c90ab9343e4889 \ No newline at end of file +0x15B0C2f6F0E01D7792B7e980C6b3e4DED2517015 \ No newline at end of file diff --git a/hash b/hash index 882ab021b..a180ccb40 100644 --- a/hash +++ b/hash @@ -1 +1 @@ -0x8dbf78b289f33000e57e80fc15d415b40f2cfe5688d7a92f07393b97606aeed7 \ No newline at end of file +0x74ca478cbab6dd09a36da3f3bf56e433174e983ec38d5bd0d3e13593f72ae261 \ No newline at end of file diff --git a/public_key b/public_key index aec4b2e37..098cedf96 100644 --- a/public_key +++ b/public_key @@ -1 +1 @@ -5686332858406600098574930615286920155179124750677701187633916230205742334882670952535475018419229666394535946783087534972161773024961235927824774898541110 \ No newline at end of file +13079093397463814932731720163442777403208788175453836227824139092404945067394266611910031425181012754616377192193136435818972874637291518463471522281921222 \ No newline at end of file diff --git a/specificIssuer.address b/specificIssuer.address index 1dc347d96..0b1cbfd3b 100644 --- a/specificIssuer.address +++ b/specificIssuer.address @@ -1 +1 @@ -0xaac9e23ff83e3e52179f661bdb39de4b97006cb3 \ No newline at end of file +0x10B3808a3e2369244825e60dB85470Ac5f08A091 \ No newline at end of file diff --git a/src/main/java/com/webank/weid/contract/deploy/v2/DeployEvidenceV2.java b/src/main/java/com/webank/weid/contract/deploy/v2/DeployEvidenceV2.java index 92d29fe95..069e60b34 100644 --- a/src/main/java/com/webank/weid/contract/deploy/v2/DeployEvidenceV2.java +++ b/src/main/java/com/webank/weid/contract/deploy/v2/DeployEvidenceV2.java @@ -50,8 +50,8 @@ private static String initCryptoKeyPair(String inputPrivateKey) { byte[] pubBytes = Numeric.hexStringToByteArray(cryptoKeyPair.getHexPublicKey()); String privateKey = new BigInteger(1, priBytes).toString(10); String publicKey = new BigInteger(1, pubBytes).toString(10); - writeAddressToFile(publicKey, "ecdsa_key.pub"); - writeAddressToFile(privateKey, "ecdsa_key"); + writeAddressToFile(publicKey, "public_key"); + writeAddressToFile(privateKey, "private_key"); } //if (credentials == null) { diff --git a/src/main/java/com/webank/weid/contract/deploy/v3/DeployContractV3.java b/src/main/java/com/webank/weid/contract/deploy/v3/DeployContractV3.java index a5b38dae1..528075385 100644 --- a/src/main/java/com/webank/weid/contract/deploy/v3/DeployContractV3.java +++ b/src/main/java/com/webank/weid/contract/deploy/v3/DeployContractV3.java @@ -82,8 +82,8 @@ private static boolean initCryptoKeyPair(String inputPrivateKey) { byte[] pubBytes = Numeric.hexStringToByteArray(cryptoKeyPair.getHexPublicKey()); String privateKey = new BigInteger(1, priBytes).toString(10); String publicKey = new BigInteger(1, pubBytes).toString(10); - writeAddressToFile(publicKey, "ecdsa_key.pub"); - writeAddressToFile(privateKey, "ecdsa_key"); + writeAddressToFile(publicKey, "public_key"); + writeAddressToFile(privateKey, "private_key"); return true; } @@ -130,7 +130,7 @@ private static void registerToCns( FiscoConfig fiscoConfig, boolean instantEnable ) { - String privateKey = AddressProcess.getAddressFromFile("ecdsa_key"); + String privateKey = AddressProcess.getAddressFromFile("private_key"); WeIdPrivateKey weIdPrivate = new WeIdPrivateKey(); weIdPrivate.setPrivateKey(privateKey); registerAddress(weIdPrivate, fiscoConfig, instantEnable); diff --git a/src/main/java/com/webank/weid/contract/deploy/v3/DeployEvidenceV3.java b/src/main/java/com/webank/weid/contract/deploy/v3/DeployEvidenceV3.java index b85c660fb..c057af1e6 100644 --- a/src/main/java/com/webank/weid/contract/deploy/v3/DeployEvidenceV3.java +++ b/src/main/java/com/webank/weid/contract/deploy/v3/DeployEvidenceV3.java @@ -53,8 +53,8 @@ private static String initCryptoKeyPair(String inputPrivateKey) { byte[] pubBytes = Numeric.hexStringToByteArray(cryptoKeyPair.getHexPublicKey()); String privateKey = new BigInteger(1, priBytes).toString(10); String publicKey = new BigInteger(1, pubBytes).toString(10); - writeAddressToFile(publicKey, "ecdsa_key.pub"); - writeAddressToFile(privateKey, "ecdsa_key"); + writeAddressToFile(publicKey, "public_key"); + writeAddressToFile(privateKey, "private_key"); } //if (credentials == null) { diff --git a/src/main/java/com/webank/weid/service/fisco/v2/WeServerV2.java b/src/main/java/com/webank/weid/service/fisco/v2/WeServerV2.java index edf43a697..5ea84d824 100644 --- a/src/main/java/com/webank/weid/service/fisco/v2/WeServerV2.java +++ b/src/main/java/com/webank/weid/service/fisco/v2/WeServerV2.java @@ -251,13 +251,11 @@ private void initAmopTopic(ConfigProperty configProperty, FiscoConfig fiscoConfi AmopTopic amopTopic = new AmopTopic(); amopTopic.setTopicName(fiscoConfig.getAmopId()); // 配置amop用到的私钥文件,写入的是public keys的路径和p12私钥的路径及p12密码 -// amopTopic.setPublicKeys(Arrays.asList(fiscoConfig.getAmopPubPath())); -// amopTopic.setPrivateKey(fiscoConfig.getPrivateKey()); -// amopTopic.setPassword(fiscoConfig.getAmopP12Password()); - - amopTopic.setPublicKeys(Arrays.asList("E:\\weid-afee\\WeIdentity\\out\\production\\resources\\consumer_public_key.pem")); - amopTopic.setPrivateKey("E:\\weid-afee\\WeIdentity\\out\\production\\resources\\consumer_private_key.p12"); + amopTopic.setPublicKeys(Arrays.asList(fiscoConfig.getAmopPubPath())); + amopTopic.setPrivateKey(fiscoConfig.getPrivateKey()); + //amopTopic.setPublicKeys(Arrays.asList("E:\\weid-afee\\WeIdentity\\out\\production\\resources\\consumer_public_key.pem")); + //amopTopic.setPrivateKey("E:\\weid-afee\\WeIdentity\\out\\production\\resources\\consumer_private_key.p12"); amopTopic.setPassword(fiscoConfig.getAmopP12Password()); List amop = new ArrayList(); amop.add(amopTopic); @@ -287,9 +285,9 @@ private void initCryptoMaterial(ConfigProperty configProperty, FiscoConfig fisco cryptoMaterial.put("useSMCrypto", fiscoConfig.getSdkSMCrypto()); cryptoMaterial.put("certPath", fiscoConfig.getSdkCertPath()); logger.info("path:{} before", cryptoMaterial.get("certPath")); - cryptoMaterial.put("certPath", "E:\\weid-afee\\WeIdentity\\out\\test\\resources"); - cryptoMaterial.put("certPath", "E:\\weid-afee\\WeIdentity\\out\\production\\resources"); - logger.info("path:{}", cryptoMaterial.get("certPath")); + //cryptoMaterial.put("certPath", "E:\\weid-afee\\WeIdentity\\out\\test\\resources"); + //cryptoMaterial.put("certPath", "E:\\weid-afee\\WeIdentity\\out\\production\\resources"); + //logger.info("path:{}", cryptoMaterial.get("certPath")); // cryptoMaterial.put("certPath", this.getClass().getResource("classpath:").getPath()); // cryptoMaterial.put("caCert", // FiscoConfig.class.getResource("classpath:" + fiscoConfig.getV2CaCrtPath())); diff --git a/src/main/java/com/webank/weid/service/fisco/v3/WeServerV3.java b/src/main/java/com/webank/weid/service/fisco/v3/WeServerV3.java index 4bcb40a37..cd11efd3f 100644 --- a/src/main/java/com/webank/weid/service/fisco/v3/WeServerV3.java +++ b/src/main/java/com/webank/weid/service/fisco/v3/WeServerV3.java @@ -109,7 +109,7 @@ public Class getWeb3jClass() { @Override public CryptoKeyPair getCredentials() { - Client client = this.getWeb3j(fiscoConfig.getGroupId()); + Client client = this.getWeb3j(); return client.getCryptoSuite().getCryptoKeyPair(); } @@ -181,7 +181,7 @@ public void onResponse(Response response) { @Override public int getBlockNumber() { - return this.getWeb3j(fiscoConfig.getGroupId()).getBlockNumber().getBlockNumber().intValue(); + return this.getWeb3j().getBlockNumber().getBlockNumber().intValue(); } /** @@ -331,10 +331,10 @@ private void initCryptoMaterial(ConfigProperty configProperty, FiscoConfig fisco cryptoMaterial.put("useSMCrypto", fiscoConfig.getSdkSMCrypto()); cryptoMaterial.put("certPath", fiscoConfig.getSdkCertPath()); logger.info("path:{} before", cryptoMaterial.get("certPath")); - cryptoMaterial.put("certPath", "D:\\projects\\weid\\WeIdentity\\out\\test\\resources"); - logger.info("path:{}", cryptoMaterial.get("certPath")); - cryptoMaterial.put("certPath", "D:\\projects\\weid\\WeIdentity\\out\\production\\resources"); - logger.info("[initThreadPool] the cryptoMaterial: {}.", cryptoMaterial); + //cryptoMaterial.put("certPath", "E:\\weid-afee\\WeIdentity\\out\\test\\resources"); + //logger.info("path:{}", cryptoMaterial.get("certPath")); + //cryptoMaterial.put("certPath", "E:\\weid-afee\\WeIdentity\\out\\production\\resources"); + //logger.info("[initThreadPool] the cryptoMaterial: {}.", cryptoMaterial); configProperty.setCryptoMaterial(cryptoMaterial); } @@ -380,7 +380,7 @@ private void initAmopCallBack(FiscoConfig fiscoConfig) { } private void initCnsService() { - Client client = this.getWeb3j(fiscoConfig.getGroupId()); + Client client = this.getWeb3j(); this.bfsService = new BFSService(client, client.getCryptoSuite().getCryptoKeyPair()); } @@ -388,7 +388,7 @@ private void initCnsService() { @Override public Set getGroupList() { - List groupStrList = bcosSdk.getClient().getGroupList().getResult().getGroupList(); + List groupStrList = this.getWeb3j().getGroupList().getResult().getGroupList(); Set groupList = new HashSet<>(groupStrList); return groupList; } diff --git a/src/main/java/com/webank/weid/service/impl/engine/fiscov3/EvidenceServiceEngineV3.java b/src/main/java/com/webank/weid/service/impl/engine/fiscov3/EvidenceServiceEngineV3.java index 5d0584d94..857fe3b69 100644 --- a/src/main/java/com/webank/weid/service/impl/engine/fiscov3/EvidenceServiceEngineV3.java +++ b/src/main/java/com/webank/weid/service/impl/engine/fiscov3/EvidenceServiceEngineV3.java @@ -21,19 +21,10 @@ import com.webank.weid.suite.cache.CacheNode; import com.webank.weid.util.DataToolUtils; import com.webank.weid.util.WeIdUtils; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; -import org.fisco.bcos.sdk.v3.client.protocol.model.JsonTransactionResponse; -import org.fisco.bcos.sdk.v3.crypto.keypair.CryptoKeyPair; import org.fisco.bcos.sdk.v3.client.Client; +import org.fisco.bcos.sdk.v3.client.protocol.model.JsonTransactionResponse; import org.fisco.bcos.sdk.v3.client.protocol.response.BcosBlock; import org.fisco.bcos.sdk.v3.client.protocol.response.BcosBlock.TransactionResult; import org.fisco.bcos.sdk.v3.codec.datatypes.generated.Bytes32; @@ -42,6 +33,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.math.BigInteger; +import java.util.*; + /** * EvidenceServiceEngine calls evidence contract which runs on FISCO BCOS 2.0. * diff --git a/src/main/java/com/webank/weid/service/impl/engine/fiscov3/WeIdServiceEngineV3.java b/src/main/java/com/webank/weid/service/impl/engine/fiscov3/WeIdServiceEngineV3.java index 9e55393fc..1d9320e84 100644 --- a/src/main/java/com/webank/weid/service/impl/engine/fiscov3/WeIdServiceEngineV3.java +++ b/src/main/java/com/webank/weid/service/impl/engine/fiscov3/WeIdServiceEngineV3.java @@ -39,7 +39,7 @@ import org.apache.commons.lang3.StringUtils; import org.fisco.bcos.sdk.model.CryptoType; import org.fisco.bcos.sdk.v3.client.protocol.model.JsonTransactionResponse; -import org.fisco.bcos.sdk.v3.client.protocol.model.Transaction; +//import org.fisco.bcos.sdk.v3.client.protocol.model.Transaction; import org.fisco.bcos.sdk.v3.client.protocol.response.BcosBlock; import org.fisco.bcos.sdk.v3.client.protocol.response.BcosBlock.TransactionResult; import org.fisco.bcos.sdk.v3.codec.EventEncoder; diff --git a/src/main/java/com/webank/weid/util/DataToolUtils.java b/src/main/java/com/webank/weid/util/DataToolUtils.java index 6e46a432f..60e1f706d 100644 --- a/src/main/java/com/webank/weid/util/DataToolUtils.java +++ b/src/main/java/com/webank/weid/util/DataToolUtils.java @@ -251,7 +251,7 @@ public static String serialize(T object) { * @param privateKey the pass-in privatekey * @return true if yes, false otherwise */ - public static String convertPrivateKeyToDefaultWeId(BigInteger privateKey) { + /*public static String convertPrivateKeyToDefaultWeId(BigInteger privateKey) { return publicKeyStrFromPrivate(privateKey); // BigInteger publicKey; // if (encryptType.equals(String.valueOf(EncryptType.ECDSA_TYPE))) { @@ -264,7 +264,7 @@ public static String convertPrivateKeyToDefaultWeId(BigInteger privateKey) { // Keys.getAddress(publicKey)).toString()); // CryptoKeyPair keyPair = createKeyPairFromPrivate(new BigInteger(privateKey)); // return WeIdUtils.convertAddressToWeId(keyPair.getAddress()); - } + }*/ /** * Check whether the String is a valid hash. diff --git a/src/main/resources/ecdsa_key b/src/main/resources/ecdsa_key deleted file mode 100644 index 221afc917..000000000 --- a/src/main/resources/ecdsa_key +++ /dev/null @@ -1 +0,0 @@ -77569853268827025301106586648499052574270777490240356626990325483970880009134 \ No newline at end of file diff --git a/src/main/resources/ecdsa_key.pub b/src/main/resources/ecdsa_key.pub deleted file mode 100644 index b17be8ec9..000000000 --- a/src/main/resources/ecdsa_key.pub +++ /dev/null @@ -1 +0,0 @@ -8039143802718089509473020012592915372626698546624293755452376369425609791849786220916199982271522236884192978302246514161153553333215479758544800361628212 \ No newline at end of file diff --git a/src/main/resources/fisco.properties b/src/main/resources/fisco.properties index 97cd9fdc1..3c32df1f1 100644 --- a/src/main/resources/fisco.properties +++ b/src/main/resources/fisco.properties @@ -21,11 +21,11 @@ issuer.contractaddress= evidence.contractaddress= specificissuer.contractaddress= -# This variable is used to distinguish the environment. You can use "dev" to set the development environment, +# This variable is used to distinguish the environment. You can use "dev" to set the development environment, # "stg" to set the test environment, "prd" to set the production environment, -# If you do not set it, the system will use allOrg as the environment by default. +# If you do not set it, the system will use allOrg as the environment by default. # It is not recommended. Production use default configuration -cns.profile.active=prd140 +cns.profile.active=2 ####################################################################################################### # # @@ -38,13 +38,7 @@ web3sdk.core-pool-size=100 web3sdk.max-pool-size=200 web3sdk.queue-capacity=1000 web3sdk.keep-alive-seconds=60 -# Fisco-Bcos sdk SSL encrypt type, false:ECDSA, true:SM2 -sdk.sm-crypto=true -sdk.cert-path=conf -# amop public key of pem and private key of p12 configuration -amop.pub-path=conf/amop/consumer_public_key.pem -amop.pri-path=conf/amop/consumer_private_key.p12 -amop.p12-password=123456 + ####################################################################################################### # # @@ -54,27 +48,18 @@ amop.p12-password=123456 # Fisco-Bcos 2.x params, including Group ID and Encrypt Type group.id=1 - ####################################################################################################### # # # fisco bcos node cert related config # # # ####################################################################################################### -# config files params -v1.ca-crt-path=ca.crt -v1.client-crt-password=123456 -v1.client-key-store-path=client.keystore -v1.key-store-password=123456 - - - -v2.ca-crt-path=ca.crt -v2.node-crt-path=node.crt -v2.node-key-path=node.key +# Fisco-Bcos sdk SSL encrypt type, false:ECDSA, true:SM2 +sdk.sm-crypto=true +# fisco-bcos sdk cert path contains[ca.crt,sdk.crt,sdk.key] +# if sdk.sm-crypto is true, contains [gm] directory, and gm dir contains [gmca.crt,gmsdk.crt,gmsdk.key,gmensdk.crt,gmensdk.key] +sdk.cert-path=conf -# gm -gm.ca-crt-path=gmca.crt -gm.sdk-crt-path=gmsdk.crt -gm.sdk-key-path=gmsdk.key -gmen.sdk-crt-path=gmensdk.crt -gmen.sdk-key-path=gmensdk.key \ No newline at end of file +# amop public key of pem and private key of p12 configuration +amop.pub-path=conf/amop/consumer_public_key.pem +amop.pri-path=conf/amop/consumer_private_key.p12 +amop.p12-password=123456 \ No newline at end of file diff --git a/src/main/resources/fisco.properties.tpl b/src/main/resources/fisco.properties.tpl index 3d0cc3f17..32042f80d 100644 --- a/src/main/resources/fisco.properties.tpl +++ b/src/main/resources/fisco.properties.tpl @@ -53,7 +53,7 @@ group.id=1 # fisco bcos node cert related config # # # ####################################################################################################### -# Fisco-Bcos sdk SSL encrypt type, false:ECDSA, true:SM2 +# Fisco-Bcos sdk SSL encrypt type, false:ECDSA, true:SaM2 sdk.sm-crypto=${SDK_SM_CRYPTO} # fisco-bcos sdk cert path contains[ca.crt,sdk.crt,sdk.key] # if sdk.sm-crypto is true, contains [gm] directory, and gm dir contains [gmca.crt,gmsdk.crt,gmsdk.key,gmensdk.crt,gmensdk.key] diff --git a/src/main/resources/sm2_key b/src/main/resources/private_key similarity index 100% rename from src/main/resources/sm2_key rename to src/main/resources/private_key diff --git a/src/main/resources/sm2_key.pub b/src/main/resources/public_key similarity index 100% rename from src/main/resources/sm2_key.pub rename to src/main/resources/public_key diff --git a/src/test/java/com/webank/weid/full/auth/TestGetAllAuthorityIssuerList.java b/src/test/java/com/webank/weid/full/auth/TestGetAllAuthorityIssuerList.java index 6afb53423..bb5ce3197 100644 --- a/src/test/java/com/webank/weid/full/auth/TestGetAllAuthorityIssuerList.java +++ b/src/test/java/com/webank/weid/full/auth/TestGetAllAuthorityIssuerList.java @@ -3,6 +3,7 @@ import java.math.BigInteger; import java.util.List; +import com.webank.weid.util.WeIdUtils; import org.apache.commons.collections4.CollectionUtils; import org.fisco.bcos.sdk.crypto.CryptoSuite; import org.fisco.bcos.sdk.crypto.keystore.KeyTool; @@ -152,7 +153,7 @@ public void testGetAllAuthorityIssuerList_removeListThenQuery() { Assert.assertEquals(ErrorCode.SUCCESS.getCode(), response.getErrorCode().intValue()); List authorityIssuers = response.getResult(); - String sdkWeId = DataToolUtils.convertPrivateKeyToDefaultWeId(new BigInteger(privateKey)); + String sdkWeId = WeIdUtils.getWeIdFromPrivateKey(privateKey); for (int i = 0; i < authorityIssuers.size(); i++) { String weId = authorityIssuers.get(i).getWeId(); diff --git a/src/test/java/com/webank/weid/full/auth/TestIsAuthorityIssuer.java b/src/test/java/com/webank/weid/full/auth/TestIsAuthorityIssuer.java index 387e19004..1ec5f4743 100644 --- a/src/test/java/com/webank/weid/full/auth/TestIsAuthorityIssuer.java +++ b/src/test/java/com/webank/weid/full/auth/TestIsAuthorityIssuer.java @@ -2,6 +2,7 @@ package com.webank.weid.full.auth; +import com.webank.weid.util.DataToolUtils; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; @@ -17,6 +18,8 @@ import com.webank.weid.protocol.response.CreateWeIdDataResult; import com.webank.weid.protocol.response.ResponseData; +import java.math.BigInteger; + /** * isAuthorityIssuer method for testing AuthorityIssuerService. * @@ -51,7 +54,6 @@ public void testIsAuthorityIssuerSuccess() { AuthorityIssuer authorityIssuer = authorityIssuerService.queryAuthorityIssuerInfo(createWeId.getWeId()).getResult(); Assert.assertFalse(authorityIssuer.isRecognized()); - response = authorityIssuerService.recognizeAuthorityIssuer(createWeId.getWeId(), new WeIdPrivateKey(privateKey)); Assert.assertTrue(response.getResult()); diff --git a/src/test/java/com/webank/weid/full/cpt/TestRegisterCptArgsWithId.java b/src/test/java/com/webank/weid/full/cpt/TestRegisterCptArgsWithId.java index 0a0806170..fccbb6f20 100644 --- a/src/test/java/com/webank/weid/full/cpt/TestRegisterCptArgsWithId.java +++ b/src/test/java/com/webank/weid/full/cpt/TestRegisterCptArgsWithId.java @@ -48,7 +48,7 @@ public synchronized void testInit() { if (createWeId == null) { createWeId = super.createWeId(); super.registerAuthorityIssuer(createWeId); - authorityIssuerService + ResponseData responseData = authorityIssuerService .recognizeAuthorityIssuer(createWeId.getWeId(), new WeIdPrivateKey(privateKey)); } } diff --git a/src/test/java/com/webank/weid/full/evidence/TestCreateEvidence.java b/src/test/java/com/webank/weid/full/evidence/TestCreateEvidence.java index 6c916b055..7e51b3b34 100644 --- a/src/test/java/com/webank/weid/full/evidence/TestCreateEvidence.java +++ b/src/test/java/com/webank/weid/full/evidence/TestCreateEvidence.java @@ -26,6 +26,8 @@ import java.util.Arrays; import java.util.List; import java.util.UUID; + +import com.webank.weid.util.WeIdUtils; import org.apache.commons.lang3.StringUtils; import org.fisco.bcos.sdk.client.Client; import org.fisco.bcos.sdk.crypto.keypair.CryptoKeyPair; @@ -382,7 +384,7 @@ public void testBatchCreate() throws Exception { hashValues.add(credential.getHash()); signatures.add(DataToolUtils.SigBase64Serialization(DataToolUtils.signToRsvSignature(hash, privateKey))); timestamps.add(System.currentTimeMillis()); - signers.add(DataToolUtils.convertPrivateKeyToDefaultWeId(new BigInteger(privateKey))); + signers.add(WeIdUtils.getWeIdFromPrivateKey(privateKey)); logs.add("test log" + i); if (i % 2 == 1) { customKeys.add(String.valueOf(System.currentTimeMillis())); @@ -467,7 +469,7 @@ public void testBatchCreateMultiGroup() throws IOException { argList.add("test log" + i); argList.add(DateUtils.getNoMillisecondTimeStampString()); argList - .add(DataToolUtils.convertPrivateKeyToDefaultWeId(new BigInteger(privateKey))); + .add(WeIdUtils.getWeIdFromPrivateKey(privateKey)); if (i % 2 == 1) { argList.add("2"); } @@ -491,7 +493,7 @@ public void testBatchCreateMultiGroup() throws IOException { argList.add("test log" + i); argList.add(DateUtils.getNoMillisecondTimeStampString()); argList - .add(DataToolUtils.convertPrivateKeyToDefaultWeId(new BigInteger(privateKey))); + .add(WeIdUtils.getWeIdFromPrivateKey(privateKey)); if (i % 2 == 1) { argList.add("2"); } diff --git a/src/test/java/com/webank/weid/full/evidence/TestGetEvidence.java b/src/test/java/com/webank/weid/full/evidence/TestGetEvidence.java index e6e7d0a21..8133b2b9e 100644 --- a/src/test/java/com/webank/weid/full/evidence/TestGetEvidence.java +++ b/src/test/java/com/webank/weid/full/evidence/TestGetEvidence.java @@ -3,6 +3,7 @@ package com.webank.weid.full.evidence; import org.fisco.bcos.sdk.crypto.CryptoSuite; +import org.fisco.bcos.sdk.utils.Numeric; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; @@ -33,8 +34,8 @@ public synchronized void testInit() { */ @Test public void testGetEvidence_success() { - HashString str = new HashString( - new CryptoSuite(0).hash(DateUtils.getNoMillisecondTimeStampString())); + String hashStr = new CryptoSuite(0).hash(DateUtils.getNoMillisecondTimeStampString()); + HashString str = new HashString(Numeric.prependHexPrefix(hashStr)); ResponseData evidence = evidenceService .createEvidence(str, createWeIdResultWithSetAttr.getUserWeIdPrivateKey()); Assert.assertTrue(!evidence.getResult().isEmpty()); diff --git a/src/test/resources/ecdsa_key.pub b/src/test/resources/ecdsa_key.pub deleted file mode 100644 index b17be8ec9..000000000 --- a/src/test/resources/ecdsa_key.pub +++ /dev/null @@ -1 +0,0 @@ -8039143802718089509473020012592915372626698546624293755452376369425609791849786220916199982271522236884192978302246514161153553333215479758544800361628212 \ No newline at end of file diff --git a/src/test/resources/fisco.properties.tpl b/src/test/resources/fisco.properties.tpl index 16f56a0e7..734eca809 100644 --- a/src/test/resources/fisco.properties.tpl +++ b/src/test/resources/fisco.properties.tpl @@ -53,12 +53,6 @@ group.id=1 # fisco bcos node cert related config # # # ####################################################################################################### -# config files params -v1.ca-crt-path=ca.crt -v1.client-crt-password=123456 -v1.client-key-store-path=client.keystore -v1.key-store-password=123456 -# v2 fisco config # Fisco-Bcos sdk SSL encrypt type, false:ECDSA, true:SM2 sdk.sm-crypto=false # fisco-bcos sdk cert path contains[ca.crt,sdk.crt,sdk.key] @@ -68,14 +62,4 @@ sdk.cert-path=conf # amop public key of pem and private key of p12 configuration amop.pub-path=conf/amop/consumer_public_key.pem amop.pri-path=conf/amop/consumer_private_key.p12 -amop.p12-password=123456 - -v2.ca-crt-path=ca.crt -v2.node-crt-path=node.crt -v2.node-key-path=node.key -# gm -gm.ca-crt-path=gmca.crt -gm.sdk-crt-path=gmsdk.crt -gm.sdk-key-path=gmsdk.key -gmen.sdk-crt-path=gmensdk.crt -gmen.sdk-key-path=gmensdk.key \ No newline at end of file +amop.p12-password=123456 \ No newline at end of file diff --git a/src/test/resources/sm2_key b/src/test/resources/private_key similarity index 100% rename from src/test/resources/sm2_key rename to src/test/resources/private_key diff --git a/src/test/resources/sm2_key.pub b/src/test/resources/public_key similarity index 100% rename from src/test/resources/sm2_key.pub rename to src/test/resources/public_key diff --git a/weIdContract.address b/weIdContract.address index 502567c22..6b5addddb 100644 --- a/weIdContract.address +++ b/weIdContract.address @@ -1 +1 @@ -0x5c449ecb56bfb47da35fd17ff6b1f371ad8a9695 \ No newline at end of file +0x3a639d1B81a77389C6d8A0D7F22FBD5Ac2F71Ef6 \ No newline at end of file From 7413b3076f6eedc1343bab84432a9d3534cb7641 Mon Sep 17 00:00:00 2001 From: youwenbusi <1245549353@qq.com> Date: Fri, 12 Aug 2022 20:58:49 +0800 Subject: [PATCH 2/2] delete deployed contract --- authorityIssuer.address | 1 - cptController.address | 1 - evidenceController.address | 1 - specificIssuer.address | 1 - weIdContract.address | 1 - 5 files changed, 5 deletions(-) delete mode 100644 authorityIssuer.address delete mode 100644 cptController.address delete mode 100644 evidenceController.address delete mode 100644 specificIssuer.address delete mode 100644 weIdContract.address diff --git a/authorityIssuer.address b/authorityIssuer.address deleted file mode 100644 index 48f0cdd03..000000000 --- a/authorityIssuer.address +++ /dev/null @@ -1 +0,0 @@ -0x2e460A0D87e81DdAce31A7402a2adc0bd6A6B215 \ No newline at end of file diff --git a/cptController.address b/cptController.address deleted file mode 100644 index cf6faf6d5..000000000 --- a/cptController.address +++ /dev/null @@ -1 +0,0 @@ -0x0c88cC8fF27717519e5a5b34E4c07A96E7454316 \ No newline at end of file diff --git a/evidenceController.address b/evidenceController.address deleted file mode 100644 index 8a49e62cd..000000000 --- a/evidenceController.address +++ /dev/null @@ -1 +0,0 @@ -0x15B0C2f6F0E01D7792B7e980C6b3e4DED2517015 \ No newline at end of file diff --git a/specificIssuer.address b/specificIssuer.address deleted file mode 100644 index 0b1cbfd3b..000000000 --- a/specificIssuer.address +++ /dev/null @@ -1 +0,0 @@ -0x10B3808a3e2369244825e60dB85470Ac5f08A091 \ No newline at end of file diff --git a/weIdContract.address b/weIdContract.address deleted file mode 100644 index 6b5addddb..000000000 --- a/weIdContract.address +++ /dev/null @@ -1 +0,0 @@ -0x3a639d1B81a77389C6d8A0D7F22FBD5Ac2F71Ef6 \ No newline at end of file