mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-12 13:33:39 +00:00
0dd36c64a4
1) Move the attachment structures into the encrypted message body. 2) Encrypt attachments with symmetric keys transmitted in the encryptd attachment pointer structure. 3) Correctly handle asynchronous decryption and categorization of encrypted push messages. TODO: Correct notification process and network/interruption retries.
64 lines
1.4 KiB
Java
64 lines
1.4 KiB
Java
package org.whispersystems.textsecure.push;
|
|
|
|
import android.os.Parcel;
|
|
import android.os.Parcelable;
|
|
|
|
public class PushAttachmentPointer implements Parcelable {
|
|
|
|
public static final Parcelable.Creator<PushAttachmentPointer> CREATOR = new Parcelable.Creator<PushAttachmentPointer>() {
|
|
@Override
|
|
public PushAttachmentPointer createFromParcel(Parcel in) {
|
|
return new PushAttachmentPointer(in);
|
|
}
|
|
|
|
@Override
|
|
public PushAttachmentPointer[] newArray(int size) {
|
|
return new PushAttachmentPointer[size];
|
|
}
|
|
};
|
|
|
|
private final String contentType;
|
|
private final long id;
|
|
private final byte[] key;
|
|
|
|
public PushAttachmentPointer(String contentType, long id, byte[] key) {
|
|
this.contentType = contentType;
|
|
this.id = id;
|
|
this.key = key;
|
|
}
|
|
|
|
public PushAttachmentPointer(Parcel in) {
|
|
this.contentType = in.readString();
|
|
this.id = in.readLong();
|
|
|
|
int keyLength = in.readInt();
|
|
this.key = new byte[keyLength];
|
|
in.readByteArray(this.key);
|
|
}
|
|
|
|
public String getContentType() {
|
|
return contentType;
|
|
}
|
|
|
|
public long getId() {
|
|
return id;
|
|
}
|
|
|
|
public byte[] getKey() {
|
|
return key;
|
|
}
|
|
|
|
@Override
|
|
public int describeContents() {
|
|
return 0;
|
|
}
|
|
|
|
@Override
|
|
public void writeToParcel(Parcel dest, int flags) {
|
|
dest.writeString(contentType);
|
|
dest.writeLong(id);
|
|
dest.writeInt(this.key.length);
|
|
dest.writeByteArray(this.key);
|
|
}
|
|
}
|