mirror of
https://gitee.com/BDWare/common
synced 2025-01-10 09:54:13 +00:00
add debug port for cp
This commit is contained in:
parent
0aac9d16d9
commit
0da9d88173
@ -41,6 +41,7 @@ public class Contract extends SM2Verifiable implements Serializable {
|
|||||||
private YjsType yjsType;
|
private YjsType yjsType;
|
||||||
|
|
||||||
private SerializableJson createParam;
|
private SerializableJson createParam;
|
||||||
|
private int remoteDebugPort = 0;
|
||||||
|
|
||||||
public int getShardingId() {
|
public int getShardingId() {
|
||||||
return this.shardingId;
|
return this.shardingId;
|
||||||
@ -232,9 +233,17 @@ public class Contract extends SM2Verifiable implements Serializable {
|
|||||||
createParam = new SerializableJson(ele);
|
createParam = new SerializableJson(ele);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRemoteDebugPort(int port) {
|
||||||
|
remoteDebugPort = port;
|
||||||
|
}
|
||||||
|
|
||||||
public JsonElement getCreateParam() {
|
public JsonElement getCreateParam() {
|
||||||
if (createParam != null)
|
if (createParam != null)
|
||||||
return createParam.getJsonElement();
|
return createParam.getJsonElement();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getRemoteDebugPort() {
|
||||||
|
return remoteDebugPort;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,16 @@ public class SM2UtilTest {
|
|||||||
"{\"publicKey\":\"0442e39c0b1623e6f95ef896d37f41aa3cd98fbc3aea71250eedba4335c6c3aff51b5fa2352f920d1063b50a30738427c18375df886985a63e0f496293fdad22a8\",\"privateKey\":\"b7e504cf951792554bf4a9874be37cb1279d38939444388e2046ee9603b4f0c4\"}";
|
"{\"publicKey\":\"0442e39c0b1623e6f95ef896d37f41aa3cd98fbc3aea71250eedba4335c6c3aff51b5fa2352f920d1063b50a30738427c18375df886985a63e0f496293fdad22a8\",\"privateKey\":\"b7e504cf951792554bf4a9874be37cb1279d38939444388e2046ee9603b4f0c4\"}";
|
||||||
SM2KeyPair keyPair = SM2KeyPair.fromJson(keyPairStr);
|
SM2KeyPair keyPair = SM2KeyPair.fromJson(keyPairStr);
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void loadKey() throws Exception {
|
||||||
|
String keyStr = "{\"privateKey\": \"b4ab74a0d8691fc45fd214bdaf45b1dc6ac288a93d1518599fc824ab29310a1a\",\n" +
|
||||||
|
" \"publicKey\": \"04fef570617a3a2dfba6a4dd25050919266735f683f69aee8df4cd600f34b7440a26e90af3b92b63bad7c013f32c2665599ddde33c87736efa667eb027cdd8572f\"\n" +
|
||||||
|
" }";
|
||||||
|
SM2KeyPair keyPair = SM2KeyPair.fromJson(keyStr);
|
||||||
|
byte[] result = SM2Util.sign(keyPair.getPrivateKeyParameter(), "abc".getBytes());
|
||||||
|
System.out.println(result.length);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void verify2() {
|
public void verify2() {
|
||||||
String toVerify = "GeneralContract|plainTextTransmission|{\"ledger\":\"test\",\"data\":\"上链信息为json格式\"}|04398dfde44290595cd098cd2f904b36367c69f9011719d43fb0955f823cf1386764769bc7c0a5649dcb316d552998a5c106afd268d9db8b6482ce527544a7bd15";
|
String toVerify = "GeneralContract|plainTextTransmission|{\"ledger\":\"test\",\"data\":\"上链信息为json格式\"}|04398dfde44290595cd098cd2f904b36367c69f9011719d43fb0955f823cf1386764769bc7c0a5649dcb316d552998a5c106afd268d9db8b6482ce527544a7bd15";
|
||||||
|
Loading…
Reference in New Issue
Block a user