aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/eu/siacs/conversations/crypto')
-rw-r--r--src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java8
-rw-r--r--src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java15
2 files changed, 12 insertions, 11 deletions
diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java
index 470c52067..d4089b202 100644
--- a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java
+++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java
@@ -856,14 +856,14 @@ public class AxolotlService {
@Nullable
public XmppAxolotlMessage encrypt(Message message ){
- final XmppAxolotlMessage axolotlMessage = new XmppAxolotlMessage(message.getContact(),
+ final XmppAxolotlMessage axolotlMessage = new XmppAxolotlMessage(message.getContact().getJid().toBareJid(),
ownDeviceId, message.getBody());
- if(findSessionsforContact(axolotlMessage.getContact()).isEmpty()) {
+ if(findSessionsforContact(message.getContact()).isEmpty()) {
return null;
}
Log.d(Config.LOGTAG, "Building axolotl foreign headers...");
- for (XmppAxolotlSession session : findSessionsforContact(axolotlMessage.getContact())) {
+ for (XmppAxolotlSession session : findSessionsforContact(message.getContact())) {
Log.d(Config.LOGTAG, session.remoteAddress.toString());
//if(!session.isTrusted()) {
// TODO: handle this properly
@@ -910,7 +910,7 @@ public class AxolotlService {
public XmppAxolotlMessage.XmppAxolotlPlaintextMessage processReceiving(XmppAxolotlMessage message) {
XmppAxolotlMessage.XmppAxolotlPlaintextMessage plaintextMessage = null;
- AxolotlAddress senderAddress = new AxolotlAddress(message.getContact().getJid().toBareJid().toString(),
+ AxolotlAddress senderAddress = new AxolotlAddress(message.getFrom().toString(),
message.getSenderDeviceId());
XmppAxolotlSession session = sessions.get(senderAddress);
diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java
index 01b06c226..06dd2cdaf 100644
--- a/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java
+++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java
@@ -19,13 +19,14 @@ import javax.crypto.spec.SecretKeySpec;
import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.xml.Element;
+import eu.siacs.conversations.xmpp.jid.Jid;
public class XmppAxolotlMessage {
private byte[] innerKey;
private byte[] ciphertext;
private byte[] iv;
private final Set<XmppAxolotlMessageHeader> headers;
- private final Contact contact;
+ private final Jid from;
private final int sourceDeviceId;
public static class XmppAxolotlMessageHeader {
@@ -82,8 +83,8 @@ public class XmppAxolotlMessage {
}
- public XmppAxolotlMessage(Contact contact, Element axolotlMessage) {
- this.contact = contact;
+ public XmppAxolotlMessage(Jid from, Element axolotlMessage) {
+ this.from = from;
this.sourceDeviceId = Integer.parseInt(axolotlMessage.getAttribute("id"));
this.headers = new HashSet<>();
for(Element child:axolotlMessage.getChildren()) {
@@ -101,8 +102,8 @@ public class XmppAxolotlMessage {
}
}
- public XmppAxolotlMessage(Contact contact, int sourceDeviceId, String plaintext) {
- this.contact = contact;
+ public XmppAxolotlMessage(Jid from, int sourceDeviceId, String plaintext) {
+ this.from = from;
this.sourceDeviceId = sourceDeviceId;
this.headers = new HashSet<>();
this.encrypt(plaintext);
@@ -124,8 +125,8 @@ public class XmppAxolotlMessage {
}
}
- public Contact getContact() {
- return this.contact;
+ public Jid getFrom() {
+ return this.from;
}
public int getSenderDeviceId() {