From 1b44562d58af3b859e27fb2849550d6e2d7ba976 Mon Sep 17 00:00:00 2001 From: Hussein Kasem Date: Tue, 19 Feb 2019 19:13:48 +0100 Subject: [PATCH 1/4] Wrap trust_own_key copying trust_personal_key --- src/basic_api.cc | 17 +++++++++++++++++ src/pEp.yml2 | 1 + 2 files changed, 18 insertions(+) diff --git a/src/basic_api.cc b/src/basic_api.cc index b79a007..d4d379b 100644 --- a/src/basic_api.cc +++ b/src/basic_api.cc @@ -177,6 +177,23 @@ JNIEXPORT void JNICALL Java_org_pEp_jniadapter_Engine_trustPersonalKey( ::trust_personal_key(session, _ident); } +JNIEXPORT void JNICALL Java_org_pEp_jniadapter_Engine_trustOwnKey( + 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) { + throw_pEp_Exception(env, PEP_CANNOT_FIND_IDENTITY); + return; + } + + ::trust_own_key(session, _ident); +} + JNIEXPORT void JNICALL Java_org_pEp_jniadapter_Engine_importKey( JNIEnv *env, jobject obj, diff --git a/src/pEp.yml2 b/src/pEp.yml2 index 81e690b..564111b 100644 --- a/src/pEp.yml2 +++ b/src/pEp.yml2 @@ -266,6 +266,7 @@ namespace pEp { basic void keyMistrusted(identity ident); basic void keyResetTrust(identity ident); basic void trustPersonalKey(identity ident); + basic void trustOwnKey(identity ident); basic void importKey(string key); basic void blacklist_add(string fpr); basic void blacklist_delete(string fpr); From 4bf3216a8a9ac00c9fb0dc583f81dba27126f620 Mon Sep 17 00:00:00 2001 From: Hussein Kasem Date: Tue, 19 Feb 2019 21:20:51 +0100 Subject: [PATCH 2/4] Update engine revision --- android/src/org/pEp/jniadapter/AndroidHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/org/pEp/jniadapter/AndroidHelper.java b/android/src/org/pEp/jniadapter/AndroidHelper.java index 36b1256..79b710b 100644 --- a/android/src/org/pEp/jniadapter/AndroidHelper.java +++ b/android/src/org/pEp/jniadapter/AndroidHelper.java @@ -29,7 +29,7 @@ public class AndroidHelper { private static File tmpDir; // TODO : Increment when needed. - public static int ENGINE_VERSION_CODE = 3104; + public static int ENGINE_VERSION_CODE = 3293; private static File shareDir; From 66e31f81401ba266b0aab89660edcbc78c659202 Mon Sep 17 00:00:00 2001 From: Hussein Kasem Date: Fri, 22 Feb 2019 21:38:27 +0100 Subject: [PATCH 3/4] Update pEp status codes - Corresponding to engine 3293:a12a4f13d796 --- src/pEp.yml2 | 79 ++++++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 37 deletions(-) diff --git a/src/pEp.yml2 b/src/pEp.yml2 index 564111b..b77facc 100644 --- a/src/pEp.yml2 +++ b/src/pEp.yml2 @@ -8,31 +8,35 @@ decl basic @type @name; namespace pEp { exception Status { - pEp_status_ok > 0 + pEp_status_ok > 0 - pEp_init_cannot_load_gpgme > 0x0110 - pEp_init_gpgme_init_failed > 0x0111 - pEp_init_no_gpg_home > 0x0112 - pEp_init_netpgp_init_failed > 0x0113 + pEp_init_cannot_load_gpgme > 0x0110 + pEp_init_gpgme_init_failed > 0x0111 + pEp_init_no_gpg_home > 0x0112 + pEp_init_netpgp_init_failed > 0x0113 pEp_init_cannot_determine_gpg_version > 0x0114 pEp_init_unsupported_gpg_version > 0x0115 pEp_init_cannot_config_gpg_agent > 0x0116 - pEp_init_sqlite3_without_mutex > 0x0120 - pEp_init_cannot_open_db > 0x0121 - pEp_init_cannot_open_system_db > 0x0122 - - pEp_key_not_found > 0x0201 - pEp_key_has_ambig_name > 0x0202 - pEp_get_key_failed > 0x0203 + pEp_init_sqlite3_without_mutex > 0x0120 + pEp_init_cannot_open_db > 0x0121 + pEp_init_cannot_open_system_db > 0x0122 + + pEp_key_not_found > 0x0201 + pEp_key_has_ambig_name > 0x0202 + pEp_get_key_failed > 0x0203 pEp_cannot_export_key > 0x0204 pEp_cannot_edit_key > 0x0205 pEp_key_unsuitable > 0x0206 - - pEp_cannot_find_identity > 0x0301 - pEp_cannot_set_person > 0x0381 - pEp_cannot_set_pgp_keypair > 0x0382 - pEp_cannot_set_identity > 0x0383 + + pEp_key_imported > 0x0220 + pEp_no_key_imported > 0x0221 + pEp_key_import_status_unknown > 0x0222 + + pEp_cannot_find_identity > 0x0301 + pEp_cannot_set_person > 0x0381 + pEp_cannot_set_pgp_keypair > 0x0382 + pEp_cannot_set_identity > 0x0383 pEp_cannot_set_trust > 0x0384 pEp_key_blacklisted > 0x0385 pEp_cannot_find_person > 0x0386 @@ -40,19 +44,20 @@ namespace pEp { pEp_cannot_find_alias > 0x0391 pEp_cannot_set_alias > 0x0392 - pEp_unencrypted > 0x0400 - pEp_verified > 0x0401 - pEp_decrypted > 0x0402 - pEp_decrypted_and_verified > 0x0403 - pEp_decrypt_wrong_format > 0x0404 - pEp_decrypt_no_key > 0x0405 - pEp_decrypt_signature_does_not_match > 0x0406 + pEp_unencrypted > 0x0400 + pEp_verified > 0x0401 + pEp_decrypted > 0x0402 + pEp_decrypted_and_verified > 0x0403 + pEp_decrypt_wrong_format > 0x0404 + pEp_decrypt_no_key > 0x0405 + pEp_decrypt_signature_does_not_match > 0x0406 pEp_verify_no_key > 0x0407 pEp_verified_and_trusted > 0x0408 - pEp_cannot_decrypt_unknown > 0x04ff + pEp_cannot_reencrypt > 0x0409 + pEp_cannot_decrypt_unknown > 0x04ff - pEp_trustword_not_found > 0x0501 - pEp_trustwords_fpr_wrong_length > 0x0502 + pEp_trustword_not_found > 0x0501 + pEp_trustwords_fpr_wrong_length > 0x0502 pEp_trustwords_duplicate_fpr > 0x0503 pEp_cannot_create_key > 0x0601 @@ -60,15 +65,15 @@ namespace pEp { pEp_phrase_not_found > 0x0701 - pEp_send_function_not_registered                > 0x0801 - pEp_contraints_violated                         > 0x0802 - pEp_cannot_encode                               > 0x0803 + pEp_send_function_not_registered > 0x0801 + pEp_contraints_violated > 0x0802 + pEp_cannot_encode > 0x0803 - pEp_sync_no_notify_callback                  > 0x0901 - pEp_sync_illegal_message                        > 0x0902 - pEp_sync_no_inject_callback                     > 0x0903 + pEp_sync_no_notify_callback > 0x0901 + pEp_sync_illegal_message > 0x0902 + pEp_sync_no_inject_callback > 0x0903 - pEp_sequence_violated > 0x0970 + pEp_sequence_violated > 0x0970 pEp_cannot_increase_sequence > 0x0971 pEp_cannot_set_sequence_value > 0x0972 pEp_own_sequence > 0x097f @@ -81,7 +86,7 @@ namespace pEp { pEp_statemachine_invalid_action > 0x0985 pEp_statemachine_inhibited_event > 0x0986 - pEp_commit_failed > 0xff01 + pEp_commit_failed > 0xff01 pEp_message_consume > 0xff02 pEp_message_ignore > 0xff03 @@ -90,8 +95,8 @@ namespace pEp { pEp_cannot_create_temp_file > -5 pEp_illegal_value > -4 pEp_buffer_too_small > -3 - pEp_out_of_memory > -2 - pEp_unknown_error > -1 + pEp_out_of_memory > -2 + pEp_unknown_error > -1 pEp_version_mismatch > -7 From 0be65e6d8117497a74a479d5d46e19354b748155 Mon Sep 17 00:00:00 2001 From: Hussein Kasem Date: Fri, 22 Feb 2019 22:19:19 +0100 Subject: [PATCH 4/4] Add helper script to extract pEpEngine Status codes from pEpEngine.h --- utils/extract_pEp_status_codes_from_engine.sh | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 utils/extract_pEp_status_codes_from_engine.sh diff --git a/utils/extract_pEp_status_codes_from_engine.sh b/utils/extract_pEp_status_codes_from_engine.sh new file mode 100644 index 0000000..112d200 --- /dev/null +++ b/utils/extract_pEp_status_codes_from_engine.sh @@ -0,0 +1,47 @@ +################################################################################ +# Argument cheking # +################################################################################ + +if [ ! -f $1 ]; then + echo -e "\e[1m\e[31mInput file not found!\e[0m" +fi + +if [ -z "$2" ]; then + echo -e "\e[1m\e[31mNo output file supplied\e[0m" +fi + +if [ "$#" -ne 2 ]; then + echo "Expected use is: $0 input_file output_file" + exit 1 +fi + +################################################################################ +# Select GNU SED # +################################################################################ + +OS="$(uname -s)" + +case "${OS}" in + Linux*) SED=sed;; + Darwin*) SED=gsed;; + CYGWIN*) echo "UNSUPORTED YET" && exit;; + MINGW*) echo "UNSUPORTED YET" && exit;; + *) echo "UNKNOWN:${OS}" && exit;; +esac + +################################################################################ +# Transform input file PEP_STATUS to yml2 status # +################################################################################ + +$SED -n '/} PEP_STATUS/q;p' $1 > $2 +$SED -i -n '/STATUS_OK/,$p' $2 +$SED -i -e 's/\(.*\)/\L\1/' $2 +$SED -i "-e s/ pep/ pEp/g" $2 +$SED -i s/=/\>/g $2 +$SED -i s/,//g $2 + + +################################################################################ +# Show results # +################################################################################ +cat $2