pEpObjCAdapterFramework/PEPEngineTypes.h
author Dirk Zimmermann <dz@pep.security>
Fri, 20 Sep 2019 17:00:26 +0200
branchIOSAD-132
changeset 1262 22d1370ec99b
parent 1261 e3d9eb6bf7d3
child 1263 7add799c474d
permissions -rw-r--r--
IOSAD-132 PEPStatusCannotConfig (PEP_CANNOT_CONFIG).
     1 //
     2 //  PEPTypes.h
     3 //  pEpObjCAdapter
     4 //
     5 //  Created by Dirk Zimmermann on 27.02.19.
     6 //  Copyright © 2019 p≡p. All rights reserved.
     7 //
     8 
     9 #ifndef PEPTypes_h
    10 #define PEPTypes_h
    11 
    12 #import <Foundation/Foundation.h>
    13 
    14 typedef NS_CLOSED_ENUM(int, PEPDecryptFlags) {
    15     PEPDecryptFlagsNone = 0x0, // not actually defined in the engine
    16     PEPDecryptFlagsOwnPrivateKey = 0x1, // PEP_decrypt_flag_own_private_key
    17     PEPDecryptFlagsConsume = 0x2, //PEP_decrypt_flag_consume
    18     PEPDecryptFlagsIgnore = 0x4, // PEP_decrypt_flag_ignore
    19     PEPDecryptFlagsSourceModified = 0x8, // PEP_decrypt_flag_src_modified
    20     PEPDecryptFlagsUntrustedServer = 0x100, // PEP_decrypt_flag_untrusted_server
    21     PEPDecryptFlagsDontTriggerSync = 0x200, // PEP_decrypt_flag_dont_trigger_sync
    22 };
    23 
    24 typedef NS_ENUM(int, PEPEncFormat) {
    25     PEPEncFormatNone = 0, // PEP_enc_none
    26     PEPEncFormatPieces, // PEP_enc_pieces, PEP_enc_inline
    27     PEPEncFormatSMIME, // PEP_enc_S_MIME
    28     PEPEncFormatPGPMIME, // PEP_enc_PGP_MIME
    29     PEPEncFormatPEP, // PEP_enc_PEP
    30     PEPEncFormatPGPMIMEOutlook1 // PEP_enc_PGP_MIME_Outlook1
    31 };
    32 
    33 typedef NS_ENUM(int, PEPRating) {
    34     PEPRatingUndefined = 0, // PEP_rating_undefined
    35     PEPRatingCannotDecrypt, // PEP_rating_cannot_decrypt
    36     PEPRatingHaveNoKey, // PEP_rating_have_no_key
    37     PEPRatingUnencrypted, // PEP_rating_unencrypted
    38     PEPRatingUnencryptedForSome, // PEP_rating_unencrypted_for_some
    39     PEPRatingUnreliable, // PEP_rating_unreliable
    40     PEPRatingReliable, // PEP_rating_reliable
    41     PEPRatingTrusted, // PEP_rating_trusted
    42     PEPRatingTrustedAndAnonymized, // PEP_rating_trusted_and_anonymized
    43     PEPRatingFullyAnonymous, // PEP_rating_fully_anonymous
    44 
    45     PEPRatingMistrust = -1, // PEP_rating_mistrust
    46     PEPRatingB0rken = -2, // PEP_rating_b0rken
    47     PEPRatingUnderAttack = -3 // PEP_rating_under_attack
    48 };
    49 
    50 typedef NS_ENUM(int, PEPStatus) {
    51     PEPStatusOK = 0, // PEP_STATUS_OK
    52 
    53     PEPStatusInitCannotLoadGPME = 0x0110, // PEP_INIT_CANNOT_LOAD_GPGME
    54     PEPStatusInitGPGMEInitFailed = 0x0111, // PEP_INIT_GPGME_INIT_FAILED
    55     PEPStatusInitNoGPGHome = 0x0112, // PEP_INIT_NO_GPG_HOME
    56     PEPStatusInitNETPGPInitFailed = 0x0113, // PEP_INIT_NETPGP_INIT_FAILED
    57     PEPStatusInitCannotDetermineGPGVersion = 0x0114, // PEP_INIT_CANNOT_DETERMINE_GPG_VERSION
    58     PEPStatusInitUnsupportedGPGVersion = 0x0115, // PEP_INIT_UNSUPPORTED_GPG_VERSION
    59     PEPStatusInitCannotConfigGPGAgent = 0x0116, // PEP_INIT_CANNOT_CONFIG_GPG_AGENT
    60 
    61     PEPStatusInitSqlite3WithoutMutex = 0x0120, // PEP_INIT_SQLITE3_WITHOUT_MUTEX
    62     PEPStatusInitCannotOpenDB = 0x0121, // PEP_INIT_CANNOT_OPEN_DB
    63     PEPStatusInitCannotOpenSystemDB = 0x0122, // PEP_INIT_CANNOT_OPEN_SYSTEM_DB
    64     PEPStatusUnknownDBError = 0x01ff, // PEP_UNKNOWN_DB_ERROR
    65 
    66     PEPStatusKeyNotFound = 0x0201, // PEP_KEY_NOT_FOUND
    67     PEPStatusKeyHasAmbigName = 0x0202, // PEP_KEY_HAS_AMBIG_NAME
    68     PEPStatusGetKeyFailed = 0x0203, // PEP_GET_KEY_FAILED
    69     PEPStatusCannotExportKey = 0x0204, // PEP_CANNOT_EXPORT_KEY
    70     PEPStatusCannotEditKey = 0x0205, // PEP_CANNOT_EDIT_KEY
    71     PEPStatusKeyUnsuitable = 0x0206, // PEP_KEY_UNSUITABLE
    72     PEPStatusMalformedKeyResetMsg = 0x0210, // PEP_MALFORMED_KEY_RESET_MSG
    73     PEPStatusKeyNotReset = 0x0211, // PEP_KEY_NOT_RESET
    74     PEPStatusCannotDeleteKey = 0x0212, // PEP_CANNOT_DELETE_KEY
    75 
    76     PEPStatusKeyImported = 0x0220, // PEP_KEY_IMPORTED
    77     PEPStatusNoKeyImported = 0x0221, // PEP_NO_KEY_IMPORTED
    78     PEPStatusKeyImportStatusUnknown = 0x0222, // PEP_KEY_IMPORT_STATUS_UNKNOWN
    79     PEPStatusSomeKeysImported = 0x0223, // PEP_SOME_KEYS_IMPORTED
    80 
    81     PEPStatusCannotFindIdentity = 0x0301, // PEP_CANNOT_FIND_IDENTITY
    82     PEPStatusCannotSetPerson = 0x0381, // PEP_CANNOT_SET_PERSON
    83     PEPStatusCannotSetPGPKeyPair = 0x0382, // PEP_CANNOT_SET_PGP_KEYPAIR
    84     PEPStatusCannotSetIdentity = 0x0383, // PEP_CANNOT_SET_IDENTITY
    85     PEPStatusCannotSetTrust = 0x0384, // PEP_CANNOT_SET_TRUST
    86     PEPStatusKeyBlacklisted = 0x0385, // PEP_KEY_BLACKLISTED
    87     PEPStatusCannotFindPerson = 0x0386, // PEP_CANNOT_FIND_PERSON
    88     PEPStatusCannotSetPEPVersion = 0X0387, // PEP_CANNOT_SET_PEP_VERSION
    89 
    90     PEPStatusCannotFindAlias = 0x0391, // PEP_CANNOT_FIND_ALIAS
    91     PEPStatusCannotSetAlias = 0x0392, // PEP_CANNOT_SET_ALIAS
    92 
    93     PEPStatusUnencrypted = 0x0400, // PEP_UNENCRYPTED
    94     PEPStatusVerified = 0x0401, // PEP_VERIFIED
    95     PEPStatusDecrypted = 0x0402, // PEP_DECRYPTED
    96     PEPStatusDecryptedAndVerified = 0x0403, // PEP_DECRYPTED_AND_VERIFIED
    97     PEPStatusDecryptWrongFormat = 0x0404, // PEP_DECRYPT_WRONG_FORMAT
    98     PEPStatusDecryptNoKey = 0x0405, // PEP_DECRYPT_NO_KEY
    99     PEPStatusDecryptSignatureDoesNotMatch = 0x0406, // PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH
   100     PEPStatusVerifyNoKey = 0x0407, // PEP_VERIFY_NO_KEY
   101     PEPStatusVerifiedAndTrusted = 0x0408, // PEP_VERIFIED_AND_TRUSTED
   102     PEPStatusCannotReencrypt = 0x0409, // PEP_CANNOT_REENCRYPT
   103     PEPStatusCannotDecryptUnknown = 0x04ff, // PEP_CANNOT_DECRYPT_UNKNOWN
   104 
   105     PEPStatusTrustwordNotFound = 0x0501, // PEP_TRUSTWORD_NOT_FOUND
   106     PEPStatusTrustwordsFPRWrongLength = 0x0502, // PEP_TRUSTWORDS_FPR_WRONG_LENGTH
   107     PEPStatusTrustwordsDuplicateFPR = 0x0503, // PEP_TRUSTWORDS_DUPLICATE_FPR
   108 
   109     PEPStatusCannotCreateKey = 0x0601, // PEP_CANNOT_CREATE_KEY
   110     PEPStatusCannotSendKey = 0x0602, // PEP_CANNOT_SEND_KEY
   111 
   112     PEPStatusPhraseNotFound = 0x0701, // PEP_PHRASE_NOT_FOUND
   113 
   114     PEPStatusSendFunctionNotRegistered = 0x0801, // PEP_SEND_FUNCTION_NOT_REGISTERED
   115     PEPStatusConstraintsViolated = 0x0802, // PEP_CONTRAINTS_VIOLATED
   116     PEPStatusCannotEncode = 0x0803, // PEP_CANNOT_ENCODE
   117 
   118     PEPStatusSyncNoNotifyCallback = 0x0901, // PEP_SYNC_NO_NOTIFY_CALLBACK
   119     PEPStatusSyncIllegalMessage = 0x0902, // PEP_SYNC_ILLEGAL_MESSAGE
   120     PEPStatusSyncNoInjectCallback = 0x0903, // PEP_SYNC_NO_INJECT_CALLBACK
   121     PEPStatusSyncNoChannel = 0x0904, // PEP_SYNC_NO_CHANNEL
   122     PEPStatusSyncCannotEncrypt = 0x0905, // PEP_SYNC_CANNOT_ENCRYPT
   123     PEPStatusSyncNoMessageSendCallback = 0x0906, // PEP_SYNC_NO_MESSAGE_SEND_CALLBACK
   124     PEPStatusSyncCannotStart = 0x0907, // PEP_SYNC_CANNOT_START
   125 
   126     PEPStatusCannotIncreaseSequence = 0x0971, // PEP_CANNOT_INCREASE_SEQUENCE
   127 
   128     PEPStatusStatemachineError = 0x0980, // PEP_STATEMACHINE_ERROR
   129     PEPStatusNoTrust = 0x0981, // PEP_NO_TRUST
   130     PEPStatusStatemachineInvalidState = 0x0982, // PEP_STATEMACHINE_INVALID_STATE
   131     PEPStatusStatemachineInvalidEvent = 0x0983, // PEP_STATEMACHINE_INVALID_EVENT
   132     PEPStatusStatemachineInvalidCondition = 0x0984, // PEP_STATEMACHINE_INVALID_CONDITION
   133     PEPStatusStatemachineInvalidAction = 0x0985, // PEP_STATEMACHINE_INVALID_ACTION
   134     PEPStatusStatemachineInhibitedEvent = 0x0986, // PEP_STATEMACHINE_INHIBITED_EVENT
   135     PEPStatusStatemachineCannotSend = 0x0987, // PEP_STATEMACHINE_CANNOT_SEND
   136 
   137     PEPStatusCommitFailed = 0xff01, // PEP_COMMIT_FAILED
   138     PEPStatusMessageConsume = 0xff02, // PEP_MESSAGE_CONSUME
   139     PEPStatusMessageIgnore = 0xff03, // PEP_MESSAGE_IGNORE
   140     PEPStatusCannotConfig = 0xff04, // PEP_CANNOT_CONFIG
   141 
   142     PEPStatusRecordNotFound = -6, // PEP_RECORD_NOT_FOUND
   143     PEPStatusCannotCreateTempFile = -5, // PEP_CANNOT_CREATE_TEMP_FILE
   144     PEPStatusIllegalValue = -4, // PEP_ILLEGAL_VALUE
   145     PEPStatusBufferTooSmall = -3, // PEP_BUFFER_TOO_SMALL
   146     PEPStatusOutOfMemory = -2, // PEP_OUT_OF_MEMORY
   147     PEPStatusUnknownError = -1, // PEP_UNKNOWN_ERROR
   148 
   149     PEPStatusVersionMismatch = -7, // PEP_VERSION_MISMATCH
   150 };
   151 
   152 typedef NS_ENUM(int, PEPIdentityFlags) {
   153     // the first octet flags are app defined settings
   154     PEPIdentityFlagsNotForSync = 0x0001, // PEP_idf_not_for_sync = 0x0001,   // don't use this identity for sync
   155     PEPIdentityFlagsList = 0x0002, // PEP_idf_list = 0x0002,           // identity of list of persons
   156     // the second octet flags are calculated
   157     PEPIdentityFlagsDeviceGroup = 0x0100 // PEP_idf_devicegroup = 0x0100     // identity of a device group member
   158 };
   159 
   160 typedef NS_ENUM(int, PEPSyncHandshakeSignal) { // _sync_handshake_signal
   161     PEPSyncHandshakeSignalUndefined = 0, // SYNC_NOTIFY_UNDEFINED = 0,
   162 
   163     // request show handshake dialog
   164     PEPSyncHandshakeSignalInitAddOurDevice = 1, // SYNC_NOTIFY_INIT_ADD_OUR_DEVICE = 1,
   165     PEPSyncHandshakeSignalInitAddOtherDevice = 2, // SYNC_NOTIFY_INIT_ADD_OTHER_DEVICE = 2,
   166     PEPSyncHandshakeSignalInitFormGroup = 3, // SYNC_NOTIFY_INIT_FORM_GROUP = 3,
   167     // SYNC_NOTIFY_INIT_MOVE_OUR_DEVICE = 4,
   168 
   169     // handshake process timed out
   170     PEPSyncHandshakeSignalTimeout = 5, // SYNC_NOTIFY_TIMEOUT = 5,
   171 
   172     // handshake accepted by user
   173     PEPSyncHandshakeSignalAcceptedDeviceAdded = 6, // SYNC_NOTIFY_ACCEPTED_DEVICE_ADDED = 6,
   174     PEPSyncHandshakeSignalAcceptedGroupCreated = 7, // SYNC_NOTIFY_ACCEPTED_GROUP_CREATED = 7,
   175     // SYNC_NOTIFY_ACCEPTED_DEVICE_MOVED = 8,
   176 
   177     // handshake dialog must be closed
   178     PEPSyncHandshakeSignalOvertaken = 9, // SYNC_NOTIFY_OVERTAKEN = 9,
   179 
   180     /** currently exchanging private keys */
   181     PEPSyncHandshakeSignalFormingGroup = 10, // SYNC_NOTIFY_FORMING_GROUP = 10
   182 
   183     // notificaton of actual group status
   184     PEPSyncHandshakeSignalSole = 254, // SYNC_NOTIFY_SOLE = 254,
   185     PEPSyncHandshakeSignalInGroup = 255 // SYNC_NOTIFY_IN_GROUP = 255
   186 };
   187 
   188 typedef NS_ENUM(int, PEPSyncHandshakeResult) {
   189     PEPSyncHandshakeResultCancel = -1, // SYNC_HANDSHAKE_CANCEL = -1,
   190     PEPSyncHandshakeResultAccepted = 0, // SYNC_HANDSHAKE_ACCEPTED = 0,
   191     PEPSyncHandshakeResultRejected = 1 // SYNC_HANDSHAKE_REJECTED = 1
   192 };
   193 
   194 typedef NS_ENUM(int, PEPCommType) {
   195     PEPCommTypeUnknown = 0, // PEP_ct_unknown = 0,
   196 
   197     // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable
   198 
   199     PEPCommTypeNoEncryption = 0x01, // PEP_ct_no_encryption = 0x01,                // generic
   200     PEPCommTypeNoEncrypted_channel = 0x02, // PEP_ct_no_encrypted_channel = 0x02,
   201     PEPCommTypeKeyNotFound = 0x03, // PEP_ct_key_not_found = 0x03,
   202     PEPCommTypeKeyExpired = 0x04, // PEP_ct_key_expired = 0x04,
   203     PEPCommTypeKeyRevoked = 0x05, // PEP_ct_key_revoked = 0x05,
   204     PEPCommTypeKeyBr0ken = 0x06, // PEP_ct_key_b0rken = 0x06,
   205     PEPCommTypeKeyExpiredButConfirmed = 0x07, // PEP_ct_key_expired_but_confirmed = 0x07, // NOT with confirmed bit. Just retaining info here in case of renewal.
   206     PEPCommTypeMyKeyNotIncluded = 0x09, // PEP_ct_my_key_not_included = 0x09,
   207 
   208     PEPCommTypeSecurityByObscurity = 0x0a, // PEP_ct_security_by_obscurity = 0x0a,
   209     PEPCommTypeBr0kenCrypto = 0x0b, // PEP_ct_b0rken_crypto = 0x0b,
   210     PEPCommTypeKeyTooShort = 0x0c, // PEP_ct_key_too_short = 0x0c,
   211 
   212     PEPCommTypeCompromised = 0x0e, // PEP_ct_compromized = 0x0e,                  // deprecated misspelling
   213     PEPCommTypeMistrusted = 0x0f, // PEP_ct_mistrusted = 0x0f,                   // known mistrusted key
   214 
   215     // range 0x10 to 0x3f: unconfirmed encryption
   216 
   217     PEPCommTypeUnconfirmedEncryption = 0x10, // PEP_ct_unconfirmed_encryption = 0x10,       // generic
   218     PEPCommTypeOpenPGPWeakUnconfirmed = 0x11, // PEP_ct_OpenPGP_weak_unconfirmed = 0x11,     // RSA 1024 is weak
   219 
   220     PEPCommTypeToBeChecked = 0x20, // PEP_ct_to_be_checked = 0x20,                // generic
   221     PEPCommTypeSMIMEUnconfirmed = 0x21, // PEP_ct_SMIME_unconfirmed = 0x21,
   222     PEPCommTypeCMSUnconfirmed = 0x22, // PEP_ct_CMS_unconfirmed = 0x22,
   223 
   224     PEPCommTypeStongButUnconfirmed = 0x30, // PEP_ct_strong_but_unconfirmed = 0x30,       // generic
   225     PEPCommTypeOpenPGPUnconfirmed = 0x38, // PEP_ct_OpenPGP_unconfirmed = 0x38,          // key at least 2048 bit RSA or EC
   226     PEPCommTypeOTRUnconfirmed = 0x3a, // PEP_ct_OTR_unconfirmed = 0x3a,
   227 
   228     // range 0x40 to 0x7f: unconfirmed encryption and anonymization
   229 
   230     PEPCommTypeUnconfirmedEncAnon = 0x40, // PEP_ct_unconfirmed_enc_anon = 0x40,         // generic
   231     PEPCommTypePEPUnconfirmed = 0x7f, // PEP_ct_pEp_unconfirmed = 0x7f,
   232 
   233     PEPCommTypeConfirmed = 0x80, // PEP_ct_confirmed = 0x80,                    // this bit decides if trust is confirmed
   234 
   235     // range 0x81 to 0x8f: reserved
   236     // range 0x90 to 0xbf: confirmed encryption
   237 
   238     PEPCommTypeConfirmedEncryption = 0x90, // PEP_ct_confirmed_encryption = 0x90,         // generic
   239     PEPCommTypeOpenPGPWeak = 0x91, // PEP_ct_OpenPGP_weak = 0x91,                 // RSA 1024 is weak (unused)
   240 
   241     PEPCommTypeToBeCheckedConfirmed = 0xa0, // PEP_ct_to_be_checked_confirmed = 0xa0,      // generic
   242     PEPCommTypeSMIME = 0xa1, // PEP_ct_SMIME = 0xa1,
   243     PEPCommTypeCMS = 0xa2, // PEP_ct_CMS = 0xa2,
   244 
   245     PEPCommTypeStongEncryption = 0xb0, // PEP_ct_strong_encryption = 0xb0,            // generic
   246     PEPCommTypeOpenPGP = 0xb8, // PEP_ct_OpenPGP = 0xb8,                      // key at least 2048 bit RSA or EC
   247     PEPCommTypeOTR = 0xba, // PEP_ct_OTR = 0xba,
   248 
   249     // range 0xc0 to 0xff: confirmed encryption and anonymization
   250 
   251     PEPCommTypeConfirmedEncAnon = 0xc0, // PEP_ct_confirmed_enc_anon = 0xc0,           // generic
   252     PEPCommTypePEP = 0xff // PEP_ct_pEp = 0xff
   253 };
   254 
   255 typedef NS_ENUM(int, PEPMsgDirection) {
   256     PEPMsgDirectionIncoming = 0,
   257     PEPMsgDirectionOutgoing
   258 };
   259 
   260 typedef NS_ENUM(int, PEPColor) {
   261     PEPColorNoColor = 0,
   262     PEPColorYellow,
   263     PEPColorGreen,
   264     PEPColorRed = -1,
   265 };
   266 
   267 typedef NS_ENUM(int, PEPContentDisposition) {
   268     PEPContentDispositionAttachment = 0,
   269     PEPContentDispositionInline = 1,
   270     PEPContentDispositionOther = -1      // must be affirmatively set
   271 };
   272 
   273 #endif /* PEPTypes_h */