diff --git a/source/base/pom.xml b/source/base/pom.xml index e010425a..68a2cf0e 100644 --- a/source/base/pom.xml +++ b/source/base/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain jdchain-root - 0.8.2.RELEASE + 0.9.0-SNAPSHOT base \ No newline at end of file diff --git a/source/binary-proto/pom.xml b/source/binary-proto/pom.xml index 63ce3ffc..e94d5c51 100644 --- a/source/binary-proto/pom.xml +++ b/source/binary-proto/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain jdchain-root - 0.8.2.RELEASE + 0.9.0-SNAPSHOT binary-proto diff --git a/source/consensus/consensus-bftsmart/pom.xml b/source/consensus/consensus-bftsmart/pom.xml index ddf7b73a..f9e763f2 100644 --- a/source/consensus/consensus-bftsmart/pom.xml +++ b/source/consensus/consensus-bftsmart/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain consensus - 0.8.2.RELEASE + 0.9.0-SNAPSHOT consensus-bftsmart diff --git a/source/consensus/consensus-framework/pom.xml b/source/consensus/consensus-framework/pom.xml index 53f87df7..123f6520 100644 --- a/source/consensus/consensus-framework/pom.xml +++ b/source/consensus/consensus-framework/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain consensus - 0.8.2.RELEASE + 0.9.0-SNAPSHOT consensus-framework diff --git a/source/consensus/consensus-mq/pom.xml b/source/consensus/consensus-mq/pom.xml index 7e5a6a0b..823d4a52 100644 --- a/source/consensus/consensus-mq/pom.xml +++ b/source/consensus/consensus-mq/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain consensus - 0.8.2.RELEASE + 0.9.0-SNAPSHOT consensus-mq diff --git a/source/consensus/pom.xml b/source/consensus/pom.xml index c7b8c41e..9d662de2 100644 --- a/source/consensus/pom.xml +++ b/source/consensus/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain jdchain-root - 0.8.2.RELEASE + 0.9.0-SNAPSHOT consensus pom diff --git a/source/contract/contract-compiler/pom.xml b/source/contract/contract-compiler/pom.xml new file mode 100644 index 00000000..537e7668 --- /dev/null +++ b/source/contract/contract-compiler/pom.xml @@ -0,0 +1,47 @@ + + 4.0.0 + + com.jd.blockchain + contract + 0.9.0-SNAPSHOT + + contract-compiler + + + + com.jd.blockchain + contract-model + ${project.version} + + + com.sun + tools + 1.8.0 + system + ${java.home}/../lib/tools.jar + + + com.github.javaparser + javaparser-core + + + junit + junit + + + + commons-io + commons-io + ${commons-io.version} + + + + com.esotericsoftware + reflectasm + 1.10.1 + + + + \ No newline at end of file diff --git a/source/contract/contract-engine/pom.xml b/source/contract/contract-engine/pom.xml new file mode 100644 index 00000000..5c4c858b --- /dev/null +++ b/source/contract/contract-engine/pom.xml @@ -0,0 +1,107 @@ + + 4.0.0 + + com.jd.blockchain + contract + 0.9.0-SNAPSHOT + + contract-engine + + + com.jd.blockchain + contract-model + ${project.version} + + + com.jd.blockchain + contract-compiler + ${project.version} + + + + junit + junit + test + + + org.mockito + mockito-core + test + + + com.jd.blockchain + contract-jar + ${project.version} + + + + com.sun + plugin + 1.8 + system + ${java.home}/lib/plugin.jar + + + + org.slf4j + slf4j-simple + test + + + + org.springframework.boot + spring-boot-starter-web + provided + + + org.springframework.boot + spring-boot-starter-logging + + + + + org.springframework.boot + spring-boot-starter-cache + + + + org.ehcache + ehcache + ${ehcache.version} + + + javax.cache + cache-api + ${cache-api.version} + + + + org.springframework.boot + spring-boot-starter-test + test + + + com.jd.blockchain + contract-tools + ${project.version} + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.5 + + true + + + + + + \ No newline at end of file diff --git a/source/contract/contract-framework/pom.xml b/source/contract/contract-framework/pom.xml index be2b88ab..9f449374 100644 --- a/source/contract/contract-framework/pom.xml +++ b/source/contract/contract-framework/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain contract - 0.8.2.RELEASE + 0.9.0-SNAPSHOT contract-framework diff --git a/source/contract/contract-jar/pom.xml b/source/contract/contract-jar/pom.xml new file mode 100644 index 00000000..81722dcb --- /dev/null +++ b/source/contract/contract-jar/pom.xml @@ -0,0 +1,41 @@ + + + + contract + com.jd.blockchain + 0.9.0-SNAPSHOT + + 4.0.0 + + contract-jar + + + + com.jd.blockchain + contract-compiler + ${project.version} + + + commons-io + commons-io + ${commons-io.version} + + + junit + junit + test + + + org.mockito + mockito-core + test + + + org.slf4j + slf4j-log4j12 + + + + \ No newline at end of file diff --git a/source/contract/contract-jvm/pom.xml b/source/contract/contract-jvm/pom.xml index 7c36748a..64d5e692 100644 --- a/source/contract/contract-jvm/pom.xml +++ b/source/contract/contract-jvm/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain contract - 0.8.2.RELEASE + 0.9.0-SNAPSHOT contract-jvm diff --git a/source/contract/contract-maven-plugin/pom.xml b/source/contract/contract-maven-plugin/pom.xml index 49a7f3f8..c8c11adb 100644 --- a/source/contract/contract-maven-plugin/pom.xml +++ b/source/contract/contract-maven-plugin/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain contract - 0.8.2.RELEASE + 0.9.0-SNAPSHOT contract-maven-plugin maven-plugin @@ -15,7 +15,7 @@ 4.12 - 0.8.2.RELEASE + 0.9.0-SNAPSHOT junit diff --git a/source/contract/contract-model/pom.xml b/source/contract/contract-model/pom.xml index 880c446e..6a5da9c5 100644 --- a/source/contract/contract-model/pom.xml +++ b/source/contract/contract-model/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain contract - 0.8.2.RELEASE + 0.9.0-SNAPSHOT contract-model diff --git a/source/contract/contract-tools/pom.xml b/source/contract/contract-tools/pom.xml new file mode 100644 index 00000000..da60f463 --- /dev/null +++ b/source/contract/contract-tools/pom.xml @@ -0,0 +1,80 @@ + + 4.0.0 + + com.jd.blockchain + contract + 0.9.0-SNAPSHOT + + contract-tools + + + + com.jd.blockchain + contract-compiler + ${project.version} + + + com.jd.blockchain + contract-jar + ${project.version} + + + commons-io + commons-io + ${commons-io.version} + + + junit + junit + test + + + org.mockito + mockito-core + test + + + org.slf4j + slf4j-log4j12 + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.5 + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/contract/pom.xml b/source/contract/pom.xml index ba9ac007..8093c879 100644 --- a/source/contract/pom.xml +++ b/source/contract/pom.xml @@ -4,7 +4,7 @@ com.jd.blockchain jdchain-root - 0.8.2.RELEASE + 0.9.0-SNAPSHOT contract pom diff --git a/source/crypto/crypto-adv/pom.xml b/source/crypto/crypto-adv/pom.xml index ac213acd..d64e7964 100644 --- a/source/crypto/crypto-adv/pom.xml +++ b/source/crypto/crypto-adv/pom.xml @@ -3,7 +3,7 @@ com.jd.blockchain crypto - 0.8.2.RELEASE + 0.9.0-SNAPSHOT crypto-adv diff --git a/source/crypto/crypto-adv/src/main/java/com/jd/blockchain/crypto/elgamal/ElGamalUtils.java b/source/crypto/crypto-adv/src/main/java/com/jd/blockchain/crypto/elgamal/ElGamalUtils.java new file mode 100644 index 00000000..d5d31efa --- /dev/null +++ b/source/crypto/crypto-adv/src/main/java/com/jd/blockchain/crypto/elgamal/ElGamalUtils.java @@ -0,0 +1,118 @@ +package com.jd.blockchain.crypto.elgamal; + +import org.bouncycastle.crypto.AsymmetricCipherKeyPair; +import org.bouncycastle.crypto.engines.ElGamalEngine; +import org.bouncycastle.crypto.generators.ElGamalKeyPairGenerator; +import org.bouncycastle.crypto.params.*; + +import java.math.BigInteger; +import java.security.SecureRandom; + +public class ElGamalUtils { + + private static final BigInteger g512 = new BigInteger("153d5d6172adb43045b68ae8e1de1070b6137005686d29d3d73a7749199681ee5b212c9b96bfdcfa5b20cd5e3fd2044895d609cf9b410b7a0f12ca1cb9a428cc", 16); + private static final BigInteger p512 = new BigInteger("9494fec095f3b85ee286542b3836fc81a5dd0a0349b4c239dd38744d488cf8e31db8bcb7d33b41abb9e5a33cca9144b1cef332c94bf0573bf047a3aca98cdf3b", 16); + + private static final ElGamalParameters dhParams = new ElGamalParameters(p512, g512, 0); + + + + //-----------------Key Pair Generation Algorithm----------------- + + /** + * key generation + * + * @return key pair + */ + public static AsymmetricCipherKeyPair generateKeyPair(){ + + SecureRandom random = new SecureRandom(); + return generateKeyPair(random); + } + + public static AsymmetricCipherKeyPair generateKeyPair(SecureRandom random){ + + ElGamalKeyGenerationParameters params = new ElGamalKeyGenerationParameters(random, dhParams); + ElGamalKeyPairGenerator kpGen = new ElGamalKeyPairGenerator(); + + // To generate the key pair + kpGen.init(params); + return kpGen.generateKeyPair(); + } + + public static byte[] retrievePublicKey(byte[] privateKey) + { + BigInteger g = dhParams.getG(); + BigInteger p = dhParams.getP(); + + + BigInteger pubKey = g.modPow(new BigInteger(1,privateKey), p); + byte[] pubKey2Bytes = pubKey.toByteArray(); + + int pubKeySize = (p.bitLength() + 7)/8; + byte[] result = new byte[pubKeySize]; + + if (pubKey2Bytes.length > result.length) + { + System.arraycopy(pubKey2Bytes, 1, result, result.length - (pubKey2Bytes.length - 1), pubKey2Bytes.length - 1); + } + else + { + System.arraycopy(pubKey2Bytes, 0, result, result.length - pubKey2Bytes.length, pubKey2Bytes.length); + } + + return result; + } + + //-----------------Public Key Encryption Algorithm----------------- + + /** + * encryption + * + * @param plainBytes plaintext + * @param publicKey public key + * @return ciphertext + */ + public static byte[] encrypt(byte[] plainBytes, byte[] publicKey){ + + SecureRandom random = new SecureRandom(); + return encrypt(plainBytes,publicKey,random); + } + + public static byte[] encrypt(byte[] plainBytes, byte[] publicKey, SecureRandom random){ + + BigInteger pubKey = new BigInteger(1,publicKey); + + ElGamalPublicKeyParameters pubKeyParams = new ElGamalPublicKeyParameters(pubKey,dhParams); + return encrypt(plainBytes, pubKeyParams, random); + } + + public static byte[] encrypt(byte[] plainBytes, ElGamalPublicKeyParameters pubKeyParams){ + + SecureRandom random = new SecureRandom(); + return encrypt(plainBytes, pubKeyParams, random); + } + + public static byte[] encrypt(byte[] plainBytes, ElGamalPublicKeyParameters pubKeyParams, SecureRandom random){ + + ParametersWithRandom params = new ParametersWithRandom(pubKeyParams, random); + + ElGamalEngine encryptor = new ElGamalEngine(); + encryptor.init(true, params); + return encryptor.processBlock(plainBytes,0,plainBytes.length); + } + + + public static byte[] decrypt(byte[] cipherBytes, byte[] privateKey){ + BigInteger privKey = new BigInteger(1,privateKey); + + ElGamalPrivateKeyParameters privKeyParams = new ElGamalPrivateKeyParameters(privKey,dhParams); + + ElGamalEngine decryptor = new ElGamalEngine(); + decryptor.init(false,privKeyParams); + return decryptor.processBlock(cipherBytes,0,cipherBytes.length); + } + + public static ElGamalParameters getElGamalParameters(){return dhParams;} + +} diff --git a/source/crypto/crypto-adv/src/main/java/com/jd/blockchain/crypto/mpc/EqualVerify.java b/source/crypto/crypto-adv/src/main/java/com/jd/blockchain/crypto/mpc/EqualVerify.java new file mode 100644 index 00000000..7d3dfc61 --- /dev/null +++ b/source/crypto/crypto-adv/src/main/java/com/jd/blockchain/crypto/mpc/EqualVerify.java @@ -0,0 +1,107 @@ +package com.jd.blockchain.crypto.mpc; + +import com.jd.blockchain.crypto.elgamal.ElGamalUtils; +import com.jd.blockchain.utils.io.BytesUtils; +import org.bouncycastle.crypto.AsymmetricCipherKeyPair; +import org.bouncycastle.crypto.params.ElGamalPrivateKeyParameters; +import org.bouncycastle.crypto.params.ElGamalPublicKeyParameters; + +import java.math.BigInteger; +import java.util.Arrays; + +public class EqualVerify { + + private static final int ELEMENTLENGTH = 64; + + private static BigInteger p; + + private static byte[] sponsorEPubKeyBytes; + private static byte[] sponsorEPrivKeyBytes; + + private static byte[] responderEPubKeyBytes; + private static byte[] responderEPrivKeyBytes; + + public static void generateParams(){ + p = ElGamalUtils.getElGamalParameters().getP(); + } + + public static void generateSponsorKeyPair(){ + + AsymmetricCipherKeyPair keyPair = ElGamalUtils.generateKeyPair(); + ElGamalPublicKeyParameters pubKeyParams = (ElGamalPublicKeyParameters) keyPair.getPublic(); + ElGamalPrivateKeyParameters privKeyParams = (ElGamalPrivateKeyParameters) keyPair.getPrivate(); + + sponsorEPubKeyBytes = bigIntegerTo64Bytes(pubKeyParams.getY()); + sponsorEPrivKeyBytes = bigIntegerTo64Bytes(privKeyParams.getX()); + } + + public static void generateResponderKeyPair(){ + + AsymmetricCipherKeyPair keyPair = ElGamalUtils.generateKeyPair(); + ElGamalPublicKeyParameters pubKeyParams = (ElGamalPublicKeyParameters) keyPair.getPublic(); + ElGamalPrivateKeyParameters privKeyParams = (ElGamalPrivateKeyParameters) keyPair.getPrivate(); + + responderEPubKeyBytes = bigIntegerTo64Bytes(pubKeyParams.getY()); + responderEPrivKeyBytes = bigIntegerTo64Bytes(privKeyParams.getX()); + } + + public static byte[] sponsor(int sponsorInput, byte[] sponsorEPubKeyBytes){ + + BigInteger sponsorBigInt = BigInteger.valueOf(sponsorInput); + BigInteger sponsorEPubKey = new BigInteger(1, sponsorEPubKeyBytes); + BigInteger result = sponsorBigInt.multiply(sponsorEPubKey).mod(p); + return bigIntegerTo64Bytes(result); + } + + public static byte[] responder(int responderInput, byte[] sponsorOutput, byte[] responderEPubKeyBytes, + byte[] responderEPrivKeyBytes) { + + if (sponsorOutput.length != ELEMENTLENGTH) + throw new IllegalArgumentException("The sponsorOutput' length is not 64!"); + + BigInteger responderBigInt = BigInteger.valueOf(responderInput); + BigInteger responderEPubKey = new BigInteger(1,responderEPubKeyBytes); + BigInteger responderCipher = responderBigInt.multiply(responderEPubKey).mod(p); + + BigInteger responderInputInverse = BigInteger.valueOf(responderInput).modInverse(p); + BigInteger tmp = new BigInteger(1, sponsorOutput).multiply(responderInputInverse).mod(p); + BigInteger dhValue = tmp.modPow(new BigInteger(1,responderEPrivKeyBytes), p); + + return BytesUtils.concat(bigIntegerTo64Bytes(responderCipher), bigIntegerTo64Bytes(dhValue)); + } + + public static boolean sponsorCheck(int sponsorInput, byte[] responderOutput, byte[] sponsorEPrivKeyBytes){ + + if (responderOutput.length != 2 * ELEMENTLENGTH) + throw new IllegalArgumentException("The responderOutput's length is not 128!"); + + byte[] responderCipherBytes = new byte[ELEMENTLENGTH]; + byte[] dhValueBytes = new byte[ELEMENTLENGTH]; + System.arraycopy(responderOutput, 0, responderCipherBytes, 0, responderCipherBytes.length); + System.arraycopy(responderOutput, responderCipherBytes.length, dhValueBytes, 0,dhValueBytes.length); + + BigInteger sponsorInputInverse = BigInteger.valueOf(sponsorInput).modInverse(p); + BigInteger tmp = new BigInteger(1, responderCipherBytes).multiply(sponsorInputInverse); + BigInteger dhVerifier = tmp.modPow(new BigInteger(1,sponsorEPrivKeyBytes), p); + + return Arrays.equals(dhValueBytes, bigIntegerTo64Bytes(dhVerifier)); + } + + public static byte[] getSponsorEPubKeyBytes(){return sponsorEPubKeyBytes;} + + public static byte[] getSponsorEPrivKeyBytes(){return sponsorEPrivKeyBytes;} + + public static byte[] getResponderEPubKeyBytes(){return responderEPubKeyBytes;} + + public static byte[] getResponderEPrivKeyBytes(){return responderEPrivKeyBytes;} + + // To convert BigInteger to byte[] whose length is 64 + private static byte[] bigIntegerTo64Bytes(BigInteger b){ + byte[] tmp = b.toByteArray(); + byte[] result = new byte[64]; + if (tmp.length > result.length) + System.arraycopy(tmp, tmp.length-result.length, result, 0, result.length); + else System.arraycopy(tmp,0,result,result.length-tmp.length,tmp.length); + return result; + } +} diff --git a/source/crypto/crypto-adv/src/main/java/com/jd/blockchain/crypto/mpc/IntCompare.java b/source/crypto/crypto-adv/src/main/java/com/jd/blockchain/crypto/mpc/IntCompare.java new file mode 100644 index 00000000..68afd2e5 --- /dev/null +++ b/source/crypto/crypto-adv/src/main/java/com/jd/blockchain/crypto/mpc/IntCompare.java @@ -0,0 +1,270 @@ +package com.jd.blockchain.crypto.mpc; + +import com.jd.blockchain.crypto.elgamal.ElGamalUtils; +import com.jd.blockchain.utils.io.BytesUtils; +import org.bouncycastle.crypto.AsymmetricCipherKeyPair; +import org.bouncycastle.crypto.params.ElGamalParameters; +import org.bouncycastle.crypto.params.ElGamalPrivateKeyParameters; +import org.bouncycastle.crypto.params.ElGamalPublicKeyParameters; + +import java.math.BigInteger; +import java.security.SecureRandom; +import java.util.Random; + +public class IntCompare { + + private static final int INTLENGTH = 32; + private static final int ELEMENTLENGTH = 64; + private static final int CIPHERLENGTH = 128; + + private static BigInteger p; + + private static byte[] pubKeyBytes; + private static byte[] privKeyBytes; + + public static void generateKeyPair(){ + + ElGamalParameters dhParams = ElGamalUtils.getElGamalParameters(); + + p = dhParams.getP(); + + AsymmetricCipherKeyPair keyPair = ElGamalUtils.generateKeyPair(); + ElGamalPublicKeyParameters pubKeyParams = (ElGamalPublicKeyParameters) keyPair.getPublic(); + ElGamalPrivateKeyParameters privKeyParams = (ElGamalPrivateKeyParameters) keyPair.getPrivate(); + + pubKeyBytes = bigIntegerTo64Bytes(pubKeyParams.getY()); + privKeyBytes = bigIntegerTo64Bytes(privKeyParams.getX()); + } + + public static byte[][] sponsor(int sponsorInput, byte[] pubKeyBytes){ + + String sponsorBinaryStr = to32BinaryString(sponsorInput); + + + byte[][] cipherArray = new byte[INTLENGTH * 2][CIPHERLENGTH]; + + byte[] unitMsg = bigIntegerTo64Bytes(BigInteger.ONE); + byte[] randMsg = new byte[ELEMENTLENGTH - 1]; + + int i; + for (i = 0; i < INTLENGTH; i++){ + + SecureRandom random = new SecureRandom(); + random.nextBytes(randMsg); + + if (sponsorBinaryStr.charAt(i) == '1'){ + cipherArray[i] = ElGamalUtils.encrypt(unitMsg, pubKeyBytes); + cipherArray[i + INTLENGTH] = ElGamalUtils.encrypt(randMsg, pubKeyBytes); + } + else { + cipherArray[i] = ElGamalUtils.encrypt(randMsg, pubKeyBytes); + cipherArray[i + INTLENGTH] = ElGamalUtils.encrypt(unitMsg, pubKeyBytes); + } + } + + return cipherArray; + } + + public static byte[][] responder(int responderInt, byte[][] cipherArray, byte[] pubKeyBytes){ + + if (cipherArray.length != 2 * INTLENGTH) + throw new IllegalArgumentException("The cipherArray has wrong format!"); + + int i,j; + for (i = 0; i < cipherArray.length; i++){ + if(cipherArray[i].length != CIPHERLENGTH) + throw new IllegalArgumentException("The cipherArray has wrong format!"); + } + + String[] responderStrSet = encoding(responderInt, false); + + BigInteger tmpLeftBigInteger; + BigInteger tmpRightBigInteger; + BigInteger leftBigInteger; + BigInteger rightBigInteger; + byte[] tmpCipherArray = new byte[CIPHERLENGTH]; + + byte[] randMsg = new byte[ELEMENTLENGTH -1 ]; + + byte[][] aggregatedCipherArray = new byte[INTLENGTH][CIPHERLENGTH]; + + for (i = 0; i < aggregatedCipherArray.length; i++){ + + if (responderStrSet[i] != null){ + + tmpLeftBigInteger = BigInteger.ONE; + tmpRightBigInteger = BigInteger.ONE; + + for (j = 0; j < responderStrSet[i].length(); j++){ + if (responderStrSet[i].charAt(j) == '1'){ + System.arraycopy(cipherArray[j], 0, tmpCipherArray, 0, tmpCipherArray.length); + } + else{ + System.arraycopy(cipherArray[j + INTLENGTH], 0,tmpCipherArray, 0, tmpCipherArray.length); + } + + leftBigInteger = getLeftBigIntegerFrom128Bytes(tmpCipherArray); + tmpLeftBigInteger = tmpLeftBigInteger.multiply(leftBigInteger).mod(p); + rightBigInteger = getRightBigIntegerFrom128Bytes(tmpCipherArray); + tmpRightBigInteger = tmpRightBigInteger.multiply(rightBigInteger).mod(p); + } + + aggregatedCipherArray[i] = BytesUtils.concat(bigIntegerTo64Bytes(tmpLeftBigInteger),bigIntegerTo64Bytes(tmpRightBigInteger)); + } + else { + SecureRandom random = new SecureRandom(); + random.nextBytes(randMsg); + aggregatedCipherArray[i] = ElGamalUtils.encrypt(randMsg, pubKeyBytes); + } + } + + int[] permutation = randPermute(INTLENGTH); + + for (i = 0; i < INTLENGTH; i++){ + System.arraycopy(aggregatedCipherArray[i], 0, tmpCipherArray, 0, CIPHERLENGTH); + System.arraycopy(aggregatedCipherArray[permutation[i]-1], 0, aggregatedCipherArray[i], 0, CIPHERLENGTH); + System.arraycopy(tmpCipherArray, 0, aggregatedCipherArray[permutation[i]-1], 0, CIPHERLENGTH); + } + + return aggregatedCipherArray; + } + + public static int sponsorOutput(byte[][] aggregatedCipherArray, byte[] privKeyBytes){ + + if (aggregatedCipherArray.length != INTLENGTH) + throw new IllegalArgumentException("The aggregatedCipherArray has wrong format!"); + + int i; + byte[] plaintext; + + for (i = 0; i < aggregatedCipherArray.length; i++){ + + if(aggregatedCipherArray[i].length != CIPHERLENGTH) + throw new IllegalArgumentException("The aggregatedCipherArray has wrong format!"); + + plaintext = ElGamalUtils.decrypt(aggregatedCipherArray[i], privKeyBytes); + + if ((plaintext.length ==1) && (BigInteger.ONE.equals(BigInteger.valueOf((int) plaintext[0])))){ + return 1; + } + } + + return 0; + } + + public static byte[] getPubKeyBytes(){return pubKeyBytes;} + + public static byte[] getPrivKeyBytes(){return privKeyBytes;} + + + + private static String[] encoding(int integer, boolean encodingOpts){ + String str = to32BinaryString(integer); + String[] strArray = new String[INTLENGTH]; + int i; + + // 1-encoding + if (encodingOpts){ + for (i = 0; i < INTLENGTH; i++){ + if (str.charAt(i) == '1'){ + strArray[i] = str.substring(0, i + 1); + } + } + } + // 0-encoding + else { + for (i = 0; i < INTLENGTH; i++) { + if (str.charAt(i) == '0') { + strArray[i] = str.substring(0, i) + "1"; + } + } + } + + return strArray; + } + + + private static String to32BinaryString(int integer) { + + if (integer < 0) + throw new IllegalArgumentException("integer must be non-negative!"); + + int i; + String str = Integer.toBinaryString(integer); + StringBuilder result = new StringBuilder(); + for (i = 0; i < INTLENGTH - str.length(); i++) { + result.append("0"); + } + return result.append(str).toString(); + } + + /** + * @param min the lower bound (inclusive). Must be non-negative. + * @param max the upper bound (inclusive). Must be positive. + * @return the next pseudorandom, uniformly distributed {@code int} + * value between min (inclusive) and max (inclusive) + * from this random number generator's sequence + * @throws IllegalArgumentException if min is not non-negative, + * max is not positive, or min is bigger than max + */ + private static int randInt(int min, int max) { + if (min < 0) + throw new IllegalArgumentException("min must be non-negative!"); + if (max <= 0) + throw new IllegalArgumentException("max must be positive!"); + if (min > max) + throw new IllegalArgumentException("min must not be greater than max"); + + Random random = new Random(); + return random.nextInt(max) % (max - min + 1) + min; + } + + private static int[] randPermute(int num) { + + int[] array = new int[num]; + int i; + int rand; + int tmp; + + for (i = 0; i < num; i++) { + array[i] = i + 1; + } + + for (i = 0; i < num; i++) { + rand = randInt(1, num); + tmp = array[i]; + array[i] = array[rand - 1]; + array[rand - 1] = tmp; + } + + return array; + } + + // To convert BigInteger to byte[] whose length is 64 + private static byte[] bigIntegerTo64Bytes(BigInteger b){ + byte[] tmp = b.toByteArray(); + byte[] result = new byte[64]; + if (tmp.length > result.length) + System.arraycopy(tmp, tmp.length-result.length, result, 0, result.length); + else System.arraycopy(tmp,0,result,result.length-tmp.length,tmp.length); + return result; + } + + private static BigInteger getLeftBigIntegerFrom128Bytes(byte[] byteArray){ + if (byteArray.length != 128) + throw new IllegalArgumentException("The byteArray's length must be 128!"); + byte[] tmp = new byte[64]; + System.arraycopy(byteArray, 0, tmp, 0, tmp.length); + return new BigInteger(1, tmp); + } + + private static BigInteger getRightBigIntegerFrom128Bytes(byte[] byteArray){ + if (byteArray.length != 128) + throw new IllegalArgumentException("The byteArray's length must be 128!"); + byte[] tmp = new byte[64]; + System.arraycopy(byteArray, 64, tmp, 0, tmp.length); + return new BigInteger(1, tmp); + } +} + + diff --git a/source/crypto/crypto-adv/src/test/java/test/com/jd/blockchain/crypto/elgamal/ElGamalUtilsTest.java b/source/crypto/crypto-adv/src/test/java/test/com/jd/blockchain/crypto/elgamal/ElGamalUtilsTest.java new file mode 100644 index 00000000..d5d8b1d1 --- /dev/null +++ b/source/crypto/crypto-adv/src/test/java/test/com/jd/blockchain/crypto/elgamal/ElGamalUtilsTest.java @@ -0,0 +1,73 @@ +package test.com.jd.blockchain.crypto.elgamal; + +import com.jd.blockchain.crypto.elgamal.ElGamalUtils; +import org.bouncycastle.crypto.AsymmetricCipherKeyPair; +import org.bouncycastle.crypto.params.ElGamalPrivateKeyParameters; +import org.bouncycastle.crypto.params.ElGamalPublicKeyParameters; +import org.bouncycastle.util.encoders.Hex; +import org.junit.Test; + +import java.math.BigInteger; + +import static org.junit.Assert.*; + +public class ElGamalUtilsTest { + + @Test + public void testGenerateKeyPair() { + + AsymmetricCipherKeyPair keyPair = ElGamalUtils.generateKeyPair(); + + ElGamalPublicKeyParameters pubKeyParams = (ElGamalPublicKeyParameters) keyPair.getPublic(); + ElGamalPrivateKeyParameters privKeyParams = (ElGamalPrivateKeyParameters) keyPair.getPrivate(); + + byte[] privKeyBytes = bigIntegerTo64Bytes(privKeyParams.getX()); + byte[] pubKeyBytes = bigIntegerTo64Bytes(pubKeyParams.getY()); + + byte[] retrievedPubKeyBytes = ElGamalUtils.retrievePublicKey(privKeyBytes); + + assertEquals(64,privKeyBytes.length); + assertEquals(64,pubKeyBytes.length); + + assertArrayEquals(retrievedPubKeyBytes,pubKeyBytes); + } + + // To convert BigInteger to byte[] whose length is 64 + private byte[] bigIntegerTo64Bytes(BigInteger b){ + byte[] tmp = b.toByteArray(); + byte[] result = new byte[64]; + if (tmp.length > result.length) + System.arraycopy(tmp, tmp.length-result.length, result, 0, result.length); + else System.arraycopy(tmp,0,result,result.length-tmp.length,tmp.length); + return result; + } + + + @Test + public void testDecrypt() { + + AsymmetricCipherKeyPair keyPair = ElGamalUtils.generateKeyPair(); + + ElGamalPublicKeyParameters pubKeyParams = (ElGamalPublicKeyParameters) keyPair.getPublic(); + ElGamalPrivateKeyParameters privKeyParams = (ElGamalPrivateKeyParameters) keyPair.getPrivate(); + + byte[] privKeyBytes = bigIntegerTo64Bytes(privKeyParams.getX()); + byte[] pubKeyBytes = bigIntegerTo64Bytes(pubKeyParams.getY()); + + byte[] message = Hex.decode("5468697320697320612074657374"); + + byte[] ciphertext = ElGamalUtils.encrypt(message,pubKeyBytes); + byte[] plaintext = ElGamalUtils.decrypt(ciphertext,privKeyBytes); + + assertEquals(128,ciphertext.length); + assertArrayEquals(plaintext,message); + + BigInteger one = BigInteger.ONE; + + ciphertext = ElGamalUtils.encrypt(bigIntegerTo64Bytes(one),pubKeyBytes); + plaintext = ElGamalUtils.decrypt(ciphertext,privKeyBytes); + + assertEquals(one,BigInteger.valueOf((int) plaintext[0])); + assertTrue(BigInteger.ONE.equals(BigInteger.valueOf((int) plaintext[0]))); + } +} \ No newline at end of file diff --git a/source/crypto/crypto-adv/src/test/java/test/com/jd/blockchain/crypto/mpc/EqualVerifyTest.java b/source/crypto/crypto-adv/src/test/java/test/com/jd/blockchain/crypto/mpc/EqualVerifyTest.java new file mode 100644 index 00000000..372030a9 --- /dev/null +++ b/source/crypto/crypto-adv/src/test/java/test/com/jd/blockchain/crypto/mpc/EqualVerifyTest.java @@ -0,0 +1,73 @@ +package test.com.jd.blockchain.crypto.mpc; + +import com.jd.blockchain.crypto.mpc.EqualVerify; +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class EqualVerifyTest { + + private byte[] sponsorEPubKeyBytes; + private byte[] sponsorEPrivKeyBytes; + + private byte[] responderEPubKeyBytes; + private byte[] responderEPrivKeyBytes; + + @Before + public void init() { + + EqualVerify.generateParams(); + EqualVerify.generateSponsorKeyPair(); + EqualVerify.generateResponderKeyPair(); + + sponsorEPubKeyBytes = EqualVerify.getSponsorEPubKeyBytes(); + sponsorEPrivKeyBytes = EqualVerify.getSponsorEPrivKeyBytes(); + + responderEPubKeyBytes = EqualVerify.getResponderEPubKeyBytes(); + responderEPrivKeyBytes = EqualVerify.getResponderEPrivKeyBytes(); + } + + + @Test + public void testIntCompare() { + + int sponsorInput; + int responderInput; + + byte[] sponsorOutput; + byte[] responderOutput; + boolean isEqual; + + int i; + + for (i = 0; i < 1000; i++) { + + sponsorInput = 666; + responderInput = 666; + + sponsorOutput = EqualVerify.sponsor(sponsorInput,sponsorEPubKeyBytes); + responderOutput = EqualVerify.responder(responderInput,sponsorOutput, + responderEPubKeyBytes,responderEPrivKeyBytes); + + isEqual = EqualVerify.sponsorCheck(sponsorInput,responderOutput,sponsorEPrivKeyBytes); + + assertTrue(isEqual); + } + + for (i = 0; i < 1000; i++){ + + sponsorInput = 666; + responderInput = 667; + + sponsorOutput = EqualVerify.sponsor(sponsorInput,sponsorEPubKeyBytes); + responderOutput = EqualVerify.responder(responderInput,sponsorOutput, + responderEPubKeyBytes,responderEPrivKeyBytes); + + isEqual = EqualVerify.sponsorCheck(sponsorInput,responderOutput,sponsorEPrivKeyBytes); + + assertTrue(!isEqual); + } + } + +} \ No newline at end of file diff --git a/source/crypto/crypto-adv/src/test/java/test/com/jd/blockchain/crypto/mpc/IntCompareTest.java b/source/crypto/crypto-adv/src/test/java/test/com/jd/blockchain/crypto/mpc/IntCompareTest.java new file mode 100644 index 00000000..d02f668d --- /dev/null +++ b/source/crypto/crypto-adv/src/test/java/test/com/jd/blockchain/crypto/mpc/IntCompareTest.java @@ -0,0 +1,50 @@ +package test.com.jd.blockchain.crypto.mpc; + +import com.jd.blockchain.crypto.mpc.IntCompare; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class IntCompareTest { + + private byte[] pubKeyBytes; + private byte[] privKeyBytes; + + @Before + public void init() { + IntCompare.generateKeyPair(); + pubKeyBytes = IntCompare.getPubKeyBytes(); + privKeyBytes = IntCompare.getPrivKeyBytes(); + } + + @Test + public void testIntCompare() { + + byte[][] cipherArray; + byte[][] aggregatedCipherArray; + int output; + int i; + + for (i = 0; i < 1000; i++) { + int sponsorInput = 10000; + int responderInput = 9999; + + cipherArray = IntCompare.sponsor(sponsorInput, pubKeyBytes); + aggregatedCipherArray = IntCompare.responder(responderInput, cipherArray, pubKeyBytes); + output = IntCompare.sponsorOutput(aggregatedCipherArray, privKeyBytes); + assertEquals(1, output); + } + + for (i = 0; i < 1000; i++) { + int sponsorInput = 10000; + int responderInput = 19999; + + cipherArray = IntCompare.sponsor(sponsorInput, pubKeyBytes); + aggregatedCipherArray = IntCompare.responder(responderInput, cipherArray, pubKeyBytes); + output = IntCompare.sponsorOutput(aggregatedCipherArray, privKeyBytes); + assertEquals(0, output); + } + } +} \ No newline at end of file diff --git a/source/crypto/crypto-framework/pom.xml b/source/crypto/crypto-framework/pom.xml index 7816a2b9..44a38fc9 100644 --- a/source/crypto/crypto-framework/pom.xml +++ b/source/crypto/crypto-framework/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain crypto - 0.8.2.RELEASE + 0.9.0-SNAPSHOT crypto-framework diff --git a/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/asymmetric/AsymmetricCryptography.java b/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/asymmetric/AsymmetricCryptography.java index 475990f9..2ca708f1 100644 --- a/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/asymmetric/AsymmetricCryptography.java +++ b/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/asymmetric/AsymmetricCryptography.java @@ -61,6 +61,16 @@ public interface AsymmetricCryptography { SignatureDigest tryResolveSignatureDigest(byte[] digestBytes); + /** + * 由私钥恢复公钥; + * + * @param privKeyBytes 包含算法标识、密钥掩码和私钥的字节数组 + * @return 包含算法标识、密钥掩码和公钥的字节数组 + */ + byte[] retrievePubKeyBytes(byte[] privKeyBytes); + + byte[] tryRetrievePubKeyBytes(byte[] privKeyBytes); + PubKey resolvePubKey(byte[] pubKeyBytes); PubKey tryResolvePubKey(byte[] pubKeyBytes); diff --git a/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/asymmetric/AsymmetricEncryptionFunction.java b/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/asymmetric/AsymmetricEncryptionFunction.java index 8357d54e..93216fe3 100644 --- a/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/asymmetric/AsymmetricEncryptionFunction.java +++ b/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/asymmetric/AsymmetricEncryptionFunction.java @@ -23,6 +23,14 @@ public interface AsymmetricEncryptionFunction extends CryptoKeyPairGenerator, Cr */ byte[] decrypt(PrivKey privKey, Ciphertext ciphertext); + /** + * 使用字节数组形式的私钥生成字节数组形式的公钥; + * + * @param privKeyBytes 包含算法标识、密钥掩码和私钥的字节数组 + * @return 包含算法标识、密钥掩码和公钥的字节数组 + */ + byte[] retrievePubKeyBytes(byte[] privKeyBytes); + /** * 校验私钥格式是否满足要求; * diff --git a/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/asymmetric/SignatureFunction.java b/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/asymmetric/SignatureFunction.java index cdfdc9bd..2f534a15 100644 --- a/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/asymmetric/SignatureFunction.java +++ b/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/asymmetric/SignatureFunction.java @@ -22,6 +22,14 @@ public interface SignatureFunction extends CryptoKeyPairGenerator, CryptoFunctio */ boolean verify(SignatureDigest digest, PubKey pubKey, byte[] data); + /** + * 使用字节数组形式的私钥生成字节数组形式的公钥; + * + * @param privKeyBytes 包含算法标识、密钥掩码和私钥的字节数组 + * @return 包含算法标识、密钥掩码和公钥的字节数组 + */ + byte[] retrievePubKeyBytes(byte[] privKeyBytes); + /** * 校验私钥格式是否满足要求; * diff --git a/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/impl/AsymmtricCryptographyImpl.java b/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/impl/AsymmtricCryptographyImpl.java index 2d18626c..1b55da0f 100644 --- a/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/impl/AsymmtricCryptographyImpl.java +++ b/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/impl/AsymmtricCryptographyImpl.java @@ -135,6 +135,30 @@ public class AsymmtricCryptographyImpl implements AsymmetricCryptography { return null; } + @Override + public byte[] retrievePubKeyBytes(byte[] privKeyBytes) { + byte[] pubKeyBytes = tryRetrievePubKeyBytes(privKeyBytes); + if (pubKeyBytes == null) + throw new IllegalArgumentException("The specified algorithm in privKeyBytes is not signature or asymmetric encryption algorithm!"); + else return pubKeyBytes; + } + + @Override + public byte[] tryRetrievePubKeyBytes(byte[] privKeyBytes) { + //解析私钥获得算法标识 + CryptoAlgorithm algorithm = resolvePrivKey(privKeyBytes).getAlgorithm(); + + //判断算法是签名算法还是非对称加密算法,并根据算法生成密钥对,否则抛出异常 + if (algorithm.isSignable() && algorithm.isAsymmetric()){ + return getSignatureFunction(algorithm).retrievePubKeyBytes(privKeyBytes); + } + else if (algorithm.isEncryptable() && algorithm.isAsymmetric()){ + return getAsymmetricEncryptionFunction(algorithm).retrievePubKeyBytes(privKeyBytes); + } + //否则返回null + return null; + } + @Override public PubKey resolvePubKey(byte[] pubKeyBytes) { PubKey pubKey = tryResolvePubKey(pubKeyBytes); diff --git a/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/impl/def/asymmetric/ECDSASignatureFunction.java b/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/impl/def/asymmetric/ECDSASignatureFunction.java index 7cacb1fe..d17ecf3c 100644 --- a/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/impl/def/asymmetric/ECDSASignatureFunction.java +++ b/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/impl/def/asymmetric/ECDSASignatureFunction.java @@ -15,6 +15,11 @@ public class ECDSASignatureFunction implements SignatureFunction { return false; } + @Override + public byte[] retrievePubKeyBytes(byte[] privKeyBytes) { + return new byte[0]; + } + @Override public boolean supportPrivKey(byte[] privKeyBytes) { return false; diff --git a/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/impl/def/asymmetric/ED25519SignatureFunction.java b/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/impl/def/asymmetric/ED25519SignatureFunction.java index 0a28b3fc..519f3c88 100644 --- a/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/impl/def/asymmetric/ED25519SignatureFunction.java +++ b/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/impl/def/asymmetric/ED25519SignatureFunction.java @@ -7,6 +7,9 @@ import com.jd.blockchain.utils.security.Ed25519Utils; import net.i2p.crypto.eddsa.EdDSAPrivateKey; import net.i2p.crypto.eddsa.EdDSAPublicKey; import net.i2p.crypto.eddsa.KeyPairGenerator; +import net.i2p.crypto.eddsa.spec.EdDSANamedCurveTable; +import net.i2p.crypto.eddsa.spec.EdDSAParameterSpec; +import net.i2p.crypto.eddsa.spec.EdDSAPrivateKeySpec; import java.security.KeyPair; @@ -68,6 +71,16 @@ public class ED25519SignatureFunction implements SignatureFunction { return Ed25519Utils.verify(data, rawPubKeyBytes, rawDigestBytes); } + @Override + public byte[] retrievePubKeyBytes(byte[] privKeyBytes) { + + byte[] rawPrivKeyBytes = resolvePrivKey(privKeyBytes).getRawKeyBytes(); + EdDSAParameterSpec spec = EdDSANamedCurveTable.getByName(EdDSANamedCurveTable.CURVE_ED25519_SHA512); + EdDSAPrivateKeySpec privateKeySpec = new EdDSAPrivateKeySpec(rawPrivKeyBytes, spec); + byte[] rawPubKeyBytes = privateKeySpec.getA().toByteArray(); + return new PubKey(ED25519,rawPubKeyBytes).toBytes(); + } + @Override public boolean supportPrivKey(byte[] privKeyBytes) { // 验证输入字节数组长度=算法标识长度+密钥类型长度+密钥长度,密钥数据的算法标识对应ED25519签名算法,并且密钥类型是私钥 diff --git a/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/impl/jni/asymmetric/JNIED25519SignatureFunction.java b/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/impl/jni/asymmetric/JNIED25519SignatureFunction.java index 7aa6b80f..c03f8e93 100644 --- a/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/impl/jni/asymmetric/JNIED25519SignatureFunction.java +++ b/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/impl/jni/asymmetric/JNIED25519SignatureFunction.java @@ -3,6 +3,7 @@ package com.jd.blockchain.crypto.impl.jni.asymmetric; import com.jd.blockchain.crypto.CryptoAlgorithm; import com.jd.blockchain.crypto.asymmetric.*; import com.jd.blockchain.crypto.jniutils.asymmetric.JNIED25519Utils; +import com.jd.blockchain.utils.io.BytesUtils; import static com.jd.blockchain.crypto.CryptoAlgorithm.JNIED25519; import static com.jd.blockchain.crypto.CryptoBytes.ALGORYTHM_BYTES; @@ -70,6 +71,15 @@ public class JNIED25519SignatureFunction implements SignatureFunction { return ed25519.verify(data, rawPubKeyBytes, rawDigestBytes); } + @Override + public byte[] retrievePubKeyBytes(byte[] privKeyBytes) { + + JNIED25519Utils ed25519 = new JNIED25519Utils(); + byte[] rawPrivKeyBytes = resolvePrivKey(privKeyBytes).getRawKeyBytes(); + byte[] rawPubKeyBytes = ed25519.getPubKey(rawPrivKeyBytes); + return new PubKey(JNIED25519,rawPubKeyBytes).toBytes(); + } + @Override public boolean supportPrivKey(byte[] privKeyBytes) { // 验证输入字节数组长度=算法标识长度+密钥类型长度+密钥长度,密钥数据的算法标识对应JNIED25519签名算法,并且密钥类型是私钥 diff --git a/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/impl/sm/asymmetric/SM2CryptoFunction.java b/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/impl/sm/asymmetric/SM2CryptoFunction.java index 070bae5d..3e9097f5 100644 --- a/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/impl/sm/asymmetric/SM2CryptoFunction.java +++ b/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/impl/sm/asymmetric/SM2CryptoFunction.java @@ -7,7 +7,6 @@ import com.jd.blockchain.crypto.smutils.asymmetric.SM2Utils; import org.bouncycastle.crypto.AsymmetricCipherKeyPair; import org.bouncycastle.crypto.params.ECPrivateKeyParameters; import org.bouncycastle.crypto.params.ECPublicKeyParameters; -import org.bouncycastle.util.encoders.Hex; import static com.jd.blockchain.crypto.CryptoAlgorithm.SM2; import static com.jd.blockchain.crypto.CryptoBytes.ALGORYTHM_BYTES; @@ -65,6 +64,14 @@ public class SM2CryptoFunction implements AsymmetricEncryptionFunction, Signatur return SM2Utils.decrypt(rawCiphertextBytes,rawPrivKeyBytes); } + @Override + public byte[] retrievePubKeyBytes(byte[] privKeyBytes) { + + byte[] rawPrivKeyBytes = resolvePrivKey(privKeyBytes).getRawKeyBytes(); + byte[] rawPubKeyBytes = SM2Utils.retrievePublicKey(rawPrivKeyBytes); + return new PubKey(SM2,rawPubKeyBytes).toBytes(); + } + @Override public boolean supportPrivKey(byte[] privKeyBytes) { // 验证输入字节数组长度=算法标识长度+密钥类型长度+密钥长度,密钥数据的算法标识对应SM2算法,并且密钥类型是私钥 @@ -171,12 +178,13 @@ public class SM2CryptoFunction implements AsymmetricEncryptionFunction, Signatur System.arraycopy(privKeyBytesD,privKeyBytesD.length-PRIVKEY_SIZE,privKeyBytes,0,PRIVKEY_SIZE); else System.arraycopy(privKeyBytesD,0,privKeyBytes,PRIVKEY_SIZE-privKeyBytesD.length,privKeyBytesD.length); - byte[] pubKeyBytesX = ecPub.getQ().getAffineXCoord().getEncoded(); - byte[] pubKeyBytesY = ecPub.getQ().getAffineYCoord().getEncoded(); - byte[] pubKeyBytes = new byte[ECPOINT_SIZE]; - System.arraycopy(Hex.decode("04"),0,pubKeyBytes,0,1); - System.arraycopy(pubKeyBytesX,0,pubKeyBytes,1,32); - System.arraycopy(pubKeyBytesY,0,pubKeyBytes,1+32,32); +// byte[] pubKeyBytesX = ecPub.getQ().getAffineXCoord().getEncoded(); +// byte[] pubKeyBytesY = ecPub.getQ().getAffineYCoord().getEncoded(); +// byte[] pubKeyBytes = new byte[ECPOINT_SIZE]; +// System.arraycopy(Hex.decode("04"),0,pubKeyBytes,0,1); +// System.arraycopy(pubKeyBytesX,0,pubKeyBytes,1,32); +// System.arraycopy(pubKeyBytesY,0,pubKeyBytes,1+32,32); + byte[] pubKeyBytes = ecPub.getQ().getEncoded(false); return new CryptoKeyPair(new PubKey(SM2,pubKeyBytes),new PrivKey(SM2,privKeyBytes)); } diff --git a/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/smutils/asymmetric/SM2Utils.java b/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/smutils/asymmetric/SM2Utils.java index 8dfa598f..7be18edf 100644 --- a/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/smutils/asymmetric/SM2Utils.java +++ b/source/crypto/crypto-framework/src/main/java/com/jd/blockchain/crypto/smutils/asymmetric/SM2Utils.java @@ -13,7 +13,9 @@ import org.bouncycastle.crypto.generators.ECKeyPairGenerator; import org.bouncycastle.crypto.params.*; import org.bouncycastle.crypto.signers.SM2Signer; import org.bouncycastle.math.ec.ECCurve; +import org.bouncycastle.math.ec.ECMultiplier; import org.bouncycastle.math.ec.ECPoint; +import org.bouncycastle.math.ec.FixedPointCombMultiplier; import java.io.IOException; import java.math.BigInteger; @@ -66,6 +68,13 @@ public class SM2Utils { return keyPairGenerator.generateKeyPair(); } + public static byte[] retrievePublicKey(byte[] privateKey) + { + ECMultiplier createBasePointMultiplier = new FixedPointCombMultiplier(); + ECPoint publicKeyPoint = createBasePointMultiplier.multiply(domainParams.getG(), new BigInteger(1,privateKey)).normalize(); + return publicKeyPoint.getEncoded(false); + } + //-----------------Digital Signature Algorithm----------------- @@ -265,14 +274,9 @@ public class SM2Utils { // To retrieve the public key point from publicKey in byte array mode private static ECPoint resolvePubKeyBytes(byte[] publicKey){ - - byte[] pubKeyX = new byte[COORDS_SIZE]; - byte[] pubKeyY = new byte[COORDS_SIZE]; - System.arraycopy(publicKey,1,pubKeyX,0,COORDS_SIZE); - System.arraycopy(publicKey,1+COORDS_SIZE,pubKeyY,0,COORDS_SIZE); - - return curve.createPoint(new BigInteger(1,pubKeyX), new BigInteger(1,pubKeyY)); + return curve.decodePoint(publicKey); } + public static ECCurve getCurve(){return curve;} public static ECDomainParameters getDomainParams(){return domainParams;} } diff --git a/source/crypto/crypto-framework/src/test/java/test/com/jd/blockchain/crypto/asymmetric/AsymmtricCryptographyImplTest.java b/source/crypto/crypto-framework/src/test/java/test/com/jd/blockchain/crypto/asymmetric/AsymmtricCryptographyImplTest.java index 2970635b..eee63899 100644 --- a/source/crypto/crypto-framework/src/test/java/test/com/jd/blockchain/crypto/asymmetric/AsymmtricCryptographyImplTest.java +++ b/source/crypto/crypto-framework/src/test/java/test/com/jd/blockchain/crypto/asymmetric/AsymmtricCryptographyImplTest.java @@ -678,6 +678,52 @@ public class AsymmtricCryptographyImplTest { public void testTryResolveSignatureDigest() { } + @Test + public void testRetrievePubKeyBytes() { + + AsymmetricCryptography asymmetricCrypto = new AsymmtricCryptographyImpl(); + + //test ED25519 + CryptoAlgorithm algorithm = CryptoAlgorithm.ED25519; + + CryptoKeyPair keyPair = asymmetricCrypto.generateKeyPair(algorithm); + + byte[] expectedPrivKeyBytes = keyPair.getPrivKey().toBytes(); + byte[] expectedPubKeyBytes = keyPair.getPubKey().toBytes(); + + byte[] pubKeyBytes = asymmetricCrypto.retrievePubKeyBytes(expectedPrivKeyBytes); + + assertArrayEquals(expectedPubKeyBytes,pubKeyBytes); + + + //test SM2 + algorithm = CryptoAlgorithm.SM2; + + keyPair = asymmetricCrypto.generateKeyPair(algorithm); + + expectedPrivKeyBytes = keyPair.getPrivKey().toBytes(); + expectedPubKeyBytes = keyPair.getPubKey().toBytes(); + + pubKeyBytes = asymmetricCrypto.retrievePubKeyBytes(expectedPrivKeyBytes); + + assertArrayEquals(expectedPubKeyBytes,pubKeyBytes); + + + //test JNIED25519 + algorithm = CryptoAlgorithm.JNIED25519; + + keyPair = asymmetricCrypto.generateKeyPair(algorithm); + + expectedPrivKeyBytes = keyPair.getPrivKey().toBytes(); + expectedPubKeyBytes = keyPair.getPubKey().toBytes(); + + pubKeyBytes = asymmetricCrypto.retrievePubKeyBytes(expectedPrivKeyBytes); + + assertArrayEquals(expectedPubKeyBytes,pubKeyBytes); + + } + + @Test public void testResolvePubKey() { diff --git a/source/crypto/crypto-framework/src/test/java/test/com/jd/blockchain/crypto/smutils/SM2UtilsTest.java b/source/crypto/crypto-framework/src/test/java/test/com/jd/blockchain/crypto/smutils/SM2UtilsTest.java index 40111b3e..b10f294b 100644 --- a/source/crypto/crypto-framework/src/test/java/test/com/jd/blockchain/crypto/smutils/SM2UtilsTest.java +++ b/source/crypto/crypto-framework/src/test/java/test/com/jd/blockchain/crypto/smutils/SM2UtilsTest.java @@ -34,6 +34,18 @@ public class SM2UtilsTest { assertArrayEquals(Hex.decode(expectedPublicKey),pubKeyBytes); } + @Test + public void testPubKeyRetrieve() { + + String expectedPrivateKey = "3945208f7b2144b13f36e38ac6d39f95889393692860b51a42fb81ef4df7c5b8"; + String expectedPublicKey = "04"+"09f9df311e5421a150dd7d161e4bc5c672179fad1833fc076bb08ff356f35020"+"ccea490ce26775a52dc6ea718cc1aa600aed05fbf35e084a6632f6072da9ad13"; + + byte[] privateKey = Hex.decode(expectedPrivateKey); + byte[] publicKey = SM2Utils.retrievePublicKey(privateKey); + + assertEquals(expectedPublicKey,Hex.toHexString(publicKey)); + } + @Test public void testSign() { diff --git a/source/crypto/pom.xml b/source/crypto/pom.xml index 15e92fd9..807125a1 100644 --- a/source/crypto/pom.xml +++ b/source/crypto/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain jdchain-root - 0.8.2.RELEASE + 0.9.0-SNAPSHOT crypto pom diff --git a/source/deployment/deployment-gateway/pom.xml b/source/deployment/deployment-gateway/pom.xml index 7dda468f..d54811e9 100644 --- a/source/deployment/deployment-gateway/pom.xml +++ b/source/deployment/deployment-gateway/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain deployment - 0.8.2.RELEASE + 0.9.0-SNAPSHOT deployment-gateway diff --git a/source/deployment/deployment-gateway/src/main/resources/docs/api_doc_cn_1.3.MD b/source/deployment/deployment-gateway/src/main/resources/docs/api_doc_cn_1.3.MD index f9e315e0..6ef57c60 100644 --- a/source/deployment/deployment-gateway/src/main/resources/docs/api_doc_cn_1.3.MD +++ b/source/deployment/deployment-gateway/src/main/resources/docs/api_doc_cn_1.3.MD @@ -1440,85 +1440,7 @@ http://localhost/ledgers/657TQAw6ssVoeKniWGwbovk7njvCTvikPambM9eBv6ezs/accounts/ |type|value类型| |value|值| -### 6.8 查询某数据账户键数量 -```http - GET /ledgers/{ledger}/accounts/address/{address}/keys/count/search?keyword={keyword} -``` - -#### 参数 - -|请求类型|名称|是否必需|说明|数据类型| -|---|---|---|---|---| -|**path**|**ledger**|是|所要搜索的账本,需要完整的账本哈希|string| -|**path**|**address**|是|所要搜索的数据账户地址,需要完整的数据账户地址|string| -|**query**|**keyword**|否|键的部分字符,空表示全部|string| - - -#### 请求实例 -```http -http://localhost/ledgers/657TQAw6ssVoeKniWGwbovk7njvCTvikPambM9eBv6ezs/accounts/address/5Sm4gWXrNpDWW9Boi4xZCzZMHboRvEDm29Fa/keys/count/search?keyword=j -``` - - -#### 返回实例 - -```json -{ - "data": 66, - "success": true -} -``` - -说明 - -|名称|说明| -|---|---| -|data|条件查询键总数| - -### 6.9 查询某数据账户键 - -```http - GET /ledgers/{ledger}/accounts/address/{address}/keys/search?keyword={keyword}&fromIndex={start_index}&count={count} -``` - -#### 参数 - -|请求类型|名称|是否必需|说明|数据类型| -|---|---|---|---|---| -|**path**|**ledger**|是|所要搜索的账本,需要完整的账本哈希|string| -|**path**|**address**|是|所要搜索的数据账户地址,需要完整的数据账户地址|string| -|**query**|**keyword**|否|键的部分字符,空表示全部|string| -|**query**|**start_index**|否|查询数据账户对应Key的起始序号,默认为0|数字| -|**query**|**count**|否|查询返回数据账户对应Key的数量,默认最大返回值为100,小于0或大于100均返回最大可返回结果集|数字| - - -#### 请求实例 -```http -http://localhost/ledgers/657TQAw6ssVoeKniWGwbovk7njvCTvikPambM9eBv6ezs/accounts/address/5Sm4gWXrNpDWW9Boi4xZCzZMHboRvEDm29Fa/keys/search?keyword=j&fromIndex=0&count=-1 -``` - - -#### 返回实例 - -```json -{ - "data": [ - { - "key": "jd" - }, - { - "key": "jdchain" - }], - "success": true -} -``` - -说明 - -|名称|说明| -|---|---| -|key|键| ## 7 搜索 diff --git a/source/deployment/deployment-peer/pom.xml b/source/deployment/deployment-peer/pom.xml index fb4f6a79..9751b803 100644 --- a/source/deployment/deployment-peer/pom.xml +++ b/source/deployment/deployment-peer/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain deployment - 0.8.2.RELEASE + 0.9.0-SNAPSHOT deployment-peer diff --git a/source/deployment/pom.xml b/source/deployment/pom.xml index 4270f809..1ac7bcfb 100644 --- a/source/deployment/pom.xml +++ b/source/deployment/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain jdchain-root - 0.8.2.RELEASE + 0.9.0-SNAPSHOT deployment pom diff --git a/source/gateway/pom.xml b/source/gateway/pom.xml index 42e07bbc..fa43d8b8 100644 --- a/source/gateway/pom.xml +++ b/source/gateway/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain jdchain-root - 0.8.2.RELEASE + 0.9.0-SNAPSHOT gateway diff --git a/source/ledger/ledger-core/pom.xml b/source/ledger/ledger-core/pom.xml index bd23883e..f25f8678 100644 --- a/source/ledger/ledger-core/pom.xml +++ b/source/ledger/ledger-core/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain ledger - 0.8.2.RELEASE + 0.9.0-SNAPSHOT ledger-core diff --git a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/MerkleDataSet.java b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/MerkleDataSet.java index 65f3b458..4b5e1ee0 100644 --- a/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/MerkleDataSet.java +++ b/source/ledger/ledger-core/src/main/java/com/jd/blockchain/ledger/core/MerkleDataSet.java @@ -167,7 +167,7 @@ public class MerkleDataSet implements Transactional, MerkleProvable { */ public String getKeyAtIndex(int fromIndex) { MerkleDataNode dataNode = merkleTree.getData(fromIndex); - return new String(dataNode.getKey().toBytes()); + return new String(dataNode.getKey().toBytes()); } diff --git a/source/ledger/ledger-model/pom.xml b/source/ledger/ledger-model/pom.xml index 7a1522e1..d70eb20c 100644 --- a/source/ledger/ledger-model/pom.xml +++ b/source/ledger/ledger-model/pom.xml @@ -6,7 +6,7 @@ com.jd.blockchain ledger - 0.8.2.RELEASE + 0.9.0-SNAPSHOT ledger-model diff --git a/source/ledger/ledger-rpc/pom.xml b/source/ledger/ledger-rpc/pom.xml index aded5314..d46aafd3 100644 --- a/source/ledger/ledger-rpc/pom.xml +++ b/source/ledger/ledger-rpc/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain ledger - 0.8.3.RELEASE + 0.9.0-SNAPSHOT ledger-rpc diff --git a/source/ledger/pom.xml b/source/ledger/pom.xml index 0af7101b..202d0554 100644 --- a/source/ledger/pom.xml +++ b/source/ledger/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain jdchain-root - 0.8.2.RELEASE + 0.9.0-SNAPSHOT ledger pom diff --git a/source/peer/pom.xml b/source/peer/pom.xml index 476a201c..01311d5c 100644 --- a/source/peer/pom.xml +++ b/source/peer/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain jdchain-root - 0.8.2.RELEASE + 0.9.0-SNAPSHOT peer diff --git a/source/peer/src/main/java/com/jd/blockchain/peer/web/PeerTimeTasks.java b/source/peer/src/main/java/com/jd/blockchain/peer/web/PeerTimeTasks.java index 26f2d593..e3546374 100644 --- a/source/peer/src/main/java/com/jd/blockchain/peer/web/PeerTimeTasks.java +++ b/source/peer/src/main/java/com/jd/blockchain/peer/web/PeerTimeTasks.java @@ -38,7 +38,7 @@ import java.util.*; * @since 1.0.0 */ @Component -@EnableScheduling +//@EnableScheduling public class PeerTimeTasks implements ApplicationContextAware { private ApplicationContext applicationContext; diff --git a/source/pom.xml b/source/pom.xml index 89f926f5..2e510d96 100644 --- a/source/pom.xml +++ b/source/pom.xml @@ -16,7 +16,7 @@ com.jd.blockchain jdchain-root - 0.8.2.RELEASE + 0.9.0-SNAPSHOT pom jdchain diff --git a/source/runtime/pom.xml b/source/runtime/pom.xml index e17377a2..f866f679 100644 --- a/source/runtime/pom.xml +++ b/source/runtime/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain jdchain-root - 0.8.2.RELEASE + 0.9.0-SNAPSHOT runtime pom diff --git a/source/runtime/runtime-context/pom.xml b/source/runtime/runtime-context/pom.xml index 95bf6e1b..26497a42 100644 --- a/source/runtime/runtime-context/pom.xml +++ b/source/runtime/runtime-context/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain runtime - 0.8.2.RELEASE + 0.9.0-SNAPSHOT runtime-context diff --git a/source/runtime/runtime-modular-booter/pom.xml b/source/runtime/runtime-modular-booter/pom.xml index a02e738c..00dfa501 100644 --- a/source/runtime/runtime-modular-booter/pom.xml +++ b/source/runtime/runtime-modular-booter/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain runtime - 0.8.2.RELEASE + 0.9.0-SNAPSHOT runtime-modular-booter \ No newline at end of file diff --git a/source/runtime/runtime-modular/pom.xml b/source/runtime/runtime-modular/pom.xml index 1354ce0a..dce42a3e 100644 --- a/source/runtime/runtime-modular/pom.xml +++ b/source/runtime/runtime-modular/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain runtime - 0.8.2.RELEASE + 0.9.0-SNAPSHOT runtime-modular diff --git a/source/sdk/pom.xml b/source/sdk/pom.xml index 67a240cc..bbe40755 100644 --- a/source/sdk/pom.xml +++ b/source/sdk/pom.xml @@ -4,7 +4,7 @@ com.jd.blockchain jdchain-root - 0.8.2.RELEASE + 0.9.0-SNAPSHOT sdk pom diff --git a/source/sdk/sdk-base/pom.xml b/source/sdk/sdk-base/pom.xml index e09d8150..4b629000 100644 --- a/source/sdk/sdk-base/pom.xml +++ b/source/sdk/sdk-base/pom.xml @@ -4,7 +4,7 @@ com.jd.blockchain sdk - 0.8.2.RELEASE + 0.9.0-SNAPSHOT sdk-base diff --git a/source/sdk/sdk-client/pom.xml b/source/sdk/sdk-client/pom.xml index 14b5c23c..a33f309d 100644 --- a/source/sdk/sdk-client/pom.xml +++ b/source/sdk/sdk-client/pom.xml @@ -4,7 +4,7 @@ com.jd.blockchain sdk - 0.8.2.RELEASE + 0.9.0-SNAPSHOT sdk-client diff --git a/source/sdk/sdk-samples/pom.xml b/source/sdk/sdk-samples/pom.xml index 999ba911..8c47ed65 100644 --- a/source/sdk/sdk-samples/pom.xml +++ b/source/sdk/sdk-samples/pom.xml @@ -4,7 +4,7 @@ com.jd.blockchain sdk - 0.8.2.RELEASE + 0.9.0-SNAPSHOT sdk-samples diff --git a/source/storage/pom.xml b/source/storage/pom.xml index 30d5b132..3a1e8084 100644 --- a/source/storage/pom.xml +++ b/source/storage/pom.xml @@ -3,7 +3,7 @@ com.jd.blockchain jdchain-root - 0.8.2.RELEASE + 0.9.0-SNAPSHOT storage pom diff --git a/source/storage/storage-composite/pom.xml b/source/storage/storage-composite/pom.xml index 975e29d7..a080704a 100644 --- a/source/storage/storage-composite/pom.xml +++ b/source/storage/storage-composite/pom.xml @@ -4,7 +4,7 @@ com.jd.blockchain storage - 0.8.2.RELEASE + 0.9.0-SNAPSHOT storage-composite diff --git a/source/storage/storage-redis/pom.xml b/source/storage/storage-redis/pom.xml index abf14fb0..ec1fa077 100644 --- a/source/storage/storage-redis/pom.xml +++ b/source/storage/storage-redis/pom.xml @@ -4,7 +4,7 @@ com.jd.blockchain storage - 0.8.2.RELEASE + 0.9.0-SNAPSHOT storage-redis diff --git a/source/storage/storage-rocksdb/pom.xml b/source/storage/storage-rocksdb/pom.xml index 9ccef320..af276f97 100644 --- a/source/storage/storage-rocksdb/pom.xml +++ b/source/storage/storage-rocksdb/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain storage - 0.8.2.RELEASE + 0.9.0-SNAPSHOT storage-rocksdb diff --git a/source/storage/storage-service/pom.xml b/source/storage/storage-service/pom.xml index 255bd759..87bee098 100644 --- a/source/storage/storage-service/pom.xml +++ b/source/storage/storage-service/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain storage - 0.8.2.RELEASE + 0.9.0-SNAPSHOT storage-service diff --git a/source/test/pom.xml b/source/test/pom.xml index f26c27e0..4df214ad 100644 --- a/source/test/pom.xml +++ b/source/test/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain jdchain-root - 0.8.2.RELEASE + 0.9.0-SNAPSHOT test pom diff --git a/source/test/test-consensus-client/pom.xml b/source/test/test-consensus-client/pom.xml index c57a5b2c..402e154b 100644 --- a/source/test/test-consensus-client/pom.xml +++ b/source/test/test-consensus-client/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain test - 0.8.2.RELEASE + 0.9.0-SNAPSHOT test-consensus-client diff --git a/source/test/test-consensus-node/pom.xml b/source/test/test-consensus-node/pom.xml index dff4dc21..7af6cf26 100644 --- a/source/test/test-consensus-node/pom.xml +++ b/source/test/test-consensus-node/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain test - 0.8.2.RELEASE + 0.9.0-SNAPSHOT test-consensus-node @@ -26,7 +26,7 @@ com.jd.blockchain consensus-bftsmart - 0.8.2.RELEASE + 0.9.0-SNAPSHOT org.springframework.boot diff --git a/source/test/test-integration/pom.xml b/source/test/test-integration/pom.xml index 9aa3e873..26906981 100644 --- a/source/test/test-integration/pom.xml +++ b/source/test/test-integration/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain test - 0.8.2.RELEASE + 0.9.0-SNAPSHOT test-integration diff --git a/source/test/test-ledger-core/pom.xml b/source/test/test-ledger-core/pom.xml index bd8b83c1..810f2339 100644 --- a/source/test/test-ledger-core/pom.xml +++ b/source/test/test-ledger-core/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain test - 0.8.2.RELEASE + 0.9.0-SNAPSHOT test-ledger-core diff --git a/source/tools/pom.xml b/source/tools/pom.xml index d5986244..ef62dce3 100644 --- a/source/tools/pom.xml +++ b/source/tools/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain jdchain-root - 0.8.2.RELEASE + 0.9.0-SNAPSHOT tools pom diff --git a/source/tools/tools-capability/pom.xml b/source/tools/tools-capability/pom.xml index 289fd670..ba87f18a 100644 --- a/source/tools/tools-capability/pom.xml +++ b/source/tools/tools-capability/pom.xml @@ -5,7 +5,7 @@ tools com.jd.blockchain - 0.8.2.RELEASE + 0.9.0-SNAPSHOT 4.0.0 diff --git a/source/tools/tools-initializer-booter/pom.xml b/source/tools/tools-initializer-booter/pom.xml index 26bf0b36..4b321298 100644 --- a/source/tools/tools-initializer-booter/pom.xml +++ b/source/tools/tools-initializer-booter/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain tools - 0.8.2.RELEASE + 0.9.0-SNAPSHOT tools-initializer-booter diff --git a/source/tools/tools-initializer/pom.xml b/source/tools/tools-initializer/pom.xml index d4fe5039..f0f28fbb 100644 --- a/source/tools/tools-initializer/pom.xml +++ b/source/tools/tools-initializer/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain tools - 0.8.2.RELEASE + 0.9.0-SNAPSHOT tools-initializer diff --git a/source/tools/tools-keygen-booter/pom.xml b/source/tools/tools-keygen-booter/pom.xml index c0e91f9a..ce9ef4e2 100644 --- a/source/tools/tools-keygen-booter/pom.xml +++ b/source/tools/tools-keygen-booter/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain tools - 0.8.2.RELEASE + 0.9.0-SNAPSHOT tools-keygen-booter diff --git a/source/tools/tools-keygen/pom.xml b/source/tools/tools-keygen/pom.xml index fa1755c9..7ea947e4 100644 --- a/source/tools/tools-keygen/pom.xml +++ b/source/tools/tools-keygen/pom.xml @@ -5,7 +5,7 @@ com.jd.blockchain tools - 0.8.2.RELEASE + 0.9.0-SNAPSHOT tools-keygen diff --git a/source/utils/pom.xml b/source/utils/pom.xml index 42ae182d..a00a7bf8 100644 --- a/source/utils/pom.xml +++ b/source/utils/pom.xml @@ -4,7 +4,7 @@ com.jd.blockchain jdchain-root - 0.8.2.RELEASE + 0.9.0-SNAPSHOT utils pom diff --git a/source/utils/utils-common/pom.xml b/source/utils/utils-common/pom.xml index ce523d77..de4d161e 100644 --- a/source/utils/utils-common/pom.xml +++ b/source/utils/utils-common/pom.xml @@ -4,7 +4,7 @@ com.jd.blockchain utils - 0.8.2.RELEASE + 0.9.0-SNAPSHOT utils-common diff --git a/source/utils/utils-http/pom.xml b/source/utils/utils-http/pom.xml index ef13d9e8..2cd186bb 100644 --- a/source/utils/utils-http/pom.xml +++ b/source/utils/utils-http/pom.xml @@ -4,7 +4,7 @@ com.jd.blockchain utils - 0.8.2.RELEASE + 0.9.0-SNAPSHOT diff --git a/source/utils/utils-serialize/pom.xml b/source/utils/utils-serialize/pom.xml index c8349fb3..c95c2a1a 100644 --- a/source/utils/utils-serialize/pom.xml +++ b/source/utils/utils-serialize/pom.xml @@ -4,7 +4,7 @@ com.jd.blockchain utils - 0.8.2.RELEASE + 0.9.0-SNAPSHOT utils-serialize diff --git a/source/utils/utils-test/pom.xml b/source/utils/utils-test/pom.xml index 5a3f0fa3..dffee14d 100644 --- a/source/utils/utils-test/pom.xml +++ b/source/utils/utils-test/pom.xml @@ -4,7 +4,7 @@ com.jd.blockchain utils - 0.8.2.RELEASE + 0.9.0-SNAPSHOT utils-test diff --git a/source/utils/utils-web-server/pom.xml b/source/utils/utils-web-server/pom.xml index 85cb5dfc..1774dc92 100644 --- a/source/utils/utils-web-server/pom.xml +++ b/source/utils/utils-web-server/pom.xml @@ -4,7 +4,7 @@ com.jd.blockchain utils - 0.8.2.RELEASE + 0.9.0-SNAPSHOT utils-web-server diff --git a/source/utils/utils-web/pom.xml b/source/utils/utils-web/pom.xml index 4368e4ed..a4e8efc4 100644 --- a/source/utils/utils-web/pom.xml +++ b/source/utils/utils-web/pom.xml @@ -4,7 +4,7 @@ com.jd.blockchain utils - 0.8.2.RELEASE + 0.9.0-SNAPSHOT utils-web