use of org.bitcoinj.core.ECKey in project bitsquare by bitsquare.
the class ArbitratorManager method verifySignature.
private boolean verifySignature(PublicKey storageSignaturePubKey, byte[] registrationPubKey, String signature) {
String keyToSignAsHex = Utils.HEX.encode(storageSignaturePubKey.getEncoded());
try {
ECKey key = ECKey.fromPublicOnly(registrationPubKey);
key.verifyMessage(keyToSignAsHex, signature);
return true;
} catch (SignatureException e) {
log.warn("verifySignature failed");
return false;
}
}
use of org.bitcoinj.core.ECKey in project bitsquare by bitsquare.
the class ArbitratorRegistrationViewModel method setPrivKeyAndCheckPubKey.
boolean setPrivKeyAndCheckPubKey(String privKeyString) {
ECKey _registrationKey = arbitratorManager.getRegistrationKey(privKeyString);
if (_registrationKey != null) {
String _registrationPubKeyAsHex = Utils.HEX.encode(_registrationKey.getPubKey());
boolean isKeyValid = arbitratorManager.isPublicKeyInList(_registrationPubKeyAsHex);
if (isKeyValid) {
registrationKey = _registrationKey;
registrationPubKeyAsHex.set(_registrationPubKeyAsHex);
}
updateDisableStates();
return isKeyValid;
} else {
updateDisableStates();
return false;
}
}
Aggregations