merge IOSAD-132
authorDirk Zimmermann <dz@pep.security>
Mon, 23 Sep 2019 12:11:24 +0200
changeset 1277033a160c0602
parent 1275 a4cdff14142c
parent 1276 b823fb385be5
child 1278 f25c9ee1caf2
child 1280 d8593d9624e5
merge IOSAD-132
     1.1 --- a/pEpObjCAdapter/NSError+PEP.m	Mon Sep 23 11:44:35 2019 +0200
     1.2 +++ b/pEpObjCAdapter/NSError+PEP.m	Mon Sep 23 12:11:24 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/pEpObjCAdapterFramework/PEPEngineTypes.h	Mon Sep 23 11:44:35 2019 +0200
     2.2 +++ b/pEpObjCAdapterFramework/PEPEngineTypes.h	Mon Sep 23 12:11:24 2019 +0200
     2.3 @@ -11,259 +11,241 @@
     2.4  
     2.5  #import <Foundation/Foundation.h>
     2.6  
     2.7 -typedef NS_ENUM(int, PEPDecryptFlags) {
     2.8 -    PEPDecryptFlagsNone = 0x1, // This defined only in the adpater, not the engine.
     2.9 -    PEPDecryptFlagsOwnPrivateKey = 0x1, // PEP_decrypt_flag_own_private_key = 0x1,
    2.10 -    PEPDecryptFlagsConsume = 0x2, // PEP_decrypt_flag_consume = 0x2,
    2.11 -    PEPDecryptFlagsIgnore = 0x4, // PEP_decrypt_flag_ignore = 0x4,
    2.12 -    PEPDecryptFlagsSrcModified = 0x8, // PEP_decrypt_flag_src_modified = 0x8,
    2.13 -    // input flags
    2.14 -    PEPDecryptFlagsUntrustedServer = 0x100 // PEP_decrypt_flag_untrusted_server = 0x100
    2.15 -}; // PEP_decrypt_flags;
    2.16 -
    2.17 -typedef NS_ENUM(int, PEPEncFormat) {
    2.18 -    PEPEncFormatNone = 0, // PEP_enc_none = 0, // message is not encrypted
    2.19 -    PEPEncFormatPieces, // PEP_enc_pieces, // inline PGP + PGP extensions
    2.20 -    PEPEncFormatSMIME, // PEP_enc_S_MIME, // RFC5751
    2.21 -    PEPEncFormatPgpMIME, // PEP_enc_PGP_MIME, // RFC3156
    2.22 -    PEPEncFormatPEP, // PEP_enc_PEP, // pEp encryption format
    2.23 -    PEPEncFormatPgpMIMEOutlook1 // PEP_enc_PGP_MIME_Outlook1 // Message B0rken by Outlook type 1
    2.24 +typedef NS_CLOSED_ENUM(int, PEPDecryptFlags) {
    2.25 +    PEPDecryptFlagsNone = 0x0, // not actually defined in the engine
    2.26 +    PEPDecryptFlagsOwnPrivateKey = 0x1, // PEP_decrypt_flag_own_private_key
    2.27 +    PEPDecryptFlagsConsume = 0x2, //PEP_decrypt_flag_consume
    2.28 +    PEPDecryptFlagsIgnore = 0x4, // PEP_decrypt_flag_ignore
    2.29 +    PEPDecryptFlagsSourceModified = 0x8, // PEP_decrypt_flag_src_modified
    2.30 +    PEPDecryptFlagsUntrustedServer = 0x100, // PEP_decrypt_flag_untrusted_server
    2.31 +    PEPDecryptFlagsDontTriggerSync = 0x200, // PEP_decrypt_flag_dont_trigger_sync
    2.32  };
    2.33  
    2.34 -typedef NS_ENUM(int, PEPRating) {
    2.35 -    PEPRatingUndefined = 0,// PEP_rating_undefined = 0,
    2.36 -    PEPRatingCannotDecrypt, // PEP_rating_cannot_decrypt,
    2.37 -    PEPRatingHaveNoKey, // PEP_rating_have_no_key,
    2.38 -    PEPRatingUnencrypted, // PEP_rating_unencrypted,
    2.39 -    PEPRatingUnencryptedForSome, // PEP_rating_unencrypted_for_some, // don't use this any more
    2.40 -    PEPRatingUnreliable, // PEP_rating_unreliable,
    2.41 -    PEPRatingReliable, // PEP_rating_reliable,
    2.42 -    PEPRatingTrusted, // PEP_rating_trusted,
    2.43 -    PEPRatingTrustedAndAnonymized, // PEP_rating_trusted_and_anonymized,
    2.44 -    PEPRatingFullyAnonymous, // PEP_rating_fully_anonymous,
    2.45 -
    2.46 -    PEPRatingMistrust = -1, // PEP_rating_mistrust = -1,
    2.47 -    PEPRatingB0rken = -2, // PEP_rating_b0rken = -2,
    2.48 -    PEPRatingUnderAttack = -3 // PEP_rating_under_attack = -3
    2.49 +typedef NS_CLOSED_ENUM(int, PEPEncFormat) {
    2.50 +    PEPEncFormatNone = 0, // PEP_enc_none
    2.51 +    PEPEncFormatPieces, // PEP_enc_pieces, PEP_enc_inline
    2.52 +    PEPEncFormatSMIME, // PEP_enc_S_MIME
    2.53 +    PEPEncFormatPGPMIME, // PEP_enc_PGP_MIME
    2.54 +    PEPEncFormatPEP, // PEP_enc_PEP
    2.55 +    PEPEncFormatPGPMIMEOutlook1 // PEP_enc_PGP_MIME_Outlook1
    2.56  };
    2.57  
    2.58 -typedef NS_ENUM(int, PEPStatus) {
    2.59 -    PEPStatusOK                                   = 0, // PEP_STATUS_OK
    2.60 +typedef NS_CLOSED_ENUM(int, PEPRating) {
    2.61 +    PEPRatingUndefined = 0, // PEP_rating_undefined
    2.62 +    PEPRatingCannotDecrypt, // PEP_rating_cannot_decrypt
    2.63 +    PEPRatingHaveNoKey, // PEP_rating_have_no_key
    2.64 +    PEPRatingUnencrypted, // PEP_rating_unencrypted
    2.65 +    PEPRatingUnencryptedForSome, // PEP_rating_unencrypted_for_some
    2.66 +    PEPRatingUnreliable, // PEP_rating_unreliable
    2.67 +    PEPRatingReliable, // PEP_rating_reliable
    2.68 +    PEPRatingTrusted, // PEP_rating_trusted
    2.69 +    PEPRatingTrustedAndAnonymized, // PEP_rating_trusted_and_anonymized
    2.70 +    PEPRatingFullyAnonymous, // PEP_rating_fully_anonymous
    2.71  
    2.72 -    PEPStatusInitCannotLoadGPME                      = 0x0110, // PEP_INIT_CANNOT_LOAD_GPGME
    2.73 -    PEPStatusInitGPGMEInitFailed                      = 0x0111, // PEP_INIT_GPGME_INIT_FAILED
    2.74 -    PEPStatusInitNoGPGHome                            = 0x0112, // PEP_INIT_NO_GPG_HOME
    2.75 -    PEPStatusInitNETPGPInitFailed                     = 0x0113, // PEP_INIT_NETPGP_INIT_FAILED
    2.76 -    PEPStatusInitCannotDetermineGPGVersion           = 0x0114, // PEP_INIT_CANNOT_DETERMINE_GPG_VERSION
    2.77 -    PEPStatusInitUnsupportedGPGVersion                = 0x0115, // PEP_INIT_UNSUPPORTED_GPG_VERSION
    2.78 -    PEPStatusInitCannotConfigGPGAgent                = 0x0116, // PEP_INIT_CANNOT_CONFIG_GPG_AGENT
    2.79 +    PEPRatingMistrust = -1, // PEP_rating_mistrust
    2.80 +    PEPRatingB0rken = -2, // PEP_rating_b0rken
    2.81 +    PEPRatingUnderAttack = -3 // PEP_rating_under_attack
    2.82 +};
    2.83  
    2.84 -    PEPStatusInitSqlite3WithoutMutex                  = 0x0120, // PEP_INIT_SQLITE3_WITHOUT_MUTEX
    2.85 -    PEPStatusInitCannotOpenDB                         = 0x0121, // PEP_INIT_CANNOT_OPEN_DB
    2.86 -    PEPStatusInitCannotOpenSystemDB                  = 0x0122, // PEP_INIT_CANNOT_OPEN_SYSTEM_DB
    2.87 -    PEPStatusUnknownDBError                            = 0x01ff, // PEP_UNKNOWN_DB_ERROR
    2.88 +typedef NS_CLOSED_ENUM(int, PEPStatus) {
    2.89 +    PEPStatusOK = 0, // PEP_STATUS_OK
    2.90  
    2.91 -    PEPStatusKeyNotFound                               = 0x0201, // PEP_KEY_NOT_FOUND
    2.92 -    PEPStatusKeyHasAmbigName                          = 0x0202, // PEP_KEY_HAS_AMBIG_NAME
    2.93 -    PEPStatusGetKeyFailed                              = 0x0203, // PEP_GET_KEY_FAILED
    2.94 -    PEPStatusCannotExportKey                           = 0x0204, // PEP_CANNOT_EXPORT_KEY
    2.95 -    PEPStatusCannotEditKey                             = 0x0205, // PEP_CANNOT_EDIT_KEY
    2.96 -    PEPStatusKeyUnsuitable                              = 0x0206, // PEP_KEY_UNSUITABLE
    2.97 -    PEPStatusMalformedKeyResetMsg                     = 0x0210, // PEP_MALFORMED_KEY_RESET_MSG
    2.98 -    PEPStatusKeyNotReset                               = 0x0211, // PEP_KEY_NOT_RESET
    2.99 +    PEPStatusInitCannotLoadGPME = 0x0110, // PEP_INIT_CANNOT_LOAD_GPGME
   2.100 +    PEPStatusInitGPGMEInitFailed = 0x0111, // PEP_INIT_GPGME_INIT_FAILED
   2.101 +    PEPStatusInitNoGPGHome = 0x0112, // PEP_INIT_NO_GPG_HOME
   2.102 +    PEPStatusInitNETPGPInitFailed = 0x0113, // PEP_INIT_NETPGP_INIT_FAILED
   2.103 +    PEPStatusInitCannotDetermineGPGVersion = 0x0114, // PEP_INIT_CANNOT_DETERMINE_GPG_VERSION
   2.104 +    PEPStatusInitUnsupportedGPGVersion = 0x0115, // PEP_INIT_UNSUPPORTED_GPG_VERSION
   2.105 +    PEPStatusInitCannotConfigGPGAgent = 0x0116, // PEP_INIT_CANNOT_CONFIG_GPG_AGENT
   2.106  
   2.107 -    PEPStatusKeyImported                                = 0x0220, // PEP_KEY_IMPORTED
   2.108 -    PEPStatusNoKeyImported                             = 0x0221, // PEP_NO_KEY_IMPORTED
   2.109 -    PEPStatusKeyImportStatusUnknown                   = 0x0222, // PEP_KEY_IMPORT_STATUS_UNKNOWN
   2.110 +    PEPStatusInitSqlite3WithoutMutex = 0x0120, // PEP_INIT_SQLITE3_WITHOUT_MUTEX
   2.111 +    PEPStatusInitCannotOpenDB = 0x0121, // PEP_INIT_CANNOT_OPEN_DB
   2.112 +    PEPStatusInitCannotOpenSystemDB = 0x0122, // PEP_INIT_CANNOT_OPEN_SYSTEM_DB
   2.113 +    PEPStatusUnknownDBError = 0x01ff, // PEP_UNKNOWN_DB_ERROR
   2.114  
   2.115 -    PEPStatusCannotFindIdentity                        = 0x0301, // PEP_CANNOT_FIND_IDENTITY
   2.116 -    PEPStatusCannotSetPerson                           = 0x0381, // PEP_CANNOT_SET_PERSON
   2.117 -    PEPStatusCannotSetPGPKeyPair                      = 0x0382, // PEP_CANNOT_SET_PGP_KEYPAIR
   2.118 -    PEPStatusCannotSetIdentity                         = 0x0383, // PEP_CANNOT_SET_IDENTITY
   2.119 -    PEPStatusCannotSetTrust                            = 0x0384, // PEP_CANNOT_SET_TRUST
   2.120 -    PEPStatusKeyBlacklisted                             = 0x0385, // PEP_KEY_BLACKLISTED
   2.121 -    PEPStatusCannotFindPerson                          = 0x0386, // PEP_CANNOT_FIND_PERSON
   2.122 +    PEPStatusKeyNotFound = 0x0201, // PEP_KEY_NOT_FOUND
   2.123 +    PEPStatusKeyHasAmbigName = 0x0202, // PEP_KEY_HAS_AMBIG_NAME
   2.124 +    PEPStatusGetKeyFailed = 0x0203, // PEP_GET_KEY_FAILED
   2.125 +    PEPStatusCannotExportKey = 0x0204, // PEP_CANNOT_EXPORT_KEY
   2.126 +    PEPStatusCannotEditKey = 0x0205, // PEP_CANNOT_EDIT_KEY
   2.127 +    PEPStatusKeyUnsuitable = 0x0206, // PEP_KEY_UNSUITABLE
   2.128 +    PEPStatusMalformedKeyResetMsg = 0x0210, // PEP_MALFORMED_KEY_RESET_MSG
   2.129 +    PEPStatusKeyNotReset = 0x0211, // PEP_KEY_NOT_RESET
   2.130 +    PEPStatusCannotDeleteKey = 0x0212, // PEP_CANNOT_DELETE_KEY
   2.131 +
   2.132 +    PEPStatusKeyImported = 0x0220, // PEP_KEY_IMPORTED
   2.133 +    PEPStatusNoKeyImported = 0x0221, // PEP_NO_KEY_IMPORTED
   2.134 +    PEPStatusKeyImportStatusUnknown = 0x0222, // PEP_KEY_IMPORT_STATUS_UNKNOWN
   2.135 +    PEPStatusSomeKeysImported = 0x0223, // PEP_SOME_KEYS_IMPORTED
   2.136 +
   2.137 +    PEPStatusCannotFindIdentity = 0x0301, // PEP_CANNOT_FIND_IDENTITY
   2.138 +    PEPStatusCannotSetPerson = 0x0381, // PEP_CANNOT_SET_PERSON
   2.139 +    PEPStatusCannotSetPGPKeyPair = 0x0382, // PEP_CANNOT_SET_PGP_KEYPAIR
   2.140 +    PEPStatusCannotSetIdentity = 0x0383, // PEP_CANNOT_SET_IDENTITY
   2.141 +    PEPStatusCannotSetTrust = 0x0384, // PEP_CANNOT_SET_TRUST
   2.142 +    PEPStatusKeyBlacklisted = 0x0385, // PEP_KEY_BLACKLISTED
   2.143 +    PEPStatusCannotFindPerson = 0x0386, // PEP_CANNOT_FIND_PERSON
   2.144      PEPStatusCannotSetPEPVersion = 0X0387, // PEP_CANNOT_SET_PEP_VERSION
   2.145  
   2.146 -    PEPStatusCannotFindAlias                           = 0x0391, // PEP_CANNOT_FIND_ALIAS
   2.147 -    PEPStatusCannotSetAlias                            = 0x0392, // PEP_CANNOT_SET_ALIAS
   2.148 +    PEPStatusCannotFindAlias = 0x0391, // PEP_CANNOT_FIND_ALIAS
   2.149 +    PEPStatusCannotSetAlias = 0x0392, // PEP_CANNOT_SET_ALIAS
   2.150  
   2.151 -    PEPStatusUnencrypted                                 = 0x0400, // PEP_UNENCRYPTED
   2.152 -    PEPStatusVerified                                    = 0x0401, // PEP_VERIFIED
   2.153 -    PEPStatusDecrypted                                   = 0x0402, // PEP_DECRYPTED
   2.154 -    PEPStatusDecryptedAndVerified                      = 0x0403, // PEP_DECRYPTED_AND_VERIFIED
   2.155 -    PEPStatusDecryptWrongFormat                        = 0x0404, // PEP_DECRYPT_WRONG_FORMAT
   2.156 -    PEPStatusDecryptNoKey                              = 0x0405, // PEP_DECRYPT_NO_KEY
   2.157 -    PEPStatusDecryptSignatureDoesNotMatch            = 0x0406, // PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH
   2.158 -    PEPStatusVerifyNoKey                               = 0x0407, // PEP_VERIFY_NO_KEY
   2.159 -    PEPStatusVerifiedAndTrusted                        = 0x0408, // PEP_VERIFIED_AND_TRUSTED
   2.160 -    PEPStatusCannotReencrypt                            = 0x0409, // PEP_CANNOT_REENCRYPT
   2.161 -    PEPStatusCannotDecryptUnknown                      = 0x04ff, // PEP_CANNOT_DECRYPT_UNKNOWN
   2.162 +    PEPStatusUnencrypted = 0x0400, // PEP_UNENCRYPTED
   2.163 +    PEPStatusVerified = 0x0401, // PEP_VERIFIED
   2.164 +    PEPStatusDecrypted = 0x0402, // PEP_DECRYPTED
   2.165 +    PEPStatusDecryptedAndVerified = 0x0403, // PEP_DECRYPTED_AND_VERIFIED
   2.166 +    PEPStatusDecryptWrongFormat = 0x0404, // PEP_DECRYPT_WRONG_FORMAT
   2.167 +    PEPStatusDecryptNoKey = 0x0405, // PEP_DECRYPT_NO_KEY
   2.168 +    PEPStatusDecryptSignatureDoesNotMatch = 0x0406, // PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH
   2.169 +    PEPStatusVerifyNoKey = 0x0407, // PEP_VERIFY_NO_KEY
   2.170 +    PEPStatusVerifiedAndTrusted = 0x0408, // PEP_VERIFIED_AND_TRUSTED
   2.171 +    PEPStatusCannotReencrypt = 0x0409, // PEP_CANNOT_REENCRYPT
   2.172 +    PEPStatusCannotDecryptUnknown = 0x04ff, // PEP_CANNOT_DECRYPT_UNKNOWN
   2.173  
   2.174 -    PEPStatusTrustwordNotFound                         = 0x0501, // PEP_TRUSTWORD_NOT_FOUND
   2.175 -    PEPStatusTrustwordsFPRWrongLength                 = 0x0502, // PEP_TRUSTWORDS_FPR_WRONG_LENGTH
   2.176 -    PEPStatusTrustwordsDuplicateFPR                    = 0x0503, // PEP_TRUSTWORDS_DUPLICATE_FPR
   2.177 +    PEPStatusTrustwordNotFound = 0x0501, // PEP_TRUSTWORD_NOT_FOUND
   2.178 +    PEPStatusTrustwordsFPRWrongLength = 0x0502, // PEP_TRUSTWORDS_FPR_WRONG_LENGTH
   2.179 +    PEPStatusTrustwordsDuplicateFPR = 0x0503, // PEP_TRUSTWORDS_DUPLICATE_FPR
   2.180  
   2.181 -    PEPStatusCannotCreateKey                           = 0x0601, // PEP_CANNOT_CREATE_KEY
   2.182 -    PEPStatusCannotSendKey                             = 0x0602, // PEP_CANNOT_SEND_KEY
   2.183 +    PEPStatusCannotCreateKey = 0x0601, // PEP_CANNOT_CREATE_KEY
   2.184 +    PEPStatusCannotSendKey = 0x0602, // PEP_CANNOT_SEND_KEY
   2.185  
   2.186 -    PEPStatusPhraseNotFound                            = 0x0701, // PEP_PHRASE_NOT_FOUND
   2.187 +    PEPStatusPhraseNotFound = 0x0701, // PEP_PHRASE_NOT_FOUND
   2.188  
   2.189 -    PEPStatusSendFunctionNotRegistered                = 0x0801, // PEP_SEND_FUNCTION_NOT_REGISTERED
   2.190 -    PEPStatusConstraintsViolated                         = 0x0802, // PEP_CONTRAINTS_VIOLATED
   2.191 -    PEPStatusCannotEncode                               = 0x0803, // PEP_CANNOT_ENCODE
   2.192 +    PEPStatusSendFunctionNotRegistered = 0x0801, // PEP_SEND_FUNCTION_NOT_REGISTERED
   2.193 +    PEPStatusConstraintsViolated = 0x0802, // PEP_CONTRAINTS_VIOLATED
   2.194 +    PEPStatusCannotEncode = 0x0803, // PEP_CANNOT_ENCODE
   2.195  
   2.196 -    PEPStatusSyncNoNotifyCallback                     = 0x0901, // PEP_SYNC_NO_NOTIFY_CALLBACK
   2.197 -    PEPStatusSyncIllegalMessage                        = 0x0902, // PEP_SYNC_ILLEGAL_MESSAGE
   2.198 -    PEPStatusSyncNoInjectCallback                     = 0x0903, // PEP_SYNC_NO_INJECT_CALLBACK
   2.199 -    PEPStatusSyncNoChannel                             = 0x0904, // PEP_SYNC_NO_CHANNEL
   2.200 -    PEPStatusSyncCannotEncrypt                         = 0x0905, // PEP_SYNC_CANNOT_ENCRYPT
   2.201 -    PEPStatusSyncNoMessageSendCallback               = 0x0906, // PEP_SYNC_NO_MESSAGE_SEND_CALLBACK
   2.202 +    PEPStatusSyncNoNotifyCallback = 0x0901, // PEP_SYNC_NO_NOTIFY_CALLBACK
   2.203 +    PEPStatusSyncIllegalMessage = 0x0902, // PEP_SYNC_ILLEGAL_MESSAGE
   2.204 +    PEPStatusSyncNoInjectCallback = 0x0903, // PEP_SYNC_NO_INJECT_CALLBACK
   2.205 +    PEPStatusSyncNoChannel = 0x0904, // PEP_SYNC_NO_CHANNEL
   2.206 +    PEPStatusSyncCannotEncrypt = 0x0905, // PEP_SYNC_CANNOT_ENCRYPT
   2.207 +    PEPStatusSyncNoMessageSendCallback = 0x0906, // PEP_SYNC_NO_MESSAGE_SEND_CALLBACK
   2.208 +    PEPStatusSyncCannotStart = 0x0907, // PEP_SYNC_CANNOT_START
   2.209  
   2.210 -    PEPStatusCannotIncreaseSequence                    = 0x0971, // PEP_CANNOT_INCREASE_SEQUENCE
   2.211 +    PEPStatusCannotIncreaseSequence = 0x0971, // PEP_CANNOT_INCREASE_SEQUENCE
   2.212  
   2.213 -    PEPStatusStatemachineError                          = 0x0980, // PEP_STATEMACHINE_ERROR
   2.214 -    PEPStatusNoTrust                                    = 0x0981, // PEP_NO_TRUST
   2.215 -    PEPStatusStatemachineInvalidState                  = 0x0982, // PEP_STATEMACHINE_INVALID_STATE
   2.216 -    PEPStatusStatemachineInvalidEvent                  = 0x0983, // PEP_STATEMACHINE_INVALID_EVENT
   2.217 -    PEPStatusStatemachineInvalidCondition              = 0x0984, // PEP_STATEMACHINE_INVALID_CONDITION
   2.218 -    PEPStatusStatemachineInvalidAction                 = 0x0985, // PEP_STATEMACHINE_INVALID_ACTION
   2.219 -    PEPStatusStatemachineInhibitedEvent                = 0x0986, // PEP_STATEMACHINE_INHIBITED_EVENT
   2.220 -    PEPStatusStatemachineCannotSend                    = 0x0987, // PEP_STATEMACHINE_CANNOT_SEND
   2.221 +    PEPStatusStatemachineError = 0x0980, // PEP_STATEMACHINE_ERROR
   2.222 +    PEPStatusNoTrust = 0x0981, // PEP_NO_TRUST
   2.223 +    PEPStatusStatemachineInvalidState = 0x0982, // PEP_STATEMACHINE_INVALID_STATE
   2.224 +    PEPStatusStatemachineInvalidEvent = 0x0983, // PEP_STATEMACHINE_INVALID_EVENT
   2.225 +    PEPStatusStatemachineInvalidCondition = 0x0984, // PEP_STATEMACHINE_INVALID_CONDITION
   2.226 +    PEPStatusStatemachineInvalidAction = 0x0985, // PEP_STATEMACHINE_INVALID_ACTION
   2.227 +    PEPStatusStatemachineInhibitedEvent = 0x0986, // PEP_STATEMACHINE_INHIBITED_EVENT
   2.228 +    PEPStatusStatemachineCannotSend = 0x0987, // PEP_STATEMACHINE_CANNOT_SEND
   2.229  
   2.230 -    PEPStatusCommitFailed                               = 0xff01, // PEP_COMMIT_FAILED
   2.231 -    PEPStatusMessageConsume                             = 0xff02, // PEP_MESSAGE_CONSUME
   2.232 -    PEPStatusMessageIgnore                              = 0xff03, // PEP_MESSAGE_IGNORE
   2.233 +    PEPStatusCommitFailed = 0xff01, // PEP_COMMIT_FAILED
   2.234 +    PEPStatusMessageConsume = 0xff02, // PEP_MESSAGE_CONSUME
   2.235 +    PEPStatusMessageIgnore = 0xff03, // PEP_MESSAGE_IGNORE
   2.236 +    PEPStatusCannotConfig = 0xff04, // PEP_CANNOT_CONFIG
   2.237  
   2.238 -    PEPStatusRecordNotFound                            = -6, // PEP_RECORD_NOT_FOUND
   2.239 -    PEPStatusCannotCreateTempFile                     = -5, // PEP_CANNOT_CREATE_TEMP_FILE
   2.240 -    PEPStatusIllegalValue                               = -4, // PEP_ILLEGAL_VALUE
   2.241 -    PEPStatusBufferTooSmall                            = -3, // PEP_BUFFER_TOO_SMALL
   2.242 -    PEPStatusOutOfMemory                               = -2, // PEP_OUT_OF_MEMORY
   2.243 -    PEPStatusUnknownError                               = -1, // PEP_UNKNOWN_ERROR
   2.244 +    PEPStatusRecordNotFound = -6, // PEP_RECORD_NOT_FOUND
   2.245 +    PEPStatusCannotCreateTempFile = -5, // PEP_CANNOT_CREATE_TEMP_FILE
   2.246 +    PEPStatusIllegalValue = -4, // PEP_ILLEGAL_VALUE
   2.247 +    PEPStatusBufferTooSmall = -3, // PEP_BUFFER_TOO_SMALL
   2.248 +    PEPStatusOutOfMemory = -2, // PEP_OUT_OF_MEMORY
   2.249 +    PEPStatusUnknownError = -1, // PEP_UNKNOWN_ERROR
   2.250  
   2.251 -    PEPStatusVersionMismatch                            = -7, // PEP_VERSION_MISMATCH
   2.252 +    PEPStatusVersionMismatch = -7, // PEP_VERSION_MISMATCH
   2.253  };
   2.254  
   2.255 -typedef NS_ENUM(int, PEPIdentityFlags) {
   2.256 -    // the first octet flags are app defined settings
   2.257 -    PEPIdentityFlagsNotForSync = 0x0001, // PEP_idf_not_for_sync = 0x0001,   // don't use this identity for sync
   2.258 -    PEPIdentityFlagsList = 0x0002, // PEP_idf_list = 0x0002,           // identity of list of persons
   2.259 -    // the second octet flags are calculated
   2.260 -    PEPIdentityFlagsDeviceGroup = 0x0100 // PEP_idf_devicegroup = 0x0100     // identity of a device group member
   2.261 +typedef NS_CLOSED_ENUM(int, PEPIdentityFlags) {
   2.262 +    PEPIdentityFlagsNotForSync = 0x0001, // PEP_idf_not_for_sync
   2.263 +    PEPIdentityFlagsList = 0x0002, // PEP_idf_list = 0x0002
   2.264 +    PEPIdentityFlagsDeviceGroup = 0x0100 // PEP_idf_devicegroup
   2.265  };
   2.266  
   2.267 -typedef NS_ENUM(int, PEPSyncHandshakeSignal) { // _sync_handshake_signal
   2.268 -    PEPSyncHandshakeSignalUndefined = 0, // SYNC_NOTIFY_UNDEFINED = 0,
   2.269 +typedef NS_CLOSED_ENUM(int, PEPSyncHandshakeSignal) {
   2.270 +    PEPSyncHandshakeSignalUndefined = 0, // SYNC_NOTIFY_UNDEFINED
   2.271  
   2.272 -    // request show handshake dialog
   2.273 -    PEPSyncHandshakeSignalInitAddOurDevice = 1, // SYNC_NOTIFY_INIT_ADD_OUR_DEVICE = 1,
   2.274 -    PEPSyncHandshakeSignalInitAddOtherDevice = 2, // SYNC_NOTIFY_INIT_ADD_OTHER_DEVICE = 2,
   2.275 -    PEPSyncHandshakeSignalInitFormGroup = 3, // SYNC_NOTIFY_INIT_FORM_GROUP = 3,
   2.276 -    // SYNC_NOTIFY_INIT_MOVE_OUR_DEVICE = 4,
   2.277 +    PEPSyncHandshakeSignalInitAddOurDevice = 1, // SYNC_NOTIFY_INIT_ADD_OUR_DEVICE
   2.278 +    PEPSyncHandshakeSignalInitAddOtherDevice = 2, // SYNC_NOTIFY_INIT_ADD_OTHER_DEVICE
   2.279 +    PEPSyncHandshakeSignalInitFormGroup = 3, // SYNC_NOTIFY_INIT_FORM_GROUP
   2.280  
   2.281 -    // handshake process timed out
   2.282 -    PEPSyncHandshakeSignalTimeout = 5, // SYNC_NOTIFY_TIMEOUT = 5,
   2.283 +    PEPSyncHandshakeSignalTimeout = 5, // SYNC_NOTIFY_TIMEOUT
   2.284  
   2.285 -    // handshake accepted by user
   2.286 -    PEPSyncHandshakeSignalAcceptedDeviceAdded = 6, // SYNC_NOTIFY_ACCEPTED_DEVICE_ADDED = 6,
   2.287 -    PEPSyncHandshakeSignalAcceptedGroupCreated = 7, // SYNC_NOTIFY_ACCEPTED_GROUP_CREATED = 7,
   2.288 -    // SYNC_NOTIFY_ACCEPTED_DEVICE_MOVED = 8,
   2.289 +    PEPSyncHandshakeSignalAcceptedDeviceAdded = 6, // SYNC_NOTIFY_ACCEPTED_DEVICE_ADDED
   2.290 +    PEPSyncHandshakeSignalAcceptedGroupCreated = 7, // SYNC_NOTIFY_ACCEPTED_GROUP_CREATED
   2.291  
   2.292 -    // handshake dialog must be closed
   2.293 -    PEPSyncHandshakeSignalOvertaken = 9, // SYNC_NOTIFY_OVERTAKEN = 9,
   2.294 +    PEPSyncHandshakeSignalOvertaken = 9, // SYNC_NOTIFY_OVERTAKEN
   2.295  
   2.296 -    /** currently exchanging private keys */
   2.297 -    PEPSyncHandshakeSignalFormingGroup = 10, // SYNC_NOTIFY_FORMING_GROUP = 10
   2.298 +    PEPSyncHandshakeSignalFormingGroup = 10, // SYNC_NOTIFY_FORMING_GROUP
   2.299  
   2.300 -    // notificaton of actual group status
   2.301 -    PEPSyncHandshakeSignalSole = 254, // SYNC_NOTIFY_SOLE = 254,
   2.302 -    PEPSyncHandshakeSignalInGroup = 255 // SYNC_NOTIFY_IN_GROUP = 255
   2.303 +    PEPSyncHandshakeSignalSole = 254, // SYNC_NOTIFY_SOLE
   2.304 +    PEPSyncHandshakeSignalInGroup = 255 // SYNC_NOTIFY_IN_GROUP
   2.305  };
   2.306  
   2.307 -typedef NS_ENUM(int, PEPSyncHandshakeResult) {
   2.308 -    PEPSyncHandshakeResultCancel = -1, // SYNC_HANDSHAKE_CANCEL = -1,
   2.309 -    PEPSyncHandshakeResultAccepted = 0, // SYNC_HANDSHAKE_ACCEPTED = 0,
   2.310 -    PEPSyncHandshakeResultRejected = 1 // SYNC_HANDSHAKE_REJECTED = 1
   2.311 +typedef NS_CLOSED_ENUM(int, PEPSyncHandshakeResult) {
   2.312 +    PEPSyncHandshakeResultCancel = -1, // SYNC_HANDSHAKE_CANCEL
   2.313 +    PEPSyncHandshakeResultAccepted = 0, // SYNC_HANDSHAKE_ACCEPTED
   2.314 +    PEPSyncHandshakeResultRejected = 1 // SYNC_HANDSHAKE_REJECTED
   2.315  };
   2.316  
   2.317 -typedef NS_ENUM(int, PEPCommType) {
   2.318 -    PEPCommTypeUnknown = 0, // PEP_ct_unknown = 0,
   2.319 +typedef NS_CLOSED_ENUM(int, PEPCommType) {
   2.320 +    PEPCommTypeUnknown = 0, // PEP_ct_unknown
   2.321 +    PEPCommTypeNoEncryption = 0x01, // PEP_ct_no_encryption
   2.322 +    PEPCommTypeNoEncrypted_channel = 0x02, // PEP_ct_no_encrypted_channel
   2.323 +    PEPCommTypeKeyNotFound = 0x03, // PEP_ct_key_not_found
   2.324 +    PEPCommTypeKeyExpired = 0x04, // PEP_ct_key_expired
   2.325 +    PEPCommTypeKeyRevoked = 0x05, // PEP_ct_key_revoked
   2.326 +    PEPCommTypeKeyB0rken = 0x06, // PEP_ct_key_b0rken
   2.327 +    PEPCommTypeKeyExpiredButConfirmed = 0x07, // PEP_ct_key_expired_but_confirmed renewal.
   2.328 +    PEPCommTypeMyKeyNotIncluded = 0x09, // PEP_ct_my_key_not_included
   2.329  
   2.330 -    // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable
   2.331 +    PEPCommTypeSecurityByObscurity = 0x0a, // PEP_ct_security_by_obscurity
   2.332 +    PEPCommTypeB0rkenCrypto = 0x0b, // PEP_ct_b0rken_crypto
   2.333 +    PEPCommTypeKeyTooShort = 0x0c, // PEP_ct_key_too_short
   2.334  
   2.335 -    PEPCommTypeNoEncryption = 0x01, // PEP_ct_no_encryption = 0x01,                // generic
   2.336 -    PEPCommTypeNoEncrypted_channel = 0x02, // PEP_ct_no_encrypted_channel = 0x02,
   2.337 -    PEPCommTypeKeyNotFound = 0x03, // PEP_ct_key_not_found = 0x03,
   2.338 -    PEPCommTypeKeyExpired = 0x04, // PEP_ct_key_expired = 0x04,
   2.339 -    PEPCommTypeKeyRevoked = 0x05, // PEP_ct_key_revoked = 0x05,
   2.340 -    PEPCommTypeKeyBr0ken = 0x06, // PEP_ct_key_b0rken = 0x06,
   2.341 -    PEPCommTypeKeyExpiredButConfirmed = 0x07, // PEP_ct_key_expired_but_confirmed = 0x07, // NOT with confirmed bit. Just retaining info here in case of renewal.
   2.342 -    PEPCommTypeMyKeyNotIncluded = 0x09, // PEP_ct_my_key_not_included = 0x09,
   2.343 +    PEPCommTypeCompromised = 0x0e, // PEP_ct_compromized
   2.344 +    PEPCommTypeMistrusted = 0x0f, // PEP_ct_mistrusted
   2.345  
   2.346 -    PEPCommTypeSecurityByObscurity = 0x0a, // PEP_ct_security_by_obscurity = 0x0a,
   2.347 -    PEPCommTypeBr0kenCrypto = 0x0b, // PEP_ct_b0rken_crypto = 0x0b,
   2.348 -    PEPCommTypeKeyTooShort = 0x0c, // PEP_ct_key_too_short = 0x0c,
   2.349 +    PEPCommTypeUnconfirmedEncryption = 0x10, // PEP_ct_unconfirmed_encryption
   2.350 +    PEPCommTypeOpenPGPWeakUnconfirmed = 0x11, // PEP_ct_OpenPGP_weak_unconfirmed
   2.351  
   2.352 -    PEPCommTypeCompromised = 0x0e, // PEP_ct_compromized = 0x0e,                  // deprecated misspelling
   2.353 -    PEPCommTypeMistrusted = 0x0f, // PEP_ct_mistrusted = 0x0f,                   // known mistrusted key
   2.354 +    PEPCommTypeToBeChecked = 0x20, // PEP_ct_to_be_checked
   2.355 +    PEPCommTypeSMIMEUnconfirmed = 0x21, // PEP_ct_SMIME_unconfirmed
   2.356 +    PEPCommTypeCMSUnconfirmed = 0x22, // PEP_ct_CMS_unconfirmed
   2.357  
   2.358 -    // range 0x10 to 0x3f: unconfirmed encryption
   2.359 +    PEPCommTypeStongButUnconfirmed = 0x30, // PEP_ct_strong_but_unconfirmed
   2.360 +    PEPCommTypeOpenPGPUnconfirmed = 0x38, // PEP_ct_OpenPGP_unconfirmed
   2.361 +    PEPCommTypeOTRUnconfirmed = 0x3a, // PEP_ct_OTR_unconfirmed
   2.362  
   2.363 -    PEPCommTypeUnconfirmedEncryption = 0x10, // PEP_ct_unconfirmed_encryption = 0x10,       // generic
   2.364 -    PEPCommTypeOpenPGPWeakUnconfirmed = 0x11, // PEP_ct_OpenPGP_weak_unconfirmed = 0x11,     // RSA 1024 is weak
   2.365 +    PEPCommTypeUnconfirmedEncAnon = 0x40, // PEP_ct_unconfirmed_enc_anon
   2.366 +    PEPCommTypePEPUnconfirmed = 0x7f, // PEP_ct_pEp_unconfirmed
   2.367  
   2.368 -    PEPCommTypeToBeChecked = 0x20, // PEP_ct_to_be_checked = 0x20,                // generic
   2.369 -    PEPCommTypeSMIMEUnconfirmed = 0x21, // PEP_ct_SMIME_unconfirmed = 0x21,
   2.370 -    PEPCommTypeCMSUnconfirmed = 0x22, // PEP_ct_CMS_unconfirmed = 0x22,
   2.371 +    PEPCommTypeConfirmed = 0x80, // PEP_ct_confirmed
   2.372  
   2.373 -    PEPCommTypeStongButUnconfirmed = 0x30, // PEP_ct_strong_but_unconfirmed = 0x30,       // generic
   2.374 -    PEPCommTypeOpenPGPUnconfirmed = 0x38, // PEP_ct_OpenPGP_unconfirmed = 0x38,          // key at least 2048 bit RSA or EC
   2.375 -    PEPCommTypeOTRUnconfirmed = 0x3a, // PEP_ct_OTR_unconfirmed = 0x3a,
   2.376 +    PEPCommTypeConfirmedEncryption = 0x90, // PEP_ct_confirmed_encryption
   2.377 +    PEPCommTypeOpenPGPWeak = 0x91, // PEP_ct_OpenPGP_weak
   2.378  
   2.379 -    // range 0x40 to 0x7f: unconfirmed encryption and anonymization
   2.380 +    PEPCommTypeToBeCheckedConfirmed = 0xa0, // PEP_ct_to_be_checked_confirmed
   2.381 +    PEPCommTypeSMIME = 0xa1, // PEP_ct_SMIME
   2.382 +    PEPCommTypeCMS = 0xa2, // PEP_ct_CMS
   2.383  
   2.384 -    PEPCommTypeUnconfirmedEncAnon = 0x40, // PEP_ct_unconfirmed_enc_anon = 0x40,         // generic
   2.385 -    PEPCommTypePEPUnconfirmed = 0x7f, // PEP_ct_pEp_unconfirmed = 0x7f,
   2.386 +    PEPCommTypeStongEncryption = 0xb0, // PEP_ct_strong_encryption
   2.387 +    PEPCommTypeOpenPGP = 0xb8, // PEP_ct_OpenPGP
   2.388 +    PEPCommTypeOTR = 0xba, // PEP_ct_OTR
   2.389  
   2.390 -    PEPCommTypeConfirmed = 0x80, // PEP_ct_confirmed = 0x80,                    // this bit decides if trust is confirmed
   2.391 -
   2.392 -    // range 0x81 to 0x8f: reserved
   2.393 -    // range 0x90 to 0xbf: confirmed encryption
   2.394 -
   2.395 -    PEPCommTypeConfirmedEncryption = 0x90, // PEP_ct_confirmed_encryption = 0x90,         // generic
   2.396 -    PEPCommTypeOpenPGPWeak = 0x91, // PEP_ct_OpenPGP_weak = 0x91,                 // RSA 1024 is weak (unused)
   2.397 -
   2.398 -    PEPCommTypeToBeCheckedConfirmed = 0xa0, // PEP_ct_to_be_checked_confirmed = 0xa0,      // generic
   2.399 -    PEPCommTypeSMIME = 0xa1, // PEP_ct_SMIME = 0xa1,
   2.400 -    PEPCommTypeCMS = 0xa2, // PEP_ct_CMS = 0xa2,
   2.401 -
   2.402 -    PEPCommTypeStongEncryption = 0xb0, // PEP_ct_strong_encryption = 0xb0,            // generic
   2.403 -    PEPCommTypeOpenPGP = 0xb8, // PEP_ct_OpenPGP = 0xb8,                      // key at least 2048 bit RSA or EC
   2.404 -    PEPCommTypeOTR = 0xba, // PEP_ct_OTR = 0xba,
   2.405 -
   2.406 -    // range 0xc0 to 0xff: confirmed encryption and anonymization
   2.407 -
   2.408 -    PEPCommTypeConfirmedEncAnon = 0xc0, // PEP_ct_confirmed_enc_anon = 0xc0,           // generic
   2.409 -    PEPCommTypePEP = 0xff // PEP_ct_pEp = 0xff
   2.410 +    PEPCommTypeConfirmedEncAnon = 0xc0, // PEP_ct_confirmed_enc_anon
   2.411 +    PEPCommTypePEP = 0xff // PEP_ct_pEp
   2.412  };
   2.413  
   2.414 -typedef NS_ENUM(int, PEPMsgDirection) {
   2.415 -    PEPMsgDirectionIncoming = 0,
   2.416 -    PEPMsgDirectionOutgoing
   2.417 +typedef NS_CLOSED_ENUM(int, PEPMsgDirection) {
   2.418 +    PEPMsgDirectionIncoming = 0, // PEP_dir_incoming
   2.419 +    PEPMsgDirectionOutgoing // PEP_dir_outgoing
   2.420  };
   2.421  
   2.422 -typedef NS_ENUM(int, PEPColor) {
   2.423 -    PEPColorNoColor = 0,
   2.424 -    PEPColorYellow,
   2.425 -    PEPColorGreen,
   2.426 -    PEPColorRed = -1,
   2.427 +typedef NS_CLOSED_ENUM(int, PEPColor) {
   2.428 +    PEPColorNoColor = 0, // PEP_color_no_color
   2.429 +    PEPColorYellow, // PEP_color_yellow
   2.430 +    PEPColorGreen, // PEP_color_green
   2.431 +    PEPColorRed = -1, // PEP_color_red
   2.432  };
   2.433  
   2.434 -typedef NS_ENUM(int, PEPContentDisposition) {
   2.435 -    PEPContentDispositionAttachment = 0,
   2.436 -    PEPContentDispositionInline = 1,
   2.437 -    PEPContentDispositionOther = -1      // must be affirmatively set
   2.438 +typedef NS_CLOSED_ENUM(int, PEPContentDisposition) {
   2.439 +    PEPContentDispositionAttachment = 0, // PEP_CONTENT_DISP_ATTACHMENT
   2.440 +    PEPContentDispositionInline = 1, // PEP_CONTENT_DISP_INLINE
   2.441 +    PEPContentDispositionOther = -1 // PEP_CONTENT_DISP_OTHER
   2.442  };
   2.443  
   2.444  #endif /* PEPTypes_h */