merge default IOS-1832
authorDirk Zimmermann <dz@pep.security>
Mon, 23 Sep 2019 12:15:07 +0200
branchIOS-1832
changeset 1278f25c9ee1caf2
parent 1249 0af2dd841b05
parent 1277 033a160c0602
child 1279 6a29ef5b4008
merge default
     1.1 --- a/pEpObjCAdapter/NSError+PEP.m	Fri Sep 20 07:06:18 2019 +0200
     1.2 +++ b/pEpObjCAdapter/NSError+PEP.m	Mon Sep 23 12:15:07 2019 +0200
     1.3 @@ -11,6 +11,8 @@
     1.4  #import "NSError+PEP.h"
     1.5  #import "NSError+PEP+Internal.h"
     1.6  
     1.7 +#import "status_to_string.h"
     1.8 +
     1.9  static NSString *s_pEpAdapterDomain = @"security.pEp.ObjCAdapter";
    1.10  
    1.11  @implementation NSError (Extension)
    1.12 @@ -70,90 +72,8 @@
    1.13  }
    1.14  
    1.15  NSString * _Nonnull stringFromPEPStatus(PEP_STATUS status) {
    1.16 -    switch (status) {
    1.17 -        case PEP_STATUS_OK: return @"PEP_STATUS_OK";
    1.18 -        case PEP_INIT_CANNOT_LOAD_GPGME: return @"PEP_INIT_CANNOT_LOAD_GPGME";
    1.19 -        case PEP_INIT_GPGME_INIT_FAILED: return @"PEP_INIT_GPGME_INIT_FAILED";
    1.20 -        case PEP_INIT_NO_GPG_HOME: return @"PEP_INIT_NO_GPG_HOME";
    1.21 -        case PEP_INIT_NETPGP_INIT_FAILED: return @"PEP_INIT_NETPGP_INIT_FAILED";
    1.22 -        case PEP_INIT_CANNOT_DETERMINE_GPG_VERSION: return @"PEP_INIT_CANNOT_DETERMINE_GPG_VERSION";
    1.23 -        case PEP_INIT_UNSUPPORTED_GPG_VERSION: return @"PEP_INIT_UNSUPPORTED_GPG_VERSION";
    1.24 -        case PEP_INIT_CANNOT_CONFIG_GPG_AGENT: return @"PEP_INIT_CANNOT_CONFIG_GPG_AGENT";
    1.25 -        case PEP_INIT_SQLITE3_WITHOUT_MUTEX: return @"PEP_INIT_SQLITE3_WITHOUT_MUTEX";
    1.26 -        case PEP_INIT_CANNOT_OPEN_DB: return @"PEP_INIT_CANNOT_OPEN_DB";
    1.27 -        case PEP_INIT_CANNOT_OPEN_SYSTEM_DB: return @"PEP_INIT_CANNOT_OPEN_SYSTEM_DB";
    1.28 -        case PEP_KEY_NOT_FOUND: return @"PEP_KEY_NOT_FOUND";
    1.29 -        case PEP_KEY_HAS_AMBIG_NAME: return @"PEP_KEY_HAS_AMBIG_NAME";
    1.30 -        case PEP_GET_KEY_FAILED: return @"PEP_GET_KEY_FAILED";
    1.31 -        case PEP_CANNOT_EXPORT_KEY: return @"PEP_CANNOT_EXPORT_KEY";
    1.32 -        case PEP_CANNOT_EDIT_KEY: return @"PEP_CANNOT_EDIT_KEY";
    1.33 -        case PEP_KEY_UNSUITABLE: return @"PEP_KEY_UNSUITABLE";
    1.34 -        case PEP_CANNOT_FIND_IDENTITY: return @"PEP_CANNOT_FIND_IDENTITY";
    1.35 -        case PEP_CANNOT_SET_PERSON: return @"PEP_CANNOT_SET_PERSON";
    1.36 -        case PEP_CANNOT_SET_PGP_KEYPAIR: return @"PEP_CANNOT_SET_PGP_KEYPAIR";
    1.37 -        case PEP_CANNOT_SET_IDENTITY: return @"PEP_CANNOT_SET_IDENTITY";
    1.38 -        case PEP_CANNOT_SET_TRUST: return @"PEP_CANNOT_SET_TRUST";
    1.39 -        case PEP_KEY_BLACKLISTED: return @"PEP_KEY_BLACKLISTED";
    1.40 -        case PEP_CANNOT_FIND_PERSON: return @"PEP_CANNOT_FIND_PERSON";
    1.41 -        case PEP_CANNOT_FIND_ALIAS: return @"PEP_CANNOT_FIND_ALIAS";
    1.42 -        case PEP_CANNOT_SET_ALIAS: return @"PEP_CANNOT_SET_ALIAS";
    1.43 -        case PEP_UNENCRYPTED: return @"PEP_UNENCRYPTED";
    1.44 -        case PEP_VERIFIED: return @"PEP_VERIFIED";
    1.45 -        case PEP_DECRYPTED: return @"PEP_DECRYPTED";
    1.46 -        case PEP_DECRYPTED_AND_VERIFIED: return @"PEP_DECRYPTED_AND_VERIFIED";
    1.47 -        case PEP_DECRYPT_WRONG_FORMAT: return @"PEP_DECRYPT_WRONG_FORMAT";
    1.48 -        case PEP_DECRYPT_NO_KEY: return @"PEP_DECRYPT_NO_KEY";
    1.49 -        case PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH: return @"PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH";
    1.50 -        case PEP_VERIFY_NO_KEY: return @"PEP_VERIFY_NO_KEY";
    1.51 -        case PEP_VERIFIED_AND_TRUSTED: return @"PEP_VERIFIED_AND_TRUSTED";
    1.52 -        case PEP_CANNOT_DECRYPT_UNKNOWN: return @"PEP_CANNOT_DECRYPT_UNKNOWN";
    1.53 -        case PEP_TRUSTWORD_NOT_FOUND: return @"PEP_TRUSTWORD_NOT_FOUND";
    1.54 -        case PEP_TRUSTWORDS_FPR_WRONG_LENGTH: return @"PEP_TRUSTWORDS_FPR_WRONG_LENGTH";
    1.55 -        case PEP_TRUSTWORDS_DUPLICATE_FPR: return @"PEP_TRUSTWORDS_DUPLICATE_FPR";
    1.56 -        case PEP_CANNOT_CREATE_KEY: return @"PEP_CANNOT_CREATE_KEY";
    1.57 -        case PEP_CANNOT_SEND_KEY: return @"PEP_CANNOT_SEND_KEY";
    1.58 -        case PEP_PHRASE_NOT_FOUND: return @"PEP_PHRASE_NOT_FOUND";
    1.59 -        case PEP_SEND_FUNCTION_NOT_REGISTERED: return @"PEP_SEND_FUNCTION_NOT_REGISTERED";
    1.60 -        case PEP_CONTRAINTS_VIOLATED: return @"PEP_CONTRAINTS_VIOLATED";
    1.61 -        case PEP_CANNOT_ENCODE: return @"PEP_CANNOT_ENCODE";
    1.62 -        case PEP_SYNC_NO_NOTIFY_CALLBACK: return @"PEP_SYNC_NO_NOTIFY_CALLBACK";
    1.63 -        case PEP_SYNC_ILLEGAL_MESSAGE: return @"PEP_SYNC_ILLEGAL_MESSAGE";
    1.64 -        case PEP_SYNC_NO_INJECT_CALLBACK: return @"PEP_SYNC_NO_INJECT_CALLBACK";
    1.65 -        case PEP_CANNOT_INCREASE_SEQUENCE: return @"PEP_CANNOT_INCREASE_SEQUENCE";
    1.66 -        case PEP_STATEMACHINE_INVALID_STATE: return @"PEP_STATEMACHINE_INVALID_STATE";
    1.67 -        case PEP_STATEMACHINE_INVALID_EVENT: return @"PEP_STATEMACHINE_INVALID_EVENT";
    1.68 -        case PEP_STATEMACHINE_INVALID_CONDITION: return @"PEP_STATEMACHINE_INVALID_CONDITION";
    1.69 -        case PEP_STATEMACHINE_INVALID_ACTION: return @"PEP_STATEMACHINE_INVALID_ACTION";
    1.70 -        case PEP_STATEMACHINE_INHIBITED_EVENT: return @"PEP_STATEMACHINE_INHIBITED_EVENT";
    1.71 -        case PEP_COMMIT_FAILED: return @"PEP_COMMIT_FAILED";
    1.72 -        case PEP_MESSAGE_CONSUME: return @"PEP_MESSAGE_CONSUME";
    1.73 -        case PEP_MESSAGE_IGNORE: return @"PEP_MESSAGE_IGNORE";
    1.74 -        case PEP_RECORD_NOT_FOUND: return @"PEP_RECORD_NOT_FOUND";
    1.75 -        case PEP_CANNOT_CREATE_TEMP_FILE: return @"PEP_CANNOT_CREATE_TEMP_FILE";
    1.76 -        case PEP_ILLEGAL_VALUE: return @"PEP_ILLEGAL_VALUE";
    1.77 -        case PEP_BUFFER_TOO_SMALL: return @"PEP_BUFFER_TOO_SMALL";
    1.78 -        case PEP_OUT_OF_MEMORY: return @"PEP_OUT_OF_MEMORY";
    1.79 -        case PEP_UNKNOWN_ERROR: return @"PEP_UNKNOWN_ERROR";
    1.80 -        case PEP_VERSION_MISMATCH: return @"PEP_VERSION_MISMATCH";
    1.81 -        case PEP_CANNOT_REENCRYPT: return @"PEP_CANNOT_REENCRYPT";
    1.82 -        case PEP_UNKNOWN_DB_ERROR: return @"PEP_UNKNOWN_DB_ERROR";
    1.83 -        case PEP_MALFORMED_KEY_RESET_MSG: return @"PEP_MALFORMED_KEY_RESET_MSG";
    1.84 -        case PEP_KEY_NOT_RESET: return @"PEP_KEY_NOT_RESET";
    1.85 -        case PEP_KEY_IMPORTED: return @"PEP_KEY_IMPORTED";
    1.86 -        case PEP_NO_KEY_IMPORTED: return @"PEP_NO_KEY_IMPORTED";
    1.87 -        case PEP_KEY_IMPORT_STATUS_UNKNOWN: return @"PEP_KEY_IMPORT_STATUS_UNKNOWN";
    1.88 -        case PEP_SYNC_NO_CHANNEL: return @"PEP_SYNC_NO_CHANNEL";
    1.89 -        case PEP_SYNC_CANNOT_ENCRYPT: return @"PEP_SYNC_CANNOT_ENCRYPT";
    1.90 -        case PEP_SYNC_NO_MESSAGE_SEND_CALLBACK: return @"PEP_SYNC_NO_MESSAGE_SEND_CALLBACK";
    1.91 -        case PEP_STATEMACHINE_ERROR: return @"PEP_STATEMACHINE_ERROR";
    1.92 -        case PEP_NO_TRUST: return @"PEP_NO_TRUST";
    1.93 -        case PEP_STATEMACHINE_CANNOT_SEND: return @"PEP_STATEMACHINE_CANNOT_SEND";
    1.94 -        case PEP_CANNOT_DELETE_KEY: return @"PEP_CANNOT_DELETE_KEY";
    1.95 -        case PEP_CANNOT_CONFIG: return @"PEP_CANNOT_CONFIG";
    1.96 -        case PEP_SYNC_CANNOT_START: return @"PEP_SYNC_CANNOT_START";
    1.97 -        case PEP_SOME_KEYS_IMPORTED: return @"PEP_SOME_KEYS_IMPORTED";
    1.98 -        case PEP_CANNOT_SET_PEP_VERSION: return @"PEP_CANNOT_SET_PEP_VERSION";
    1.99 -    }
   1.100 +    const char *pstrStatus = pEp_status_to_string(status);
   1.101 +    return [NSString stringWithUTF8String:pstrStatus];
   1.102  }
   1.103  
   1.104  - (NSString * _Nullable)pEpErrorString
     2.1 --- a/pEpObjCAdapter/PEPQueue.h	Fri Sep 20 07:06:18 2019 +0200
     2.2 +++ b/pEpObjCAdapter/PEPQueue.h	Mon Sep 23 12:15:07 2019 +0200
     2.3 @@ -22,4 +22,9 @@
     2.4  
     2.5  - (void)purge:(deleteOp)del;
     2.6  
     2.7 +/**
     2.8 + Removes all objects from the queue.
     2.9 + */
    2.10 +- (void)removeAllObjects;
    2.11 +
    2.12  @end
     3.1 --- a/pEpObjCAdapter/PEPQueue.m	Fri Sep 20 07:06:18 2019 +0200
     3.2 +++ b/pEpObjCAdapter/PEPQueue.m	Mon Sep 23 12:15:07 2019 +0200
     3.3 @@ -116,6 +116,16 @@
     3.4      [_cond unlock];
     3.5  }
     3.6  
     3.7 +- (void)removeAllObjects
     3.8 +{
     3.9 +    [_cond lock];
    3.10 +
    3.11 +    [self.queue removeAllObjects];
    3.12 +
    3.13 +    [_cond signal];
    3.14 +    [_cond unlock];
    3.15 +}
    3.16 +
    3.17  
    3.18  - (void)dealloc
    3.19  {
     4.1 --- a/pEpObjCAdapter/PEPSync.m	Fri Sep 20 07:06:18 2019 +0200
     4.2 +++ b/pEpObjCAdapter/PEPSync.m	Mon Sep 23 12:15:07 2019 +0200
     4.3 @@ -24,7 +24,7 @@
     4.4  
     4.5  // MARK: - Internals
     4.6  
     4.7 -os_log_t s_logger;
     4.8 +static os_log_t s_logger;
     4.9  
    4.10  typedef PEP_STATUS (* t_messageToSendCallback)(struct _message *msg);
    4.11  typedef int (* t_injectSyncCallback)(SYNC_EVENT ev, void *management);
    4.12 @@ -157,6 +157,9 @@
    4.13  
    4.14  - (void)startup
    4.15  {
    4.16 +    // Make sure queue is empty when we start.
    4.17 +    [self.queue removeAllObjects];
    4.18 +
    4.19      [self assureMainSessionExists];
    4.20  
    4.21      self.conditionLockForJoiningSyncThread = [[NSConditionLock alloc] initWithCondition:NO];
     5.1 --- a/pEpObjCAdapterFramework/PEPEngineTypes.h	Fri Sep 20 07:06:18 2019 +0200
     5.2 +++ b/pEpObjCAdapterFramework/PEPEngineTypes.h	Mon Sep 23 12:15:07 2019 +0200
     5.3 @@ -11,259 +11,241 @@
     5.4  
     5.5  #import <Foundation/Foundation.h>
     5.6  
     5.7 -typedef NS_ENUM(int, PEPDecryptFlags) {
     5.8 -    PEPDecryptFlagsNone = 0x1, // This defined only in the adpater, not the engine.
     5.9 -    PEPDecryptFlagsOwnPrivateKey = 0x1, // PEP_decrypt_flag_own_private_key = 0x1,
    5.10 -    PEPDecryptFlagsConsume = 0x2, // PEP_decrypt_flag_consume = 0x2,
    5.11 -    PEPDecryptFlagsIgnore = 0x4, // PEP_decrypt_flag_ignore = 0x4,
    5.12 -    PEPDecryptFlagsSrcModified = 0x8, // PEP_decrypt_flag_src_modified = 0x8,
    5.13 -    // input flags
    5.14 -    PEPDecryptFlagsUntrustedServer = 0x100 // PEP_decrypt_flag_untrusted_server = 0x100
    5.15 -}; // PEP_decrypt_flags;
    5.16 -
    5.17 -typedef NS_ENUM(int, PEPEncFormat) {
    5.18 -    PEPEncFormatNone = 0, // PEP_enc_none = 0, // message is not encrypted
    5.19 -    PEPEncFormatPieces, // PEP_enc_pieces, // inline PGP + PGP extensions
    5.20 -    PEPEncFormatSMIME, // PEP_enc_S_MIME, // RFC5751
    5.21 -    PEPEncFormatPgpMIME, // PEP_enc_PGP_MIME, // RFC3156
    5.22 -    PEPEncFormatPEP, // PEP_enc_PEP, // pEp encryption format
    5.23 -    PEPEncFormatPgpMIMEOutlook1 // PEP_enc_PGP_MIME_Outlook1 // Message B0rken by Outlook type 1
    5.24 +typedef NS_CLOSED_ENUM(int, PEPDecryptFlags) {
    5.25 +    PEPDecryptFlagsNone = 0x0, // not actually defined in the engine
    5.26 +    PEPDecryptFlagsOwnPrivateKey = 0x1, // PEP_decrypt_flag_own_private_key
    5.27 +    PEPDecryptFlagsConsume = 0x2, //PEP_decrypt_flag_consume
    5.28 +    PEPDecryptFlagsIgnore = 0x4, // PEP_decrypt_flag_ignore
    5.29 +    PEPDecryptFlagsSourceModified = 0x8, // PEP_decrypt_flag_src_modified
    5.30 +    PEPDecryptFlagsUntrustedServer = 0x100, // PEP_decrypt_flag_untrusted_server
    5.31 +    PEPDecryptFlagsDontTriggerSync = 0x200, // PEP_decrypt_flag_dont_trigger_sync
    5.32  };
    5.33  
    5.34 -typedef NS_ENUM(int, PEPRating) {
    5.35 -    PEPRatingUndefined = 0,// PEP_rating_undefined = 0,
    5.36 -    PEPRatingCannotDecrypt, // PEP_rating_cannot_decrypt,
    5.37 -    PEPRatingHaveNoKey, // PEP_rating_have_no_key,
    5.38 -    PEPRatingUnencrypted, // PEP_rating_unencrypted,
    5.39 -    PEPRatingUnencryptedForSome, // PEP_rating_unencrypted_for_some, // don't use this any more
    5.40 -    PEPRatingUnreliable, // PEP_rating_unreliable,
    5.41 -    PEPRatingReliable, // PEP_rating_reliable,
    5.42 -    PEPRatingTrusted, // PEP_rating_trusted,
    5.43 -    PEPRatingTrustedAndAnonymized, // PEP_rating_trusted_and_anonymized,
    5.44 -    PEPRatingFullyAnonymous, // PEP_rating_fully_anonymous,
    5.45 -
    5.46 -    PEPRatingMistrust = -1, // PEP_rating_mistrust = -1,
    5.47 -    PEPRatingB0rken = -2, // PEP_rating_b0rken = -2,
    5.48 -    PEPRatingUnderAttack = -3 // PEP_rating_under_attack = -3
    5.49 +typedef NS_CLOSED_ENUM(int, PEPEncFormat) {
    5.50 +    PEPEncFormatNone = 0, // PEP_enc_none
    5.51 +    PEPEncFormatPieces, // PEP_enc_pieces, PEP_enc_inline
    5.52 +    PEPEncFormatSMIME, // PEP_enc_S_MIME
    5.53 +    PEPEncFormatPGPMIME, // PEP_enc_PGP_MIME
    5.54 +    PEPEncFormatPEP, // PEP_enc_PEP
    5.55 +    PEPEncFormatPGPMIMEOutlook1 // PEP_enc_PGP_MIME_Outlook1
    5.56  };
    5.57  
    5.58 -typedef NS_ENUM(int, PEPStatus) {
    5.59 -    PEPStatusOK                                   = 0, // PEP_STATUS_OK
    5.60 +typedef NS_CLOSED_ENUM(int, PEPRating) {
    5.61 +    PEPRatingUndefined = 0, // PEP_rating_undefined
    5.62 +    PEPRatingCannotDecrypt, // PEP_rating_cannot_decrypt
    5.63 +    PEPRatingHaveNoKey, // PEP_rating_have_no_key
    5.64 +    PEPRatingUnencrypted, // PEP_rating_unencrypted
    5.65 +    PEPRatingUnencryptedForSome, // PEP_rating_unencrypted_for_some
    5.66 +    PEPRatingUnreliable, // PEP_rating_unreliable
    5.67 +    PEPRatingReliable, // PEP_rating_reliable
    5.68 +    PEPRatingTrusted, // PEP_rating_trusted
    5.69 +    PEPRatingTrustedAndAnonymized, // PEP_rating_trusted_and_anonymized
    5.70 +    PEPRatingFullyAnonymous, // PEP_rating_fully_anonymous
    5.71  
    5.72 -    PEPStatusInitCannotLoadGPME                      = 0x0110, // PEP_INIT_CANNOT_LOAD_GPGME
    5.73 -    PEPStatusInitGPGMEInitFailed                      = 0x0111, // PEP_INIT_GPGME_INIT_FAILED
    5.74 -    PEPStatusInitNoGPGHome                            = 0x0112, // PEP_INIT_NO_GPG_HOME
    5.75 -    PEPStatusInitNETPGPInitFailed                     = 0x0113, // PEP_INIT_NETPGP_INIT_FAILED
    5.76 -    PEPStatusInitCannotDetermineGPGVersion           = 0x0114, // PEP_INIT_CANNOT_DETERMINE_GPG_VERSION
    5.77 -    PEPStatusInitUnsupportedGPGVersion                = 0x0115, // PEP_INIT_UNSUPPORTED_GPG_VERSION
    5.78 -    PEPStatusInitCannotConfigGPGAgent                = 0x0116, // PEP_INIT_CANNOT_CONFIG_GPG_AGENT
    5.79 +    PEPRatingMistrust = -1, // PEP_rating_mistrust
    5.80 +    PEPRatingB0rken = -2, // PEP_rating_b0rken
    5.81 +    PEPRatingUnderAttack = -3 // PEP_rating_under_attack
    5.82 +};
    5.83  
    5.84 -    PEPStatusInitSqlite3WithoutMutex                  = 0x0120, // PEP_INIT_SQLITE3_WITHOUT_MUTEX
    5.85 -    PEPStatusInitCannotOpenDB                         = 0x0121, // PEP_INIT_CANNOT_OPEN_DB
    5.86 -    PEPStatusInitCannotOpenSystemDB                  = 0x0122, // PEP_INIT_CANNOT_OPEN_SYSTEM_DB
    5.87 -    PEPStatusUnknownDBError                            = 0x01ff, // PEP_UNKNOWN_DB_ERROR
    5.88 +typedef NS_CLOSED_ENUM(int, PEPStatus) {
    5.89 +    PEPStatusOK = 0, // PEP_STATUS_OK
    5.90  
    5.91 -    PEPStatusKeyNotFound                               = 0x0201, // PEP_KEY_NOT_FOUND
    5.92 -    PEPStatusKeyHasAmbigName                          = 0x0202, // PEP_KEY_HAS_AMBIG_NAME
    5.93 -    PEPStatusGetKeyFailed                              = 0x0203, // PEP_GET_KEY_FAILED
    5.94 -    PEPStatusCannotExportKey                           = 0x0204, // PEP_CANNOT_EXPORT_KEY
    5.95 -    PEPStatusCannotEditKey                             = 0x0205, // PEP_CANNOT_EDIT_KEY
    5.96 -    PEPStatusKeyUnsuitable                              = 0x0206, // PEP_KEY_UNSUITABLE
    5.97 -    PEPStatusMalformedKeyResetMsg                     = 0x0210, // PEP_MALFORMED_KEY_RESET_MSG
    5.98 -    PEPStatusKeyNotReset                               = 0x0211, // PEP_KEY_NOT_RESET
    5.99 +    PEPStatusInitCannotLoadGPME = 0x0110, // PEP_INIT_CANNOT_LOAD_GPGME
   5.100 +    PEPStatusInitGPGMEInitFailed = 0x0111, // PEP_INIT_GPGME_INIT_FAILED
   5.101 +    PEPStatusInitNoGPGHome = 0x0112, // PEP_INIT_NO_GPG_HOME
   5.102 +    PEPStatusInitNETPGPInitFailed = 0x0113, // PEP_INIT_NETPGP_INIT_FAILED
   5.103 +    PEPStatusInitCannotDetermineGPGVersion = 0x0114, // PEP_INIT_CANNOT_DETERMINE_GPG_VERSION
   5.104 +    PEPStatusInitUnsupportedGPGVersion = 0x0115, // PEP_INIT_UNSUPPORTED_GPG_VERSION
   5.105 +    PEPStatusInitCannotConfigGPGAgent = 0x0116, // PEP_INIT_CANNOT_CONFIG_GPG_AGENT
   5.106  
   5.107 -    PEPStatusKeyImported                                = 0x0220, // PEP_KEY_IMPORTED
   5.108 -    PEPStatusNoKeyImported                             = 0x0221, // PEP_NO_KEY_IMPORTED
   5.109 -    PEPStatusKeyImportStatusUnknown                   = 0x0222, // PEP_KEY_IMPORT_STATUS_UNKNOWN
   5.110 +    PEPStatusInitSqlite3WithoutMutex = 0x0120, // PEP_INIT_SQLITE3_WITHOUT_MUTEX
   5.111 +    PEPStatusInitCannotOpenDB = 0x0121, // PEP_INIT_CANNOT_OPEN_DB
   5.112 +    PEPStatusInitCannotOpenSystemDB = 0x0122, // PEP_INIT_CANNOT_OPEN_SYSTEM_DB
   5.113 +    PEPStatusUnknownDBError = 0x01ff, // PEP_UNKNOWN_DB_ERROR
   5.114  
   5.115 -    PEPStatusCannotFindIdentity                        = 0x0301, // PEP_CANNOT_FIND_IDENTITY
   5.116 -    PEPStatusCannotSetPerson                           = 0x0381, // PEP_CANNOT_SET_PERSON
   5.117 -    PEPStatusCannotSetPGPKeyPair                      = 0x0382, // PEP_CANNOT_SET_PGP_KEYPAIR
   5.118 -    PEPStatusCannotSetIdentity                         = 0x0383, // PEP_CANNOT_SET_IDENTITY
   5.119 -    PEPStatusCannotSetTrust                            = 0x0384, // PEP_CANNOT_SET_TRUST
   5.120 -    PEPStatusKeyBlacklisted                             = 0x0385, // PEP_KEY_BLACKLISTED
   5.121 -    PEPStatusCannotFindPerson                          = 0x0386, // PEP_CANNOT_FIND_PERSON
   5.122 +    PEPStatusKeyNotFound = 0x0201, // PEP_KEY_NOT_FOUND
   5.123 +    PEPStatusKeyHasAmbigName = 0x0202, // PEP_KEY_HAS_AMBIG_NAME
   5.124 +    PEPStatusGetKeyFailed = 0x0203, // PEP_GET_KEY_FAILED
   5.125 +    PEPStatusCannotExportKey = 0x0204, // PEP_CANNOT_EXPORT_KEY
   5.126 +    PEPStatusCannotEditKey = 0x0205, // PEP_CANNOT_EDIT_KEY
   5.127 +    PEPStatusKeyUnsuitable = 0x0206, // PEP_KEY_UNSUITABLE
   5.128 +    PEPStatusMalformedKeyResetMsg = 0x0210, // PEP_MALFORMED_KEY_RESET_MSG
   5.129 +    PEPStatusKeyNotReset = 0x0211, // PEP_KEY_NOT_RESET
   5.130 +    PEPStatusCannotDeleteKey = 0x0212, // PEP_CANNOT_DELETE_KEY
   5.131 +
   5.132 +    PEPStatusKeyImported = 0x0220, // PEP_KEY_IMPORTED
   5.133 +    PEPStatusNoKeyImported = 0x0221, // PEP_NO_KEY_IMPORTED
   5.134 +    PEPStatusKeyImportStatusUnknown = 0x0222, // PEP_KEY_IMPORT_STATUS_UNKNOWN
   5.135 +    PEPStatusSomeKeysImported = 0x0223, // PEP_SOME_KEYS_IMPORTED
   5.136 +
   5.137 +    PEPStatusCannotFindIdentity = 0x0301, // PEP_CANNOT_FIND_IDENTITY
   5.138 +    PEPStatusCannotSetPerson = 0x0381, // PEP_CANNOT_SET_PERSON
   5.139 +    PEPStatusCannotSetPGPKeyPair = 0x0382, // PEP_CANNOT_SET_PGP_KEYPAIR
   5.140 +    PEPStatusCannotSetIdentity = 0x0383, // PEP_CANNOT_SET_IDENTITY
   5.141 +    PEPStatusCannotSetTrust = 0x0384, // PEP_CANNOT_SET_TRUST
   5.142 +    PEPStatusKeyBlacklisted = 0x0385, // PEP_KEY_BLACKLISTED
   5.143 +    PEPStatusCannotFindPerson = 0x0386, // PEP_CANNOT_FIND_PERSON
   5.144      PEPStatusCannotSetPEPVersion = 0X0387, // PEP_CANNOT_SET_PEP_VERSION
   5.145  
   5.146 -    PEPStatusCannotFindAlias                           = 0x0391, // PEP_CANNOT_FIND_ALIAS
   5.147 -    PEPStatusCannotSetAlias                            = 0x0392, // PEP_CANNOT_SET_ALIAS
   5.148 +    PEPStatusCannotFindAlias = 0x0391, // PEP_CANNOT_FIND_ALIAS
   5.149 +    PEPStatusCannotSetAlias = 0x0392, // PEP_CANNOT_SET_ALIAS
   5.150  
   5.151 -    PEPStatusUnencrypted                                 = 0x0400, // PEP_UNENCRYPTED
   5.152 -    PEPStatusVerified                                    = 0x0401, // PEP_VERIFIED
   5.153 -    PEPStatusDecrypted                                   = 0x0402, // PEP_DECRYPTED
   5.154 -    PEPStatusDecryptedAndVerified                      = 0x0403, // PEP_DECRYPTED_AND_VERIFIED
   5.155 -    PEPStatusDecryptWrongFormat                        = 0x0404, // PEP_DECRYPT_WRONG_FORMAT
   5.156 -    PEPStatusDecryptNoKey                              = 0x0405, // PEP_DECRYPT_NO_KEY
   5.157 -    PEPStatusDecryptSignatureDoesNotMatch            = 0x0406, // PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH
   5.158 -    PEPStatusVerifyNoKey                               = 0x0407, // PEP_VERIFY_NO_KEY
   5.159 -    PEPStatusVerifiedAndTrusted                        = 0x0408, // PEP_VERIFIED_AND_TRUSTED
   5.160 -    PEPStatusCannotReencrypt                            = 0x0409, // PEP_CANNOT_REENCRYPT
   5.161 -    PEPStatusCannotDecryptUnknown                      = 0x04ff, // PEP_CANNOT_DECRYPT_UNKNOWN
   5.162 +    PEPStatusUnencrypted = 0x0400, // PEP_UNENCRYPTED
   5.163 +    PEPStatusVerified = 0x0401, // PEP_VERIFIED
   5.164 +    PEPStatusDecrypted = 0x0402, // PEP_DECRYPTED
   5.165 +    PEPStatusDecryptedAndVerified = 0x0403, // PEP_DECRYPTED_AND_VERIFIED
   5.166 +    PEPStatusDecryptWrongFormat = 0x0404, // PEP_DECRYPT_WRONG_FORMAT
   5.167 +    PEPStatusDecryptNoKey = 0x0405, // PEP_DECRYPT_NO_KEY
   5.168 +    PEPStatusDecryptSignatureDoesNotMatch = 0x0406, // PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH
   5.169 +    PEPStatusVerifyNoKey = 0x0407, // PEP_VERIFY_NO_KEY
   5.170 +    PEPStatusVerifiedAndTrusted = 0x0408, // PEP_VERIFIED_AND_TRUSTED
   5.171 +    PEPStatusCannotReencrypt = 0x0409, // PEP_CANNOT_REENCRYPT
   5.172 +    PEPStatusCannotDecryptUnknown = 0x04ff, // PEP_CANNOT_DECRYPT_UNKNOWN
   5.173  
   5.174 -    PEPStatusTrustwordNotFound                         = 0x0501, // PEP_TRUSTWORD_NOT_FOUND
   5.175 -    PEPStatusTrustwordsFPRWrongLength                 = 0x0502, // PEP_TRUSTWORDS_FPR_WRONG_LENGTH
   5.176 -    PEPStatusTrustwordsDuplicateFPR                    = 0x0503, // PEP_TRUSTWORDS_DUPLICATE_FPR
   5.177 +    PEPStatusTrustwordNotFound = 0x0501, // PEP_TRUSTWORD_NOT_FOUND
   5.178 +    PEPStatusTrustwordsFPRWrongLength = 0x0502, // PEP_TRUSTWORDS_FPR_WRONG_LENGTH
   5.179 +    PEPStatusTrustwordsDuplicateFPR = 0x0503, // PEP_TRUSTWORDS_DUPLICATE_FPR
   5.180  
   5.181 -    PEPStatusCannotCreateKey                           = 0x0601, // PEP_CANNOT_CREATE_KEY
   5.182 -    PEPStatusCannotSendKey                             = 0x0602, // PEP_CANNOT_SEND_KEY
   5.183 +    PEPStatusCannotCreateKey = 0x0601, // PEP_CANNOT_CREATE_KEY
   5.184 +    PEPStatusCannotSendKey = 0x0602, // PEP_CANNOT_SEND_KEY
   5.185  
   5.186 -    PEPStatusPhraseNotFound                            = 0x0701, // PEP_PHRASE_NOT_FOUND
   5.187 +    PEPStatusPhraseNotFound = 0x0701, // PEP_PHRASE_NOT_FOUND
   5.188  
   5.189 -    PEPStatusSendFunctionNotRegistered                = 0x0801, // PEP_SEND_FUNCTION_NOT_REGISTERED
   5.190 -    PEPStatusConstraintsViolated                         = 0x0802, // PEP_CONTRAINTS_VIOLATED
   5.191 -    PEPStatusCannotEncode                               = 0x0803, // PEP_CANNOT_ENCODE
   5.192 +    PEPStatusSendFunctionNotRegistered = 0x0801, // PEP_SEND_FUNCTION_NOT_REGISTERED
   5.193 +    PEPStatusConstraintsViolated = 0x0802, // PEP_CONTRAINTS_VIOLATED
   5.194 +    PEPStatusCannotEncode = 0x0803, // PEP_CANNOT_ENCODE
   5.195  
   5.196 -    PEPStatusSyncNoNotifyCallback                     = 0x0901, // PEP_SYNC_NO_NOTIFY_CALLBACK
   5.197 -    PEPStatusSyncIllegalMessage                        = 0x0902, // PEP_SYNC_ILLEGAL_MESSAGE
   5.198 -    PEPStatusSyncNoInjectCallback                     = 0x0903, // PEP_SYNC_NO_INJECT_CALLBACK
   5.199 -    PEPStatusSyncNoChannel                             = 0x0904, // PEP_SYNC_NO_CHANNEL
   5.200 -    PEPStatusSyncCannotEncrypt                         = 0x0905, // PEP_SYNC_CANNOT_ENCRYPT
   5.201 -    PEPStatusSyncNoMessageSendCallback               = 0x0906, // PEP_SYNC_NO_MESSAGE_SEND_CALLBACK
   5.202 +    PEPStatusSyncNoNotifyCallback = 0x0901, // PEP_SYNC_NO_NOTIFY_CALLBACK
   5.203 +    PEPStatusSyncIllegalMessage = 0x0902, // PEP_SYNC_ILLEGAL_MESSAGE
   5.204 +    PEPStatusSyncNoInjectCallback = 0x0903, // PEP_SYNC_NO_INJECT_CALLBACK
   5.205 +    PEPStatusSyncNoChannel = 0x0904, // PEP_SYNC_NO_CHANNEL
   5.206 +    PEPStatusSyncCannotEncrypt = 0x0905, // PEP_SYNC_CANNOT_ENCRYPT
   5.207 +    PEPStatusSyncNoMessageSendCallback = 0x0906, // PEP_SYNC_NO_MESSAGE_SEND_CALLBACK
   5.208 +    PEPStatusSyncCannotStart = 0x0907, // PEP_SYNC_CANNOT_START
   5.209  
   5.210 -    PEPStatusCannotIncreaseSequence                    = 0x0971, // PEP_CANNOT_INCREASE_SEQUENCE
   5.211 +    PEPStatusCannotIncreaseSequence = 0x0971, // PEP_CANNOT_INCREASE_SEQUENCE
   5.212  
   5.213 -    PEPStatusStatemachineError                          = 0x0980, // PEP_STATEMACHINE_ERROR
   5.214 -    PEPStatusNoTrust                                    = 0x0981, // PEP_NO_TRUST
   5.215 -    PEPStatusStatemachineInvalidState                  = 0x0982, // PEP_STATEMACHINE_INVALID_STATE
   5.216 -    PEPStatusStatemachineInvalidEvent                  = 0x0983, // PEP_STATEMACHINE_INVALID_EVENT
   5.217 -    PEPStatusStatemachineInvalidCondition              = 0x0984, // PEP_STATEMACHINE_INVALID_CONDITION
   5.218 -    PEPStatusStatemachineInvalidAction                 = 0x0985, // PEP_STATEMACHINE_INVALID_ACTION
   5.219 -    PEPStatusStatemachineInhibitedEvent                = 0x0986, // PEP_STATEMACHINE_INHIBITED_EVENT
   5.220 -    PEPStatusStatemachineCannotSend                    = 0x0987, // PEP_STATEMACHINE_CANNOT_SEND
   5.221 +    PEPStatusStatemachineError = 0x0980, // PEP_STATEMACHINE_ERROR
   5.222 +    PEPStatusNoTrust = 0x0981, // PEP_NO_TRUST
   5.223 +    PEPStatusStatemachineInvalidState = 0x0982, // PEP_STATEMACHINE_INVALID_STATE
   5.224 +    PEPStatusStatemachineInvalidEvent = 0x0983, // PEP_STATEMACHINE_INVALID_EVENT
   5.225 +    PEPStatusStatemachineInvalidCondition = 0x0984, // PEP_STATEMACHINE_INVALID_CONDITION
   5.226 +    PEPStatusStatemachineInvalidAction = 0x0985, // PEP_STATEMACHINE_INVALID_ACTION
   5.227 +    PEPStatusStatemachineInhibitedEvent = 0x0986, // PEP_STATEMACHINE_INHIBITED_EVENT
   5.228 +    PEPStatusStatemachineCannotSend = 0x0987, // PEP_STATEMACHINE_CANNOT_SEND
   5.229  
   5.230 -    PEPStatusCommitFailed                               = 0xff01, // PEP_COMMIT_FAILED
   5.231 -    PEPStatusMessageConsume                             = 0xff02, // PEP_MESSAGE_CONSUME
   5.232 -    PEPStatusMessageIgnore                              = 0xff03, // PEP_MESSAGE_IGNORE
   5.233 +    PEPStatusCommitFailed = 0xff01, // PEP_COMMIT_FAILED
   5.234 +    PEPStatusMessageConsume = 0xff02, // PEP_MESSAGE_CONSUME
   5.235 +    PEPStatusMessageIgnore = 0xff03, // PEP_MESSAGE_IGNORE
   5.236 +    PEPStatusCannotConfig = 0xff04, // PEP_CANNOT_CONFIG
   5.237  
   5.238 -    PEPStatusRecordNotFound                            = -6, // PEP_RECORD_NOT_FOUND
   5.239 -    PEPStatusCannotCreateTempFile                     = -5, // PEP_CANNOT_CREATE_TEMP_FILE
   5.240 -    PEPStatusIllegalValue                               = -4, // PEP_ILLEGAL_VALUE
   5.241 -    PEPStatusBufferTooSmall                            = -3, // PEP_BUFFER_TOO_SMALL
   5.242 -    PEPStatusOutOfMemory                               = -2, // PEP_OUT_OF_MEMORY
   5.243 -    PEPStatusUnknownError                               = -1, // PEP_UNKNOWN_ERROR
   5.244 +    PEPStatusRecordNotFound = -6, // PEP_RECORD_NOT_FOUND
   5.245 +    PEPStatusCannotCreateTempFile = -5, // PEP_CANNOT_CREATE_TEMP_FILE
   5.246 +    PEPStatusIllegalValue = -4, // PEP_ILLEGAL_VALUE
   5.247 +    PEPStatusBufferTooSmall = -3, // PEP_BUFFER_TOO_SMALL
   5.248 +    PEPStatusOutOfMemory = -2, // PEP_OUT_OF_MEMORY
   5.249 +    PEPStatusUnknownError = -1, // PEP_UNKNOWN_ERROR
   5.250  
   5.251 -    PEPStatusVersionMismatch                            = -7, // PEP_VERSION_MISMATCH
   5.252 +    PEPStatusVersionMismatch = -7, // PEP_VERSION_MISMATCH
   5.253  };
   5.254  
   5.255 -typedef NS_ENUM(int, PEPIdentityFlags) {
   5.256 -    // the first octet flags are app defined settings
   5.257 -    PEPIdentityFlagsNotForSync = 0x0001, // PEP_idf_not_for_sync = 0x0001,   // don't use this identity for sync
   5.258 -    PEPIdentityFlagsList = 0x0002, // PEP_idf_list = 0x0002,           // identity of list of persons
   5.259 -    // the second octet flags are calculated
   5.260 -    PEPIdentityFlagsDeviceGroup = 0x0100 // PEP_idf_devicegroup = 0x0100     // identity of a device group member
   5.261 +typedef NS_CLOSED_ENUM(int, PEPIdentityFlags) {
   5.262 +    PEPIdentityFlagsNotForSync = 0x0001, // PEP_idf_not_for_sync
   5.263 +    PEPIdentityFlagsList = 0x0002, // PEP_idf_list = 0x0002
   5.264 +    PEPIdentityFlagsDeviceGroup = 0x0100 // PEP_idf_devicegroup
   5.265  };
   5.266  
   5.267 -typedef NS_ENUM(int, PEPSyncHandshakeSignal) { // _sync_handshake_signal
   5.268 -    PEPSyncHandshakeSignalUndefined = 0, // SYNC_NOTIFY_UNDEFINED = 0,
   5.269 +typedef NS_CLOSED_ENUM(int, PEPSyncHandshakeSignal) {
   5.270 +    PEPSyncHandshakeSignalUndefined = 0, // SYNC_NOTIFY_UNDEFINED
   5.271  
   5.272 -    // request show handshake dialog
   5.273 -    PEPSyncHandshakeSignalInitAddOurDevice = 1, // SYNC_NOTIFY_INIT_ADD_OUR_DEVICE = 1,
   5.274 -    PEPSyncHandshakeSignalInitAddOtherDevice = 2, // SYNC_NOTIFY_INIT_ADD_OTHER_DEVICE = 2,
   5.275 -    PEPSyncHandshakeSignalInitFormGroup = 3, // SYNC_NOTIFY_INIT_FORM_GROUP = 3,
   5.276 -    // SYNC_NOTIFY_INIT_MOVE_OUR_DEVICE = 4,
   5.277 +    PEPSyncHandshakeSignalInitAddOurDevice = 1, // SYNC_NOTIFY_INIT_ADD_OUR_DEVICE
   5.278 +    PEPSyncHandshakeSignalInitAddOtherDevice = 2, // SYNC_NOTIFY_INIT_ADD_OTHER_DEVICE
   5.279 +    PEPSyncHandshakeSignalInitFormGroup = 3, // SYNC_NOTIFY_INIT_FORM_GROUP
   5.280  
   5.281 -    // handshake process timed out
   5.282 -    PEPSyncHandshakeSignalTimeout = 5, // SYNC_NOTIFY_TIMEOUT = 5,
   5.283 +    PEPSyncHandshakeSignalTimeout = 5, // SYNC_NOTIFY_TIMEOUT
   5.284  
   5.285 -    // handshake accepted by user
   5.286 -    PEPSyncHandshakeSignalAcceptedDeviceAdded = 6, // SYNC_NOTIFY_ACCEPTED_DEVICE_ADDED = 6,
   5.287 -    PEPSyncHandshakeSignalAcceptedGroupCreated = 7, // SYNC_NOTIFY_ACCEPTED_GROUP_CREATED = 7,
   5.288 -    // SYNC_NOTIFY_ACCEPTED_DEVICE_MOVED = 8,
   5.289 +    PEPSyncHandshakeSignalAcceptedDeviceAdded = 6, // SYNC_NOTIFY_ACCEPTED_DEVICE_ADDED
   5.290 +    PEPSyncHandshakeSignalAcceptedGroupCreated = 7, // SYNC_NOTIFY_ACCEPTED_GROUP_CREATED
   5.291  
   5.292 -    // handshake dialog must be closed
   5.293 -    PEPSyncHandshakeSignalOvertaken = 9, // SYNC_NOTIFY_OVERTAKEN = 9,
   5.294 +    PEPSyncHandshakeSignalOvertaken = 9, // SYNC_NOTIFY_OVERTAKEN
   5.295  
   5.296 -    /** currently exchanging private keys */
   5.297 -    PEPSyncHandshakeSignalFormingGroup = 10, // SYNC_NOTIFY_FORMING_GROUP = 10
   5.298 +    PEPSyncHandshakeSignalFormingGroup = 10, // SYNC_NOTIFY_FORMING_GROUP
   5.299  
   5.300 -    // notificaton of actual group status
   5.301 -    PEPSyncHandshakeSignalSole = 254, // SYNC_NOTIFY_SOLE = 254,
   5.302 -    PEPSyncHandshakeSignalInGroup = 255 // SYNC_NOTIFY_IN_GROUP = 255
   5.303 +    PEPSyncHandshakeSignalSole = 254, // SYNC_NOTIFY_SOLE
   5.304 +    PEPSyncHandshakeSignalInGroup = 255 // SYNC_NOTIFY_IN_GROUP
   5.305  };
   5.306  
   5.307 -typedef NS_ENUM(int, PEPSyncHandshakeResult) {
   5.308 -    PEPSyncHandshakeResultCancel = -1, // SYNC_HANDSHAKE_CANCEL = -1,
   5.309 -    PEPSyncHandshakeResultAccepted = 0, // SYNC_HANDSHAKE_ACCEPTED = 0,
   5.310 -    PEPSyncHandshakeResultRejected = 1 // SYNC_HANDSHAKE_REJECTED = 1
   5.311 +typedef NS_CLOSED_ENUM(int, PEPSyncHandshakeResult) {
   5.312 +    PEPSyncHandshakeResultCancel = -1, // SYNC_HANDSHAKE_CANCEL
   5.313 +    PEPSyncHandshakeResultAccepted = 0, // SYNC_HANDSHAKE_ACCEPTED
   5.314 +    PEPSyncHandshakeResultRejected = 1 // SYNC_HANDSHAKE_REJECTED
   5.315  };
   5.316  
   5.317 -typedef NS_ENUM(int, PEPCommType) {
   5.318 -    PEPCommTypeUnknown = 0, // PEP_ct_unknown = 0,
   5.319 +typedef NS_CLOSED_ENUM(int, PEPCommType) {
   5.320 +    PEPCommTypeUnknown = 0, // PEP_ct_unknown
   5.321 +    PEPCommTypeNoEncryption = 0x01, // PEP_ct_no_encryption
   5.322 +    PEPCommTypeNoEncrypted_channel = 0x02, // PEP_ct_no_encrypted_channel
   5.323 +    PEPCommTypeKeyNotFound = 0x03, // PEP_ct_key_not_found
   5.324 +    PEPCommTypeKeyExpired = 0x04, // PEP_ct_key_expired
   5.325 +    PEPCommTypeKeyRevoked = 0x05, // PEP_ct_key_revoked
   5.326 +    PEPCommTypeKeyB0rken = 0x06, // PEP_ct_key_b0rken
   5.327 +    PEPCommTypeKeyExpiredButConfirmed = 0x07, // PEP_ct_key_expired_but_confirmed renewal.
   5.328 +    PEPCommTypeMyKeyNotIncluded = 0x09, // PEP_ct_my_key_not_included
   5.329  
   5.330 -    // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable
   5.331 +    PEPCommTypeSecurityByObscurity = 0x0a, // PEP_ct_security_by_obscurity
   5.332 +    PEPCommTypeB0rkenCrypto = 0x0b, // PEP_ct_b0rken_crypto
   5.333 +    PEPCommTypeKeyTooShort = 0x0c, // PEP_ct_key_too_short
   5.334  
   5.335 -    PEPCommTypeNoEncryption = 0x01, // PEP_ct_no_encryption = 0x01,                // generic
   5.336 -    PEPCommTypeNoEncrypted_channel = 0x02, // PEP_ct_no_encrypted_channel = 0x02,
   5.337 -    PEPCommTypeKeyNotFound = 0x03, // PEP_ct_key_not_found = 0x03,
   5.338 -    PEPCommTypeKeyExpired = 0x04, // PEP_ct_key_expired = 0x04,
   5.339 -    PEPCommTypeKeyRevoked = 0x05, // PEP_ct_key_revoked = 0x05,
   5.340 -    PEPCommTypeKeyBr0ken = 0x06, // PEP_ct_key_b0rken = 0x06,
   5.341 -    PEPCommTypeKeyExpiredButConfirmed = 0x07, // PEP_ct_key_expired_but_confirmed = 0x07, // NOT with confirmed bit. Just retaining info here in case of renewal.
   5.342 -    PEPCommTypeMyKeyNotIncluded = 0x09, // PEP_ct_my_key_not_included = 0x09,
   5.343 +    PEPCommTypeCompromised = 0x0e, // PEP_ct_compromized
   5.344 +    PEPCommTypeMistrusted = 0x0f, // PEP_ct_mistrusted
   5.345  
   5.346 -    PEPCommTypeSecurityByObscurity = 0x0a, // PEP_ct_security_by_obscurity = 0x0a,
   5.347 -    PEPCommTypeBr0kenCrypto = 0x0b, // PEP_ct_b0rken_crypto = 0x0b,
   5.348 -    PEPCommTypeKeyTooShort = 0x0c, // PEP_ct_key_too_short = 0x0c,
   5.349 +    PEPCommTypeUnconfirmedEncryption = 0x10, // PEP_ct_unconfirmed_encryption
   5.350 +    PEPCommTypeOpenPGPWeakUnconfirmed = 0x11, // PEP_ct_OpenPGP_weak_unconfirmed
   5.351  
   5.352 -    PEPCommTypeCompromised = 0x0e, // PEP_ct_compromized = 0x0e,                  // deprecated misspelling
   5.353 -    PEPCommTypeMistrusted = 0x0f, // PEP_ct_mistrusted = 0x0f,                   // known mistrusted key
   5.354 +    PEPCommTypeToBeChecked = 0x20, // PEP_ct_to_be_checked
   5.355 +    PEPCommTypeSMIMEUnconfirmed = 0x21, // PEP_ct_SMIME_unconfirmed
   5.356 +    PEPCommTypeCMSUnconfirmed = 0x22, // PEP_ct_CMS_unconfirmed
   5.357  
   5.358 -    // range 0x10 to 0x3f: unconfirmed encryption
   5.359 +    PEPCommTypeStongButUnconfirmed = 0x30, // PEP_ct_strong_but_unconfirmed
   5.360 +    PEPCommTypeOpenPGPUnconfirmed = 0x38, // PEP_ct_OpenPGP_unconfirmed
   5.361 +    PEPCommTypeOTRUnconfirmed = 0x3a, // PEP_ct_OTR_unconfirmed
   5.362  
   5.363 -    PEPCommTypeUnconfirmedEncryption = 0x10, // PEP_ct_unconfirmed_encryption = 0x10,       // generic
   5.364 -    PEPCommTypeOpenPGPWeakUnconfirmed = 0x11, // PEP_ct_OpenPGP_weak_unconfirmed = 0x11,     // RSA 1024 is weak
   5.365 +    PEPCommTypeUnconfirmedEncAnon = 0x40, // PEP_ct_unconfirmed_enc_anon
   5.366 +    PEPCommTypePEPUnconfirmed = 0x7f, // PEP_ct_pEp_unconfirmed
   5.367  
   5.368 -    PEPCommTypeToBeChecked = 0x20, // PEP_ct_to_be_checked = 0x20,                // generic
   5.369 -    PEPCommTypeSMIMEUnconfirmed = 0x21, // PEP_ct_SMIME_unconfirmed = 0x21,
   5.370 -    PEPCommTypeCMSUnconfirmed = 0x22, // PEP_ct_CMS_unconfirmed = 0x22,
   5.371 +    PEPCommTypeConfirmed = 0x80, // PEP_ct_confirmed
   5.372  
   5.373 -    PEPCommTypeStongButUnconfirmed = 0x30, // PEP_ct_strong_but_unconfirmed = 0x30,       // generic
   5.374 -    PEPCommTypeOpenPGPUnconfirmed = 0x38, // PEP_ct_OpenPGP_unconfirmed = 0x38,          // key at least 2048 bit RSA or EC
   5.375 -    PEPCommTypeOTRUnconfirmed = 0x3a, // PEP_ct_OTR_unconfirmed = 0x3a,
   5.376 +    PEPCommTypeConfirmedEncryption = 0x90, // PEP_ct_confirmed_encryption
   5.377 +    PEPCommTypeOpenPGPWeak = 0x91, // PEP_ct_OpenPGP_weak
   5.378  
   5.379 -    // range 0x40 to 0x7f: unconfirmed encryption and anonymization
   5.380 +    PEPCommTypeToBeCheckedConfirmed = 0xa0, // PEP_ct_to_be_checked_confirmed
   5.381 +    PEPCommTypeSMIME = 0xa1, // PEP_ct_SMIME
   5.382 +    PEPCommTypeCMS = 0xa2, // PEP_ct_CMS
   5.383  
   5.384 -    PEPCommTypeUnconfirmedEncAnon = 0x40, // PEP_ct_unconfirmed_enc_anon = 0x40,         // generic
   5.385 -    PEPCommTypePEPUnconfirmed = 0x7f, // PEP_ct_pEp_unconfirmed = 0x7f,
   5.386 +    PEPCommTypeStongEncryption = 0xb0, // PEP_ct_strong_encryption
   5.387 +    PEPCommTypeOpenPGP = 0xb8, // PEP_ct_OpenPGP
   5.388 +    PEPCommTypeOTR = 0xba, // PEP_ct_OTR
   5.389  
   5.390 -    PEPCommTypeConfirmed = 0x80, // PEP_ct_confirmed = 0x80,                    // this bit decides if trust is confirmed
   5.391 -
   5.392 -    // range 0x81 to 0x8f: reserved
   5.393 -    // range 0x90 to 0xbf: confirmed encryption
   5.394 -
   5.395 -    PEPCommTypeConfirmedEncryption = 0x90, // PEP_ct_confirmed_encryption = 0x90,         // generic
   5.396 -    PEPCommTypeOpenPGPWeak = 0x91, // PEP_ct_OpenPGP_weak = 0x91,                 // RSA 1024 is weak (unused)
   5.397 -
   5.398 -    PEPCommTypeToBeCheckedConfirmed = 0xa0, // PEP_ct_to_be_checked_confirmed = 0xa0,      // generic
   5.399 -    PEPCommTypeSMIME = 0xa1, // PEP_ct_SMIME = 0xa1,
   5.400 -    PEPCommTypeCMS = 0xa2, // PEP_ct_CMS = 0xa2,
   5.401 -
   5.402 -    PEPCommTypeStongEncryption = 0xb0, // PEP_ct_strong_encryption = 0xb0,            // generic
   5.403 -    PEPCommTypeOpenPGP = 0xb8, // PEP_ct_OpenPGP = 0xb8,                      // key at least 2048 bit RSA or EC
   5.404 -    PEPCommTypeOTR = 0xba, // PEP_ct_OTR = 0xba,
   5.405 -
   5.406 -    // range 0xc0 to 0xff: confirmed encryption and anonymization
   5.407 -
   5.408 -    PEPCommTypeConfirmedEncAnon = 0xc0, // PEP_ct_confirmed_enc_anon = 0xc0,           // generic
   5.409 -    PEPCommTypePEP = 0xff // PEP_ct_pEp = 0xff
   5.410 +    PEPCommTypeConfirmedEncAnon = 0xc0, // PEP_ct_confirmed_enc_anon
   5.411 +    PEPCommTypePEP = 0xff // PEP_ct_pEp
   5.412  };
   5.413  
   5.414 -typedef NS_ENUM(int, PEPMsgDirection) {
   5.415 -    PEPMsgDirectionIncoming = 0,
   5.416 -    PEPMsgDirectionOutgoing
   5.417 +typedef NS_CLOSED_ENUM(int, PEPMsgDirection) {
   5.418 +    PEPMsgDirectionIncoming = 0, // PEP_dir_incoming
   5.419 +    PEPMsgDirectionOutgoing // PEP_dir_outgoing
   5.420  };
   5.421  
   5.422 -typedef NS_ENUM(int, PEPColor) {
   5.423 -    PEPColorNoColor = 0,
   5.424 -    PEPColorYellow,
   5.425 -    PEPColorGreen,
   5.426 -    PEPColorRed = -1,
   5.427 +typedef NS_CLOSED_ENUM(int, PEPColor) {
   5.428 +    PEPColorNoColor = 0, // PEP_color_no_color
   5.429 +    PEPColorYellow, // PEP_color_yellow
   5.430 +    PEPColorGreen, // PEP_color_green
   5.431 +    PEPColorRed = -1, // PEP_color_red
   5.432  };
   5.433  
   5.434 -typedef NS_ENUM(int, PEPContentDisposition) {
   5.435 -    PEPContentDispositionAttachment = 0,
   5.436 -    PEPContentDispositionInline = 1,
   5.437 -    PEPContentDispositionOther = -1      // must be affirmatively set
   5.438 +typedef NS_CLOSED_ENUM(int, PEPContentDisposition) {
   5.439 +    PEPContentDispositionAttachment = 0, // PEP_CONTENT_DISP_ATTACHMENT
   5.440 +    PEPContentDispositionInline = 1, // PEP_CONTENT_DISP_INLINE
   5.441 +    PEPContentDispositionOther = -1 // PEP_CONTENT_DISP_OTHER
   5.442  };
   5.443  
   5.444  #endif /* PEPTypes_h */