aboutsummaryrefslogtreecommitdiff
path: root/android/olm-sdk/src/main/java/org/matrix
diff options
context:
space:
mode:
authorValere <valeref@matrix.org>2019-04-10 11:26:58 +0200
committerValere <valeref@matrix.org>2019-04-10 12:24:00 +0200
commiteb7347bb524b830c1458d64411cd56fc58ad5b91 (patch)
treeb167ff5e145c66bc3ebea2f9db9f04183cc1b2ea /android/olm-sdk/src/main/java/org/matrix
parent16a28f297c8d8f782131575c02854904b424eb82 (diff)
Return string instead of byte array for b64 encoded data
Diffstat (limited to 'android/olm-sdk/src/main/java/org/matrix')
-rw-r--r--android/olm-sdk/src/main/java/org/matrix/olm/OlmSAS.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/android/olm-sdk/src/main/java/org/matrix/olm/OlmSAS.java b/android/olm-sdk/src/main/java/org/matrix/olm/OlmSAS.java
index 70cfb8c..4bd1579 100644
--- a/android/olm-sdk/src/main/java/org/matrix/olm/OlmSAS.java
+++ b/android/olm-sdk/src/main/java/org/matrix/olm/OlmSAS.java
@@ -86,8 +86,7 @@ public class OlmSAS {
throw new OlmException(OlmException.EXCEPTION_CODE_SAS_MISSING_THEIR_PKEY, "call setTheirPublicKey first");
}
try {
- byte[] shortBuffer = generateShortCodeJni(info.getBytes("UTF-8"), byteNumber);
- return shortBuffer;
+ return generateShortCodeJni(info.getBytes("UTF-8"), byteNumber);
} catch (Exception e) {
Log.e(LOG_TAG, "## sessionIdentifier(): " + e.getMessage());
throw new OlmException(OlmException.EXCEPTION_CODE_SAS_GENERATE_SHORT_CODE, e.getMessage());
@@ -95,20 +94,24 @@ public class OlmSAS {
}
- public byte[] calculateMac(String message, String info) throws OlmException {
+ public String calculateMac(String message, String info) throws OlmException {
try {
- return calculateMacJni(message.getBytes("UTF-8"), info.getBytes("UTF-8"));
+ byte[] bytes = calculateMacJni(message.getBytes("UTF-8"), info.getBytes("UTF-8"));
+ if (bytes != null) return new String(bytes, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new OlmException(OlmException.EXCEPTION_CODE_SAS_ERROR, e.getMessage());
}
+ return null;
}
- public byte[] calculateMacLongKdf(String message, String info) throws OlmException {
+ public String calculateMacLongKdf(String message, String info) throws OlmException {
try {
- return calculateMacLongKdfJni(message.getBytes("UTF-8"), info.getBytes("UTF-8"));
+ byte[] bytes = calculateMacLongKdfJni(message.getBytes("UTF-8"), info.getBytes("UTF-8"));
+ if (bytes != null) return new String(bytes, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new OlmException(OlmException.EXCEPTION_CODE_SAS_ERROR, e.getMessage());
}
+ return null;
}
/**