mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
Added JNI wrapper for TLS certificate/key related methods in LinphoneCore and LinphoneAuthInfo
This commit is contained in:
parent
f575f94bb4
commit
38ad727c61
5 changed files with 321 additions and 1 deletions
|
|
@ -2995,6 +2995,74 @@ JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_getHa1
|
|||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_setTlsCertificate
|
||||
(JNIEnv *env, jobject, jlong auth_info, jstring jcert) {
|
||||
const char* cert = GetStringUTFChars(env, jcert);
|
||||
linphone_auth_info_set_tls_cert((LinphoneAuthInfo*)auth_info,cert);
|
||||
ReleaseStringUTFChars(env, jcert, cert);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_setTlsKey
|
||||
(JNIEnv *env, jobject, jlong auth_info, jstring jkey) {
|
||||
const char* key = GetStringUTFChars(env, jkey);
|
||||
linphone_auth_info_set_tls_key((LinphoneAuthInfo*)auth_info,key);
|
||||
ReleaseStringUTFChars(env, jkey, key);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_setTlsCertificatePath
|
||||
(JNIEnv *env, jobject, jlong auth_info, jstring jpath) {
|
||||
const char* path = GetStringUTFChars(env, jpath);
|
||||
linphone_auth_info_set_tls_cert_path((LinphoneAuthInfo*)auth_info,path);
|
||||
ReleaseStringUTFChars(env, jpath, path);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_setTlsKeyPath
|
||||
(JNIEnv *env, jobject, jlong auth_info, jstring jpath) {
|
||||
const char* path = GetStringUTFChars(env, jpath);
|
||||
linphone_auth_info_set_tls_key_path((LinphoneAuthInfo*)auth_info,path);
|
||||
ReleaseStringUTFChars(env, jpath, path);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_getTlsCertificate
|
||||
(JNIEnv *env , jobject, jlong auth_info) {
|
||||
const char* cert = linphone_auth_info_get_tls_cert((LinphoneAuthInfo*)auth_info);
|
||||
if (cert) {
|
||||
return env->NewStringUTF(cert);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_getTlsKey
|
||||
(JNIEnv *env , jobject, jlong auth_info) {
|
||||
const char* key = linphone_auth_info_get_tls_key((LinphoneAuthInfo*)auth_info);
|
||||
if (key) {
|
||||
return env->NewStringUTF(key);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_getTlsCertificatePath
|
||||
(JNIEnv *env , jobject, jlong auth_info) {
|
||||
const char* path = linphone_auth_info_get_tls_cert_path((LinphoneAuthInfo*)auth_info);
|
||||
if (path) {
|
||||
return env->NewStringUTF(path);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_linphone_core_LinphoneAuthInfoImpl_getTlsKeyPath
|
||||
(JNIEnv *env , jobject, jlong auth_info) {
|
||||
const char* path = linphone_auth_info_get_tls_key_path((LinphoneAuthInfo*)auth_info);
|
||||
if (path) {
|
||||
return env->NewStringUTF(path);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//LinphoneAddress
|
||||
|
||||
|
|
@ -8200,4 +8268,64 @@ extern "C" jobject Java_org_linphone_core_LinphoneAccountCreatorImpl_configure(J
|
|||
LinphoneCoreVTable *table = linphone_core_get_current_vtable(lc);
|
||||
LinphoneCoreData* lcData = (LinphoneCoreData*)linphone_core_v_table_get_user_data(table);
|
||||
return getProxy(env, lpc, lcData->core);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setTlsCertificate(JNIEnv *env, jobject thiz, jlong lc, jstring jcert) {
|
||||
const char* cert = GetStringUTFChars(env, jcert);
|
||||
linphone_core_set_tls_cert((LinphoneCore*)lc, cert);
|
||||
ReleaseStringUTFChars(env, jcert, cert);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setTlsKey(JNIEnv *env, jobject, jlong lc, jstring jkey) {
|
||||
const char* key = GetStringUTFChars(env, jkey);
|
||||
linphone_core_set_tls_key((LinphoneCore*)lc, key);
|
||||
ReleaseStringUTFChars(env, jkey, key);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setTlsCertificatePath(JNIEnv *env, jobject, jlong lc, jstring jpath) {
|
||||
const char* path = GetStringUTFChars(env, jpath);
|
||||
linphone_core_set_tls_cert_path((LinphoneCore*)lc, path);
|
||||
ReleaseStringUTFChars(env, jpath, path);
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setTlsKeyPath(JNIEnv *env, jobject, jlong lc, jstring jpath) {
|
||||
const char* path = GetStringUTFChars(env, jpath);
|
||||
linphone_core_set_tls_key_path((LinphoneCore*)lc, path);
|
||||
ReleaseStringUTFChars(env, jpath, path);
|
||||
}
|
||||
|
||||
extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getTlsCertificate(JNIEnv *env , jobject, jlong lc) {
|
||||
const char* cert = linphone_core_get_tls_cert((LinphoneCore*)lc);
|
||||
if (cert) {
|
||||
return env->NewStringUTF(cert);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getTlsKey(JNIEnv *env , jobject, jlong lc) {
|
||||
const char* key = linphone_core_get_tls_key((LinphoneCore*)lc);
|
||||
if (key) {
|
||||
return env->NewStringUTF(key);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getTlsCertificatePath(JNIEnv *env , jobject, jlong lc) {
|
||||
const char* path = linphone_core_get_tls_cert_path((LinphoneCore*)lc);
|
||||
if (path) {
|
||||
return env->NewStringUTF(path);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getTlsKeyPath(JNIEnv *env , jobject, jlong lc) {
|
||||
const char* path = linphone_core_get_tls_key_path((LinphoneCore*)lc);
|
||||
if (path) {
|
||||
return env->NewStringUTF(path);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -100,6 +100,54 @@ public interface LinphoneAuthInfo {
|
|||
* @return the clone auth info
|
||||
*/
|
||||
LinphoneAuthInfo clone();
|
||||
|
||||
/**
|
||||
* Gets the TLS certificate
|
||||
* @return the TLS certificate
|
||||
*/
|
||||
String getTlsCertificate();
|
||||
|
||||
/**
|
||||
* Gets the TLS key file
|
||||
* @return the TLS key
|
||||
*/
|
||||
String getTlsKey();
|
||||
|
||||
/**
|
||||
* Gets the path to the TLS certificate file
|
||||
* @return the path to the TLS certificate
|
||||
*/
|
||||
String getTlsCertificatePath();
|
||||
|
||||
/**
|
||||
* Gets the path to the TLS key file
|
||||
* @return the path to the TLS key
|
||||
*/
|
||||
String getTlsKeyPath();
|
||||
|
||||
/**
|
||||
* Sets the TLS certificate
|
||||
* @param cert the certificate
|
||||
*/
|
||||
void setTlsCertificate(String cert);
|
||||
|
||||
/**
|
||||
* Sets the TLS key
|
||||
* @param key the key
|
||||
*/
|
||||
void setTlsKey(String key);
|
||||
|
||||
/**
|
||||
* Sets the TLS certificate file path
|
||||
* @param path the path of the certificate
|
||||
*/
|
||||
void setTlsCertificatePath(String path);
|
||||
|
||||
/**
|
||||
* Sets the TLS key file path
|
||||
* @param path the path of the key
|
||||
*/
|
||||
void setTlsKeyPath(String path);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2448,4 +2448,52 @@ public interface LinphoneCore {
|
|||
public void setLimeEncryption(LinphoneLimeState lime);
|
||||
|
||||
public LinphoneLimeState getLimeEncryption();
|
||||
|
||||
/**
|
||||
* Gets the TLS certificate
|
||||
* @return the TLS certificate
|
||||
*/
|
||||
public String getTlsCertificate();
|
||||
|
||||
/**
|
||||
* Gets the TLS key file
|
||||
* @return the TLS key
|
||||
*/
|
||||
public String getTlsKey();
|
||||
|
||||
/**
|
||||
* Gets the path to the TLS certificate file
|
||||
* @return the path to the TLS certificate
|
||||
*/
|
||||
public String getTlsCertificatePath();
|
||||
|
||||
/**
|
||||
* Gets the path to the TLS key file
|
||||
* @return the path to the TLS key
|
||||
*/
|
||||
public String getTlsKeyPath();
|
||||
|
||||
/**
|
||||
* Sets the TLS certificate
|
||||
* @param cert the certificate
|
||||
*/
|
||||
public void setTlsCertificate(String cert);
|
||||
|
||||
/**
|
||||
* Sets the TLS key
|
||||
* @param key the key
|
||||
*/
|
||||
public void setTlsKey(String key);
|
||||
|
||||
/**
|
||||
* Sets the TLS certificate file path
|
||||
* @param path the path of the certificate
|
||||
*/
|
||||
public void setTlsCertificatePath(String path);
|
||||
|
||||
/**
|
||||
* Sets the TLS key file path
|
||||
* @param path the path of the key
|
||||
*/
|
||||
public void setTlsKeyPath(String path);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,10 +30,18 @@ class LinphoneAuthInfoImpl implements LinphoneAuthInfo {
|
|||
private native void setUsername(long ptr, String username);
|
||||
private native void setUserId(long ptr, String username);
|
||||
private native void setHa1(long ptr, String ha1);
|
||||
private native void setDomain(long ptr, String domain);
|
||||
private native void setTlsCertificate(long ptr, String cert);
|
||||
private native void setTlsKey(long ptr, String key);
|
||||
private native void setTlsCertificatePath(long ptr, String path);
|
||||
private native void setTlsKeyPath(long ptr, String path);
|
||||
private native String getUserId(long ptr);
|
||||
private native String getHa1(long ptr);
|
||||
private native String getDomain(long ptr);
|
||||
private native void setDomain(long ptr, String domain);
|
||||
private native String getTlsCertificate(long ptr);
|
||||
private native String getTlsKey(long ptr);
|
||||
private native String getTlsCertificatePath(long ptr);
|
||||
private native String getTlsKeyPath(long ptr);
|
||||
|
||||
boolean ownPtr = false;
|
||||
protected LinphoneAuthInfoImpl(String username,String password, String realm, String domain) {
|
||||
|
|
@ -111,4 +119,44 @@ class LinphoneAuthInfoImpl implements LinphoneAuthInfo {
|
|||
getDomain());
|
||||
return clone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTlsCertificate() {
|
||||
return getTlsCertificate(nativePtr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTlsKey() {
|
||||
return getTlsKey(nativePtr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTlsCertificatePath() {
|
||||
return getTlsCertificatePath(nativePtr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTlsKeyPath() {
|
||||
return getTlsKeyPath(nativePtr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTlsCertificate(String cert) {
|
||||
setTlsCertificate(nativePtr, cert);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTlsKey(String key) {
|
||||
setTlsKey(nativePtr, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTlsCertificatePath(String path) {
|
||||
setTlsCertificatePath(nativePtr, path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTlsKeyPath(String path) {
|
||||
setTlsKeyPath(nativePtr, path);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1726,4 +1726,52 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
public synchronized LinphoneLimeState getLimeEncryption() {
|
||||
return LinphoneLimeState.fromInt(getLimeEncryption(nativePtr));
|
||||
}
|
||||
|
||||
private native String getTlsCertificate(long ptr);
|
||||
@Override
|
||||
public String getTlsCertificate() {
|
||||
return getTlsCertificate(nativePtr);
|
||||
}
|
||||
|
||||
private native String getTlsKey(long ptr);
|
||||
@Override
|
||||
public String getTlsKey() {
|
||||
return getTlsKey(nativePtr);
|
||||
}
|
||||
|
||||
private native String getTlsCertificatePath(long ptr);
|
||||
@Override
|
||||
public String getTlsCertificatePath() {
|
||||
return getTlsCertificatePath(nativePtr);
|
||||
}
|
||||
|
||||
private native String getTlsKeyPath(long ptr);
|
||||
@Override
|
||||
public String getTlsKeyPath() {
|
||||
return getTlsKeyPath(nativePtr);
|
||||
}
|
||||
|
||||
private native void setTlsCertificate(long ptr, String cert);
|
||||
@Override
|
||||
public void setTlsCertificate(String cert) {
|
||||
setTlsCertificate(nativePtr, cert);
|
||||
}
|
||||
|
||||
private native void setTlsKey(long ptr, String key);
|
||||
@Override
|
||||
public void setTlsKey(String key) {
|
||||
setTlsKey(nativePtr, key);
|
||||
}
|
||||
|
||||
private native void setTlsCertificatePath(long ptr, String path);
|
||||
@Override
|
||||
public void setTlsCertificatePath(String path) {
|
||||
setTlsCertificatePath(nativePtr, path);
|
||||
}
|
||||
|
||||
private native void setTlsKeyPath(long ptr, String path);
|
||||
@Override
|
||||
public void setTlsKeyPath(String path) {
|
||||
setTlsKeyPath(nativePtr, path);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue