1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-12-08 12:01:09 +01:00

Fix decryption error

This commit is contained in:
Paul Schaub 2018-06-19 15:06:25 +02:00
parent 800955d5a8
commit 63e98cb4d6
4 changed files with 122 additions and 43 deletions

View file

@ -147,13 +147,11 @@ public final class OXInstantMessagingManager extends Manager {
}
OpenPgpProvider provider = openPgpManager.getOpenPgpProvider();
byte[] decoded = Base64.decode(element.getEncryptedBase64MessageContent());
try {
OpenPgpEncryptedChat encryptedChat = chatWith(from);
DecryptedBytesAndMetadata decryptedBytes = provider.decrypt(Base64.decode(
element.getEncryptedBase64MessageContent()),
from.asBareJid(),
null);
DecryptedBytesAndMetadata decryptedBytes = provider.decrypt(decoded, from.asBareJid(), null);
OpenPgpMessage openPgpMessage = new OpenPgpMessage(decryptedBytes.getBytes(),
new OpenPgpMessage.Metadata(decryptedBytes.getDecryptionKey(),

View file

@ -22,7 +22,6 @@ import java.util.HashSet;
import java.util.Set;
import org.jivesoftware.smack.util.Objects;
import org.jivesoftware.smack.util.stringencoder.Base64;
import org.jivesoftware.smackx.ox.element.CryptElement;
import org.jivesoftware.smackx.ox.element.OpenPgpContentElement;
import org.jivesoftware.smackx.ox.element.OpenPgpElement;
@ -70,7 +69,7 @@ public class OpenPgpMessage {
}
public OpenPgpMessage(byte[] bytes, Metadata metadata) {
this.element = new String(Base64.decode(bytes), Charset.forName("UTF-8"));
this.element = new String(bytes, Charset.forName("UTF-8"));
this.state = metadata.getState();
}