Commit 9acfd179 authored by Hubert Chathi's avatar Hubert Chathi

expose the private key length in the Android sdk

parent b79590e4
......@@ -116,6 +116,8 @@ public class OlmPkTest {
(byte)0x1D, (byte)0xB9, (byte)0x2C, (byte)0x2A
};
assertTrue(privateKey.length == OlmPkDecryption.privateKeyLength());
try {
mOlmPkDecryption.setPrivateKey(privateKey);
} catch (OlmException e) {
......
......@@ -51,6 +51,8 @@ public class OlmPkDecryption {
return (0 == mNativeId);
}
public static native int privateKeyLength();
public String setPrivateKey(byte[] privateKey) throws OlmException {
try {
byte[] key = setPrivateKeyJni(privateKey);
......
......@@ -364,6 +364,11 @@ JNIEXPORT void OLM_PK_DECRYPTION_FUNC_DEF(releasePkDecryptionJni)(JNIEnv *env, j
}
}
JNIEXPORT jint OLM_PK_DECRYPTION_FUNC_DEF(privateKeyLength)(JNIEnv *env, jobject thiz)
{
return (jint) olm_pk_private_key_length();
}
JNIEXPORT jbyteArray OLM_PK_DECRYPTION_FUNC_DEF(setPrivateKeyJni)(JNIEnv *env, jobject thiz, jbyteArray key)
{
jbyteArray publicKeyRet = 0;
......
......@@ -35,6 +35,7 @@ JNIEXPORT jbyteArray OLM_PK_ENCRYPTION_FUNC_DEF(encryptJni)(JNIEnv *env, jobject
JNIEXPORT jlong OLM_PK_DECRYPTION_FUNC_DEF(createNewPkDecryptionJni)(JNIEnv *env, jobject thiz);
JNIEXPORT void OLM_PK_DECRYPTION_FUNC_DEF(releasePkDecryptionJni)(JNIEnv *env, jobject thiz);
JNIEXPORT jint OLM_PK_DECRYPTION_FUNC_DEF(privateKeyLength)(JNIEnv *env, jobject thiz);
JNIEXPORT jbyteArray OLM_PK_DECRYPTION_FUNC_DEF(setPrivateKeyJni)(JNIEnv *env, jobject thiz, jbyteArray key);
JNIEXPORT jbyteArray OLM_PK_DECRYPTION_FUNC_DEF(generateKeyJni)(JNIEnv *env, jobject thiz);
JNIEXPORT jbyteArray OLM_PK_DECRYPTION_FUNC_DEF(privateKeyJni)(JNIEnv *env, jobject thiz);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment