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:
parent
800955d5a8
commit
63e98cb4d6
4 changed files with 122 additions and 43 deletions
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue