mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
parent
7e5aec6e15
commit
ff18b1bf99
2 changed files with 8 additions and 11 deletions
|
@ -5,7 +5,6 @@ import org.asamk.signal.storage.contacts.ContactInfo;
|
||||||
import org.asamk.signal.storage.groups.GroupInfo;
|
import org.asamk.signal.storage.groups.GroupInfo;
|
||||||
import org.asamk.signal.util.DateUtils;
|
import org.asamk.signal.util.DateUtils;
|
||||||
import org.asamk.signal.util.Util;
|
import org.asamk.signal.util.Util;
|
||||||
import org.signal.libsignal.metadata.ProtocolUntrustedIdentityException;
|
|
||||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
|
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
|
||||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentPointer;
|
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentPointer;
|
||||||
import org.whispersystems.signalservice.api.messages.SignalServiceContent;
|
import org.whispersystems.signalservice.api.messages.SignalServiceContent;
|
||||||
|
@ -70,11 +69,6 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
|
||||||
System.out.println("The user’s key is untrusted, either the user has reinstalled Signal or a third party sent this message.");
|
System.out.println("The user’s key is untrusted, either the user has reinstalled Signal or a third party sent this message.");
|
||||||
System.out.println("Use 'signal-cli -u " + m.getUsername() + " listIdentities -n " + e.getName() + "', verify the key and run 'signal-cli -u " + m.getUsername() + " trust -v \"FINGER_PRINT\" " + e.getName() + "' to mark it as trusted");
|
System.out.println("Use 'signal-cli -u " + m.getUsername() + " listIdentities -n " + e.getName() + "', verify the key and run 'signal-cli -u " + m.getUsername() + " trust -v \"FINGER_PRINT\" " + e.getName() + "' to mark it as trusted");
|
||||||
System.out.println("If you don't care about security, use 'signal-cli -u " + m.getUsername() + " trust -a " + e.getName() + "' to trust it without verification");
|
System.out.println("If you don't care about security, use 'signal-cli -u " + m.getUsername() + " trust -a " + e.getName() + "' to trust it without verification");
|
||||||
} else if (exception instanceof ProtocolUntrustedIdentityException) {
|
|
||||||
ProtocolUntrustedIdentityException e = (ProtocolUntrustedIdentityException) exception;
|
|
||||||
System.out.println("The user’s key is untrusted, either the user has reinstalled Signal or a third party sent this message.");
|
|
||||||
System.out.println("Use 'signal-cli -u " + m.getUsername() + " listIdentities -n " + e.getSender() + "', verify the key and run 'signal-cli -u " + m.getUsername() + " trust -v \"FINGER_PRINT\" " + e.getSender() + "' to mark it as trusted");
|
|
||||||
System.out.println("If you don't care about security, use 'signal-cli -u " + m.getUsername() + " trust -a " + e.getSender() + "' to trust it without verification");
|
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Exception: " + exception.getMessage() + " (" + exception.getClass().getSimpleName() + ")");
|
System.out.println("Exception: " + exception.getMessage() + " (" + exception.getClass().getSimpleName() + ")");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1243,14 +1243,17 @@ public class Manager implements Signal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private SignalServiceContent decryptMessage(SignalServiceEnvelope envelope) throws InvalidMetadataMessageException, ProtocolInvalidMessageException, ProtocolDuplicateMessageException, ProtocolLegacyMessageException, ProtocolInvalidKeyIdException, InvalidMetadataVersionException, ProtocolInvalidVersionException, ProtocolNoSessionException, ProtocolInvalidKeyException, ProtocolUntrustedIdentityException, SelfSendException, UnsupportedDataMessageException {
|
private SignalServiceContent decryptMessage(SignalServiceEnvelope envelope) throws InvalidMetadataMessageException, ProtocolInvalidMessageException, ProtocolDuplicateMessageException, ProtocolLegacyMessageException, ProtocolInvalidKeyIdException, InvalidMetadataVersionException, ProtocolInvalidVersionException, ProtocolNoSessionException, ProtocolInvalidKeyException, SelfSendException, UnsupportedDataMessageException, org.whispersystems.libsignal.UntrustedIdentityException {
|
||||||
SignalServiceCipher cipher = new SignalServiceCipher(account.getSelfAddress(), account.getSignalProtocolStore(), Utils.getCertificateValidator());
|
SignalServiceCipher cipher = new SignalServiceCipher(account.getSelfAddress(), account.getSignalProtocolStore(), Utils.getCertificateValidator());
|
||||||
try {
|
try {
|
||||||
return cipher.decrypt(envelope);
|
return cipher.decrypt(envelope);
|
||||||
} catch (ProtocolUntrustedIdentityException e) {
|
} catch (ProtocolUntrustedIdentityException e) {
|
||||||
// TODO We don't get the new untrusted identity from ProtocolUntrustedIdentityException anymore ... we need to get it from somewhere else
|
if (e.getCause() instanceof org.whispersystems.libsignal.UntrustedIdentityException) {
|
||||||
// account.getSignalProtocolStore().saveIdentity(e.getSender(), e.getUntrustedIdentity(), TrustLevel.UNTRUSTED);
|
org.whispersystems.libsignal.UntrustedIdentityException identityException = (org.whispersystems.libsignal.UntrustedIdentityException) e.getCause();
|
||||||
throw e;
|
account.getSignalProtocolStore().saveIdentity(resolveSignalServiceAddress(identityException.getName()), identityException.getUntrustedIdentity(), TrustLevel.UNTRUSTED);
|
||||||
|
throw identityException;
|
||||||
|
}
|
||||||
|
throw new AssertionError(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1489,7 +1492,7 @@ public class Manager implements Signal {
|
||||||
if (!isMessageBlocked(envelope, content)) {
|
if (!isMessageBlocked(envelope, content)) {
|
||||||
handler.handleMessage(envelope, content, exception);
|
handler.handleMessage(envelope, content, exception);
|
||||||
}
|
}
|
||||||
if (!(exception instanceof ProtocolUntrustedIdentityException)) {
|
if (!(exception instanceof org.whispersystems.libsignal.UntrustedIdentityException)) {
|
||||||
File cacheFile = null;
|
File cacheFile = null;
|
||||||
try {
|
try {
|
||||||
cacheFile = getMessageCacheFile(envelope.getSourceE164().get(), now, envelope.getTimestamp());
|
cacheFile = getMessageCacheFile(envelope.getSourceE164().get(), now, envelope.getTimestamp());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue