diff --git a/ethereumj-core/src/test/java/org/ethereum/crypto/ECKeyTest.java b/ethereumj-core/src/test/java/org/ethereum/crypto/ECKeyTest.java index 8474a66d..70f8f660 100644 --- a/ethereumj-core/src/test/java/org/ethereum/crypto/ECKeyTest.java +++ b/ethereumj-core/src/test/java/org/ethereum/crypto/ECKeyTest.java @@ -35,8 +35,7 @@ public class ECKeyTest { private String address = "8a40bfaa73256b60764c1bf40675a99083efb075"; private String exampleMessage = new String("This is an example of a signed message."); - private String bitcoinSigBase64 = "HIb1Pb2tCwt/f15R9c/nlCgQrFTAxIt7TooOqG4B8ODNSaUdTtcW1N2E9bH+mF9HGjfd88H8QOyG0sPZtp2uaCQ="; - private String ethereumSigBase64 = "HD5AsBr4wuH6UU9tXuSJhUvgfGayfwoY0cKT03sFUjnpQsupHznd/3mCIRfLuNHlRCVGdAyHecdyM8IVZMtc1I8="; + private String sigBase64 = "HD5AsBr4wuH6UU9tXuSJhUvgfGayfwoY0cKT03sFUjnpQsupHznd/3mCIRfLuNHlRCVGdAyHecdyM8IVZMtc1I8="; @Test public void testHashCode() { @@ -99,19 +98,6 @@ public class ECKeyTest { assertEquals("pub:04a0434d9e47f3c86235477c7b1ae6ae5d3442d49b1943c2b752a68e2a47e247c7893aba425419bc27a3b6c7e693a24c696f794c2ed877a1593cbee53b037368d7", key.toString()); } - @Test - public void testSignBitcoin() throws IOException { - // TODO: Understand why key must be decompressed for this to work - ECKey key = ECKey.fromPrivate(privateKey).decompress(); - System.out.println("Secret: " + Hex.toHexString(key.getPrivKeyBytes())); - System.out.println("Pubkey: " + Hex.toHexString(key.getPubKey())); - String output = key.signBitcoinMessage(exampleMessage); - - System.out.println("Signtr: " + output + " (Base64) - length: " + output.length()); - - assertEquals(bitcoinSigBase64, output); - } - @Test public void testEthereumSign() throws IOException { // TODO: Understand why key must be decompressed for this to work @@ -123,7 +109,7 @@ public class ECKeyTest { ECDSASignature signature = key.sign(messageHash); String output = signature.toBase64(); System.out.println("Signtr\t: " + output + " (Base64, length: " + output.length() + ")"); - assertEquals(ethereumSigBase64, output); + assertEquals(sigBase64, output); } @Test @@ -154,16 +140,6 @@ public class ECKeyTest { } } - @Test - public void testVerifyBitcoinMessage() { - ECKey key = ECKey.fromPublicOnly(pubKey); - try { - key.verifyBitcoinMessage(exampleMessage, bitcoinSigBase64); - } catch (SignatureException e) { - fail(); - } - } - @Test public void testSValue() throws Exception { // Check that we never generate an S value that is larger than half the curve order. This avoids a malleability @@ -256,22 +232,14 @@ public class ECKeyTest { assertTrue(found); } - @Test - public void testSignedBitcoinMessageToKey() throws SignatureException { - ECKey key = ECKey.signedBitcoinMessageToKey("This is an example of a signed message.", bitcoinSigBase64); - assertNotNull(key); - assertArrayEquals(pubKey, key.getPubKey()); - } - @Test public void testSignedMessageToKey() throws SignatureException { byte[] messageHash = HashUtil.sha3(exampleMessage.getBytes()); - ECKey key = ECKey.signatureToKey(messageHash, ethereumSigBase64); + ECKey key = ECKey.signatureToKey(messageHash, sigBase64); assertNotNull(key); assertArrayEquals(pubKey, key.getPubKey()); } - - + @Test public void testGetPrivKeyBytes() { ECKey key = new ECKey();