@Override public boolean equals (Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ServerObject that = (ServerObject) o; return pubKeyServer != null ? pubKeyServer.equals(that.pubKeyServer) : that.pubKeyServer == null; }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DecryptionKeyImpl that = (DecryptionKeyImpl) o; return key.equals(that.key) && privateKey.equals(that.privateKey); }
/** * Verifies equality of all fields but NOT the parent pointer (thus the same key derived in two separate heirarchy * objects will equal each other. */ @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DeterministicKey other = (DeterministicKey) o; return super.equals(other) && Arrays.equals(this.chainCode, other.chainCode) && Objects.equal(this.childNumberPath, other.childNumberPath); }
/** * Verifies equality of all fields but NOT the parent pointer (thus the same key derived in two separate heirarchy * objects will equal each other. */ @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DeterministicKey other = (DeterministicKey) o; return super.equals(other) && Arrays.equals(this.chainCode, other.chainCode) && Objects.equal(this.childNumberPath, other.childNumberPath); }
/** * Verifies equality of all fields but NOT the parent pointer (thus the same key derived in two separate heirarchy * objects will equal each other. */ @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DeterministicKey other = (DeterministicKey) o; return super.equals(other) && Arrays.equals(this.chainCode, other.chainCode) && Objects.equal(this.childNumberPath, other.childNumberPath); }
/** * Verifies equality of all fields but NOT the parent pointer (thus the same key derived in two separate hierarchy * objects will equal each other. */ @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DeterministicKey other = (DeterministicKey) o; return super.equals(other) && Arrays.equals(this.chainCode, other.chainCode) && Objects.equal(this.childNumberPath, other.childNumberPath); }
@Test public void keyRecovery() throws Exception { ECKey key = new ECKey(); String message = "Hello World!"; Sha256Hash hash = Sha256Hash.of(message.getBytes()); ECKey.ECDSASignature sig = key.sign(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); if (key.equals(key2)) { found = true; break; } } assertTrue(found); }
@Test public void keyRecoveryWithEncryptedKey() throws Exception { ECKey unencryptedKey = new ECKey(); KeyParameter aesKey = keyCrypter.deriveKey(PASSWORD1); ECKey encryptedKey = unencryptedKey.encrypt(keyCrypter, aesKey); String message = "Goodbye Jupiter!"; Sha256Hash hash = Sha256Hash.of(message.getBytes()); ECKey.ECDSASignature sig = encryptedKey.sign(hash, aesKey); unencryptedKey = ECKey.fromPublicOnly(unencryptedKey.getPubKeyPoint()); boolean found = false; for (int i = 0; i < 4; i++) { ECKey key2 = ECKey.recoverFromSignature(i, sig, hash, true); checkNotNull(key2); if (unencryptedKey.equals(key2)) { found = true; break; } } assertTrue(found); }