mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-11-02 18:26:43 +00:00
add message sign test for low r requiring only a single attempt
This commit is contained in:
parent
f4730f7147
commit
cc6e3ffdc2
1 changed files with 8 additions and 4 deletions
|
@ -26,12 +26,16 @@ public class ECKeyTest {
|
||||||
Assert.assertEquals("14JmU9a7SzieZNEtBnsZo688rt3mGrw6hr", address.toString());
|
Assert.assertEquals("14JmU9a7SzieZNEtBnsZo688rt3mGrw6hr", address.toString());
|
||||||
ECKey privKey = keystore.getKey(firstReceive);
|
ECKey privKey = keystore.getKey(firstReceive);
|
||||||
|
|
||||||
|
//1 attempt required for low R
|
||||||
|
String signature1 = privKey.signMessage("Test2", ScriptType.P2PKH, null);
|
||||||
|
Assert.assertEquals("IHra0jSywF1TjIJ5uf7IDECae438cr4o3VmG6Ri7hYlDL+pUEXyUfwLwpiAfUQVqQFLgs6OaX0KsoydpuwRI71o=", signature1);
|
||||||
|
|
||||||
//2 attempts required for low R
|
//2 attempts required for low R
|
||||||
String signature = privKey.signMessage("Test", ScriptType.P2PKH, null);
|
String signature2 = privKey.signMessage("Test", ScriptType.P2PKH, null);
|
||||||
Assert.assertEquals("IDgMx1ljPhLHlKUOwnO/jBIgK+K8n8mvDUDROzTgU8gOaPDMs+eYXJpNXXINUx5WpeV605p5uO6B3TzBVcvs478=", signature);
|
Assert.assertEquals("IDgMx1ljPhLHlKUOwnO/jBIgK+K8n8mvDUDROzTgU8gOaPDMs+eYXJpNXXINUx5WpeV605p5uO6B3TzBVcvs478=", signature2);
|
||||||
|
|
||||||
//3 attempts required for low R
|
//3 attempts required for low R
|
||||||
String signature2 = privKey.signMessage("Test1", ScriptType.P2PKH, null);
|
String signature3 = privKey.signMessage("Test1", ScriptType.P2PKH, null);
|
||||||
Assert.assertEquals("IEt/v9K95YVFuRtRtWaabPVwWOFv1FSA/e874I8ABgYMbRyVvHhSwLFz0RZuO87ukxDd4TOsRdofQwMEA90LCgI=", signature2);
|
Assert.assertEquals("IEt/v9K95YVFuRtRtWaabPVwWOFv1FSA/e874I8ABgYMbRyVvHhSwLFz0RZuO87ukxDd4TOsRdofQwMEA90LCgI=", signature3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue