Browse Source

Added trustPersonalKey keyResetTrust

JNI-44
Edouard Tisserant 10 years ago
parent
commit
1724f09296
  1. 8
      androidTests/app/src/main/java/com/pep/k9/MainActivity.java
  2. 48
      src/basic_api.cc
  3. 2
      src/pEp.yml2

8
androidTests/app/src/main/java/com/pep/k9/MainActivity.java

@ -501,9 +501,17 @@ public class MainActivity extends AppCompatActivity {
Engine.decrypt_message_Return result = null; Engine.decrypt_message_Return result = null;
result = e.decrypt_message(enc); result = e.decrypt_message(enc);
if(!(result.dst.getShortmsg().equals("hello, world"))) throw new AssertionError(); if(!(result.dst.getShortmsg().equals("hello, world"))) throw new AssertionError();
if(!(result.dst.getLongmsg().equals("this is a test"))) throw new AssertionError(); if(!(result.dst.getLongmsg().equals("this is a test"))) throw new AssertionError();
/* TODO
if(!(result.color.equals(Color.pEpRatingReliable))) throw new AssertionError();
e.trustPersonalKey(john);
e.keyResetTrust(john);
e.keyCompromized(john);
*/
ArrayList<Pair<String, String>> _pairs = result.dst.getOptFields(); ArrayList<Pair<String, String>> _pairs = result.dst.getOptFields();
/* FIXME ? /* FIXME ?
{ {

48
src/basic_api.cc

@ -96,6 +96,54 @@ JNIEXPORT void JNICALL Java_org_pEp_jniadapter_Engine_keyCompromized(
::key_compromized(session, _ident); ::key_compromized(session, _ident);
} }
JNIEXPORT void JNICALL Java_org_pEp_jniadapter_Engine_keyResetTrust(
JNIEnv *env,
jobject obj,
jobject ident
)
{
PEP_SESSION session = (PEP_SESSION) callLongMethod(env, obj, "getHandle");
pEp_identity *_ident = to_identity(env, ident);
if (_ident->fpr == NULL || _ident->fpr[0] == 0) {
if (_ident->me)
::myself(session, _ident);
else
::update_identity(session, _ident);
}
if (_ident->fpr == NULL || _ident->fpr[0] == 0) {
throw_pEp_Exception(env, PEP_CANNOT_FIND_IDENTITY);
return;
}
::key_reset_trust(session, _ident);
}
JNIEXPORT void JNICALL Java_org_pEp_jniadapter_Engine_trustPersonalKey(
JNIEnv *env,
jobject obj,
jobject ident
)
{
PEP_SESSION session = (PEP_SESSION) callLongMethod(env, obj, "getHandle");
pEp_identity *_ident = to_identity(env, ident);
if (_ident->fpr == NULL || _ident->fpr[0] == 0) {
if (_ident->me)
::myself(session, _ident);
else
::update_identity(session, _ident);
}
if (_ident->fpr == NULL || _ident->fpr[0] == 0) {
throw_pEp_Exception(env, PEP_CANNOT_FIND_IDENTITY);
return;
}
::trust_personal_key(session, _ident);
}
JNIEXPORT void JNICALL Java_org_pEp_jniadapter_Engine_importKey( JNIEXPORT void JNICALL Java_org_pEp_jniadapter_Engine_importKey(
JNIEnv *env, JNIEnv *env,
jobject obj, jobject obj,

2
src/pEp.yml2

@ -92,6 +92,8 @@ namespace pEp {
basic identity myself(identity ident); basic identity myself(identity ident);
basic identity updateIdentity(identity ident); basic identity updateIdentity(identity ident);
basic void keyCompromized(identity ident); basic void keyCompromized(identity ident);
basic void keyResetTrust(identity ident);
basic void trustPersonalKey(identity ident);
basic void importKey(string key); basic void importKey(string key);
}; };

Loading…
Cancel
Save