Add public pickle/unpickle methods to java bindings
This commit is contained in:
parent
b5dfa28f3b
commit
0a6a5a5caf
3 changed files with 74 additions and 0 deletions
|
@ -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.<br>
|
||||
* 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.<br>
|
||||
* 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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.<br>
|
||||
* 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.<br>
|
||||
* 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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.<br>
|
||||
* 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.<br>
|
||||
* 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue