Browse Source

config_passphrase_for_new_keys() using cache.add_stored()

JNI-111
heck 5 years ago
parent
commit
41d8232be2
  1. 29
      src/basic_api.cc
  2. 5
      src/pEp.yml2

29
src/basic_api.cc

@ -497,5 +497,34 @@ JNIEXPORT void JNICALL Java_foundation_pEp_jniadapter_Engine__1config_1passphras
}
}
JNIEXPORT void JNICALL Java_foundation_pEp_jniadapter_Engine__1config_1passphrase_1for_1new_1keys(
JNIEnv *env,
jobject obj,
jboolean enable,
jbyteArray passphrase
)
{
std::mutex *mutex_local = nullptr;
{
std::lock_guard<std::mutex> l(global_mutex);
pEpLog("called with lock_guard");
mutex_local = get_engine_java_object_mutex(env, obj);
}
std::lock_guard<std::mutex> l(*mutex_local);
bool _enable = (bool) enable;
const char *_passphrase = to_string(env, passphrase);
PEP_STATUS status = ::config_passphrase_for_new_keys(session(),_enable,cache.add_stored(_passphrase));
if ((status > PEP_STATUS_OK && status < PEP_UNENCRYPTED) ||
status < PEP_STATUS_OK ||
status >= PEP_TRUSTWORD_NOT_FOUND) {
throw_pEp_Exception(env, status);
return ;
}
}
} // extern "C"

5
src/pEp.yml2

@ -241,10 +241,6 @@ namespace pEp {
in CipherSuite suite
);
method config_passphrase_for_new_keys(
in bool enable,
in string passphrase
);
// "basic" methods are generated on the java side, but
// on the C++ side, manually implemented in basic_api.cc
@ -267,6 +263,7 @@ namespace pEp {
basic string getUserDirectory();
basic string getMachineDirectory();
basic void config_passphrase(string passphrase);
basic void config_passphrase_for_new_keys(bool enable, string passphrase);
};
struct message {

Loading…
Cancel
Save