mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Add additional logging for payment address parsing
This commit is contained in:
parent
8236696492
commit
936a68433d
2 changed files with 10 additions and 1 deletions
|
@ -6,10 +6,14 @@ import org.signal.libsignal.protocol.IdentityKey;
|
||||||
import org.signal.libsignal.protocol.IdentityKeyPair;
|
import org.signal.libsignal.protocol.IdentityKeyPair;
|
||||||
import org.signal.libsignal.protocol.ecc.ECPrivateKey;
|
import org.signal.libsignal.protocol.ecc.ECPrivateKey;
|
||||||
import org.signal.libsignal.protocol.ecc.ECPublicKey;
|
import org.signal.libsignal.protocol.ecc.ECPublicKey;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.whispersystems.signalservice.internal.push.SignalServiceProtos;
|
import org.whispersystems.signalservice.internal.push.SignalServiceProtos;
|
||||||
|
|
||||||
public class PaymentUtils {
|
public class PaymentUtils {
|
||||||
|
|
||||||
|
private final static Logger logger = LoggerFactory.getLogger(PaymentUtils.class);
|
||||||
|
|
||||||
private PaymentUtils() {
|
private PaymentUtils() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +41,7 @@ public class PaymentUtils {
|
||||||
SignalServiceProtos.PaymentAddress paymentAddress, ECPublicKey publicKey
|
SignalServiceProtos.PaymentAddress paymentAddress, ECPublicKey publicKey
|
||||||
) {
|
) {
|
||||||
if (!paymentAddress.hasMobileCoinAddress()) {
|
if (!paymentAddress.hasMobileCoinAddress()) {
|
||||||
|
logger.debug("Got payment address without mobile coin address, ignoring.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +49,7 @@ public class PaymentUtils {
|
||||||
byte[] signature = paymentAddress.getMobileCoinAddress().getSignature().toByteArray();
|
byte[] signature = paymentAddress.getMobileCoinAddress().getSignature().toByteArray();
|
||||||
|
|
||||||
if (signature.length != 64 || !publicKey.verifySignature(bytes, signature)) {
|
if (signature.length != 64 || !publicKey.verifySignature(bytes, signature)) {
|
||||||
|
logger.debug("Got mobile coin address with invalid signature, ignoring.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,8 @@ public class ProfileUtils {
|
||||||
IdentityKey identityKey = null;
|
IdentityKey identityKey = null;
|
||||||
try {
|
try {
|
||||||
identityKey = new IdentityKey(Base64.getDecoder().decode(encryptedProfile.getIdentityKey()), 0);
|
identityKey = new IdentityKey(Base64.getDecoder().decode(encryptedProfile.getIdentityKey()), 0);
|
||||||
} catch (InvalidKeyException ignored) {
|
} catch (InvalidKeyException e) {
|
||||||
|
logger.debug("Failed to decode identity key in profile, can't verify payment address", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -112,6 +113,7 @@ public class ProfileUtils {
|
||||||
try {
|
try {
|
||||||
decrypted = profileCipher.decryptWithLength(encryptedPaymentAddress);
|
decrypted = profileCipher.decryptWithLength(encryptedPaymentAddress);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
logger.debug("Failed to decrypt payment address", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,6 +121,7 @@ public class ProfileUtils {
|
||||||
try {
|
try {
|
||||||
paymentAddress = SignalServiceProtos.PaymentAddress.parseFrom(decrypted);
|
paymentAddress = SignalServiceProtos.PaymentAddress.parseFrom(decrypted);
|
||||||
} catch (InvalidProtocolBufferException e) {
|
} catch (InvalidProtocolBufferException e) {
|
||||||
|
logger.debug("Failed to parse payment address", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue