Examples of doSign()


Examples of org.ethereum.crypto.ECKey.doSign()

        for (byte i = 0; i < ITERATIONS; i++) {
            final byte[] hash = HashUtil.sha3(new byte[]{i});
            sigFutures.add(executor.submit(new Callable<ECKey.ECDSASignature>() {
                @Override
                public ECKey.ECDSASignature call() throws Exception {
                    return key.doSign(hash);
                }
            }));
        }
        List<ECKey.ECDSASignature> sigs = Futures.allAsList(sigFutures).get();
        for (ECKey.ECDSASignature signature : sigs) {
View Full Code Here

Examples of org.ethereum.crypto.ECKey.doSign()

 
    @Test
    public void testSignVerify() {
      ECKey key = ECKey.fromPrivate(privateKey);
      String message = new String("This is an example of a signed message.");
      ECDSASignature output = key.doSign(message.getBytes());
      assertTrue(key.verify(message.getBytes(), output));
    }
     
  @Test
  public void testIsPubKeyCanonicalCorect() {
View Full Code Here

Examples of org.ethereum.crypto.ECKey.doSign()

    @Test
    public void keyRecovery() throws Exception {
        ECKey key = new ECKey();
        String message = "Hello World!";
        byte[] hash = HashUtil.sha256(message.getBytes());
        ECKey.ECDSASignature sig = key.doSign(hash);
        key = ECKey.fromPublicOnly(key.getPubKeyPoint());
        boolean found = false;
        for (int i = 0; i < 4; i++) {
            ECKey key2 = ECKey.recoverFromSignature(i, sig, hash, true);
            checkNotNull(key2);
View Full Code Here

Examples of org.ethereum.crypto.ECKey.doSign()

        // step 1: serialize + RLP encode
        // step 2: hash = sha3(step1)
        byte[] txHash = HashUtil.sha3(data);

        String signature = key.doSign(txHash).toBase64();
        System.out.println(signature);
    }

    @Test  /* achieve public key of the sender */
    public void test2() throws Exception {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.