diff --git a/android/olm-sdk/src/main/java/org/matrix/olm/OlmInboundGroupSession.java b/android/olm-sdk/src/main/java/org/matrix/olm/OlmInboundGroupSession.java
index 2fc81ef..4397ed4 100644
--- a/android/olm-sdk/src/main/java/org/matrix/olm/OlmInboundGroupSession.java
+++ b/android/olm-sdk/src/main/java/org/matrix/olm/OlmInboundGroupSession.java
@@ -369,4 +369,29 @@ public class OlmInboundGroupSession extends CommonSerializeUtils implements Seri
* @return the deserialized session
**/
private native long deserializeJni(byte[] aSerializedData, byte[] aKey);
+
+ /**
+ * Return a pickled inbound group session as a bytes buffer.
+ * The session is serialized and encrypted with aKey.
+ * In case of failure, an error human readable
+ * description is provide in aErrorMsg.
+ * @param aKey encryption key
+ * @param aErrorMsg error message description
+ * @return the pickled inbound group session as bytes buffer
+ */
+ public byte[] pickle(byte[] aKey, StringBuffer aErrorMsg) {
+ return serialize(aKey, aErrorMsg);
+ }
+
+ /**
+ * Loads an inbound group session from a pickled bytes buffer.
+ * See {@link #serialize(byte[], StringBuffer)}
+ * @param aSerializedData bytes buffer
+ * @param aKey key used to encrypted
+ * @exception Exception the exception
+ */
+ public void unpickle(byte[] aSerializedData, byte[] aKey) throws Exception {
+ deserialize(aSerializedData, aKey);
+ }
+
}
diff --git a/android/olm-sdk/src/main/java/org/matrix/olm/OlmOutboundGroupSession.java b/android/olm-sdk/src/main/java/org/matrix/olm/OlmOutboundGroupSession.java
index 55732fe..fa9f7a4 100644
--- a/android/olm-sdk/src/main/java/org/matrix/olm/OlmOutboundGroupSession.java
+++ b/android/olm-sdk/src/main/java/org/matrix/olm/OlmOutboundGroupSession.java
@@ -293,4 +293,28 @@ public class OlmOutboundGroupSession extends CommonSerializeUtils implements Ser
**/
private native long deserializeJni(byte[] aSerializedData, byte[] aKey);
+ /**
+ * Return a pickled outbound group session as a bytes buffer.
+ * The session is serialized and encrypted with aKey.
+ * In case of failure, an error human readable
+ * description is provide in aErrorMsg.
+ * @param aKey encryption key
+ * @param aErrorMsg error message description
+ * @return the pickled outbound group session as bytes buffer
+ */
+ public byte[] pickle(byte[] aKey, StringBuffer aErrorMsg) {
+ return serialize(aKey, aErrorMsg);
+ }
+
+ /**
+ * Loads an outbound group session from a pickled bytes buffer.
+ * See {@link #serialize(byte[], StringBuffer)}
+ * @param aSerializedData bytes buffer
+ * @param aKey key used to encrypted
+ * @exception Exception the exception
+ */
+ public void unpickle(byte[] aSerializedData, byte[] aKey) throws Exception {
+ deserialize(aSerializedData, aKey);
+ }
+
}
diff --git a/android/olm-sdk/src/main/java/org/matrix/olm/OlmSession.java b/android/olm-sdk/src/main/java/org/matrix/olm/OlmSession.java
index 5669ba1..0e22a80 100644
--- a/android/olm-sdk/src/main/java/org/matrix/olm/OlmSession.java
+++ b/android/olm-sdk/src/main/java/org/matrix/olm/OlmSession.java
@@ -465,5 +465,30 @@ public class OlmSession extends CommonSerializeUtils implements Serializable {
* @return the deserialized session
**/
private native long deserializeJni(byte[] aSerializedData, byte[] aKey);
+
+ /**
+ * Return a pickled session as a bytes buffer.
+ * The session is serialized and encrypted with aKey.
+ * In case of failure, an error human readable
+ * description is provide in aErrorMsg.
+ * @param aKey encryption key
+ * @param aErrorMsg error message description
+ * @return the pickled session as bytes buffer
+ */
+ public byte[] pickle(byte[] aKey, StringBuffer aErrorMsg) {
+ return serialize(aKey, aErrorMsg);
+ }
+
+ /**
+ * Loads a session from a pickled bytes buffer.
+ * See {@link #serialize(byte[], StringBuffer)}
+ * @param aSerializedData bytes buffer
+ * @param aKey key used to encrypted
+ * @exception Exception the exception
+ */
+ public void unpickle(byte[] aSerializedData, byte[] aKey) throws Exception {
+ deserialize(aSerializedData, aKey);
+ }
+
}