pEpObjCAdapterFramework/PEPEngineTypes.h
author Dirk Zimmermann <dz@pep.security>
Fri, 01 Mar 2019 16:03:28 +0100
branchIOS-1480
changeset 858 6d498a401b97
parent 857 7e510ae06a41
child 862 af86270f362d
permissions -rw-r--r--
IOS-1480 PEPContentDispositionType -> PEPContentDisposition.
dz@815
     1
//
dz@839
     2
//  PEPTypes.h
dz@815
     3
//  pEpObjCAdapter
dz@815
     4
//
dz@815
     5
//  Created by Dirk Zimmermann on 27.02.19.
dz@815
     6
//  Copyright © 2019 p≡p. All rights reserved.
dz@815
     7
//
dz@815
     8
dz@839
     9
#ifndef PEPTypes_h
dz@839
    10
#define PEPTypes_h
dz@815
    11
dz@845
    12
#import <Foundation/Foundation.h>
dz@845
    13
dz@821
    14
typedef enum _ObjC_PEP_decrypt_flags {
dz@853
    15
    PEPDecryptFlagNone = 0x1, // This defined only in the adpater, not the engine.
dz@816
    16
    PEPDecryptFlagOwnPrivateKey = 0x1, // PEP_decrypt_flag_own_private_key = 0x1,
dz@816
    17
    PEPDecryptFlagConsume = 0x2, // PEP_decrypt_flag_consume = 0x2,
dz@816
    18
    PEPDecryptFlagIgnore = 0x4, // PEP_decrypt_flag_ignore = 0x4,
dz@816
    19
    PEPDecryptFlagSrcModified = 0x8, // PEP_decrypt_flag_src_modified = 0x8,
dz@816
    20
    // input flags
dz@816
    21
    PEPDecryptFlagUntrustedServer = 0x100 // PEP_decrypt_flag_untrusted_server = 0x100
dz@816
    22
} PEPDecryptFlags; // PEP_decrypt_flags;
dz@815
    23
dz@821
    24
typedef enum _ObjC_PEP_enc_format {
dz@818
    25
    PEPEncNone = 0, // PEP_enc_none = 0, // message is not encrypted
dz@818
    26
    PEPEncPieces, // PEP_enc_pieces, // inline PGP + PGP extensions
dz@818
    27
    PEPEncSMIME, // PEP_enc_S_MIME, // RFC5751
dz@818
    28
    PEPEncPGPMIME, // PEP_enc_PGP_MIME, // RFC3156
dz@818
    29
    PEPEncPEP, // PEP_enc_PEP, // pEp encryption format
dz@818
    30
    PEPEncPGPMIMEOutlook1 // PEP_enc_PGP_MIME_Outlook1 // Message B0rken by Outlook type 1
dz@818
    31
} PEPEncFormat;
dz@818
    32
dz@821
    33
typedef enum _ObjC_PEP_rating {
dz@819
    34
    PEPRatingUndefined = 0,// PEP_rating_undefined = 0,
dz@819
    35
    PEPRatingCannotDecrypt, // PEP_rating_cannot_decrypt,
dz@819
    36
    PEPRatingHaveNoKey, // PEP_rating_have_no_key,
dz@819
    37
    PEPRatingUnencrypted, // PEP_rating_unencrypted,
dz@819
    38
    PEPRatingUnencryptedForSome, // PEP_rating_unencrypted_for_some, // don't use this any more
dz@819
    39
    PEPRatingUnreliable, // PEP_rating_unreliable,
dz@819
    40
    PEPRatingReliable, // PEP_rating_reliable,
dz@819
    41
    PEPRatingTrusted, // PEP_rating_trusted,
dz@819
    42
    PEPRatingTrustedAndAnonymized, // PEP_rating_trusted_and_anonymized,
dz@819
    43
    PEPRatingFullyAnonymous, // PEP_rating_fully_anonymous,
dz@819
    44
dz@819
    45
    PEPRatingMistrust = -1, // PEP_rating_mistrust = -1,
dz@819
    46
    PEPRatingB0rken = -2, // PEP_rating_b0rken = -2,
dz@819
    47
    PEPRatingUnderAttack = -3 // PEP_rating_under_attack = -3
dz@819
    48
} PEPRating;
dz@819
    49
dz@820
    50
typedef enum {
dz@820
    51
    PEPStatusOK                                   = 0, // PEP_STATUS_OK
dz@820
    52
dz@820
    53
    PEPInitCannotLoadGPME                      = 0x0110, // PEP_INIT_CANNOT_LOAD_GPGME
dz@820
    54
    PEPInitGPGMEInitFailed                      = 0x0111, // PEP_INIT_GPGME_INIT_FAILED
dz@820
    55
    PEPInitNoGPGHome                            = 0x0112, // PEP_INIT_NO_GPG_HOME
dz@820
    56
    PEPInitNETPGPInitFailed                     = 0x0113, // PEP_INIT_NETPGP_INIT_FAILED
dz@820
    57
    PEPInitCannotDetermineGPGVersion           = 0x0114, // PEP_INIT_CANNOT_DETERMINE_GPG_VERSION
dz@820
    58
    PEPInitUnsupportedGPGVersion                = 0x0115, // PEP_INIT_UNSUPPORTED_GPG_VERSION
dz@820
    59
    PEPInitCannotConfigGPGAgent                = 0x0116, // PEP_INIT_CANNOT_CONFIG_GPG_AGENT
dz@820
    60
dz@820
    61
    PEPInitSqlite3WithoutMutex                  = 0x0120, // PEP_INIT_SQLITE3_WITHOUT_MUTEX
dz@820
    62
    PEPInitCannotOpenDB                         = 0x0121, // PEP_INIT_CANNOT_OPEN_DB
dz@820
    63
    PEPInitCannotOpenSystemDB                  = 0x0122, // PEP_INIT_CANNOT_OPEN_SYSTEM_DB
dz@820
    64
    PEPUnknownDBError                            = 0x01ff, // PEP_UNKNOWN_DB_ERROR
dz@820
    65
dz@820
    66
    PEPKeyNotFound                               = 0x0201, // PEP_KEY_NOT_FOUND
dz@820
    67
    PEPKeyHasAmbigName                          = 0x0202, // PEP_KEY_HAS_AMBIG_NAME
dz@820
    68
    PEPGetKeyFailed                              = 0x0203, // PEP_GET_KEY_FAILED
dz@820
    69
    PEPCannotExportKey                           = 0x0204, // PEP_CANNOT_EXPORT_KEY
dz@820
    70
    PEPCannotEditKey                             = 0x0205, // PEP_CANNOT_EDIT_KEY
dz@820
    71
    PEPKeyUnsuitable                              = 0x0206, // PEP_KEY_UNSUITABLE
dz@820
    72
    PEPMalformedKeyResetMsg                     = 0x0210, // PEP_MALFORMED_KEY_RESET_MSG
dz@820
    73
    PEPKeyNotReset                               = 0x0211, // PEP_KEY_NOT_RESET
dz@820
    74
dz@820
    75
    PEPKeyImported                                = 0x0220, // PEP_KEY_IMPORTED
dz@820
    76
    PEPNoKeyImported                             = 0x0221, // PEP_NO_KEY_IMPORTED
dz@820
    77
    PEPKeyImportStatusUnknown                   = 0x0222, // PEP_KEY_IMPORT_STATUS_UNKNOWN
dz@820
    78
dz@820
    79
    PEPCannotFindIdentity                        = 0x0301, // PEP_CANNOT_FIND_IDENTITY
dz@820
    80
    PEPCannotSetPerson                           = 0x0381, // PEP_CANNOT_SET_PERSON
dz@820
    81
    PEPCannotSetPGPKeyPair                      = 0x0382, // PEP_CANNOT_SET_PGP_KEYPAIR
dz@820
    82
    PEPCannotSetIdentity                         = 0x0383, // PEP_CANNOT_SET_IDENTITY
dz@820
    83
    PEPCannotSetTrust                            = 0x0384, // PEP_CANNOT_SET_TRUST
dz@820
    84
    PEPKeyBlacklisted                             = 0x0385, // PEP_KEY_BLACKLISTED
dz@820
    85
    PEPCannotFindPerson                          = 0x0386, // PEP_CANNOT_FIND_PERSON
dz@820
    86
dz@820
    87
    PEPCannotFindAlias                           = 0x0391, // PEP_CANNOT_FIND_ALIAS
dz@820
    88
    PEPCannotSetAlias                            = 0x0392, // PEP_CANNOT_SET_ALIAS
dz@820
    89
dz@820
    90
    PEPUnencrypted                                 = 0x0400, // PEP_UNENCRYPTED
dz@820
    91
    PEPVerified                                    = 0x0401, // PEP_VERIFIED
dz@820
    92
    PEPDecrypted                                   = 0x0402, // PEP_DECRYPTED
dz@820
    93
    PEPDecryptedAndVerified                      = 0x0403, // PEP_DECRYPTED_AND_VERIFIED
dz@820
    94
    PEPDecryptWrongFormat                        = 0x0404, // PEP_DECRYPT_WRONG_FORMAT
dz@820
    95
    PEPDecryptNoKey                              = 0x0405, // PEP_DECRYPT_NO_KEY
dz@820
    96
    PEPDecryptSignatureDoesNotMatch            = 0x0406, // PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH
dz@820
    97
    PEPVerifyNoKey                               = 0x0407, // PEP_VERIFY_NO_KEY
dz@820
    98
    PEPVerifiedAndTrusted                        = 0x0408, // PEP_VERIFIED_AND_TRUSTED
dz@820
    99
    PEPCannotReencrypt                            = 0x0409, // PEP_CANNOT_REENCRYPT
dz@820
   100
    PEPCannotDecryptUnknown                      = 0x04ff, // PEP_CANNOT_DECRYPT_UNKNOWN
dz@820
   101
dz@820
   102
    PEPTrustwordNotFound                         = 0x0501, // PEP_TRUSTWORD_NOT_FOUND
dz@820
   103
    PEPTrustwordsFPRWrongLength                 = 0x0502, // PEP_TRUSTWORDS_FPR_WRONG_LENGTH
dz@820
   104
    PEPTrustwordsDuplicateFPR                    = 0x0503, // PEP_TRUSTWORDS_DUPLICATE_FPR
dz@820
   105
dz@820
   106
    PEPCannotCreateKey                           = 0x0601, // PEP_CANNOT_CREATE_KEY
dz@820
   107
    PEPCannotSendKey                             = 0x0602, // PEP_CANNOT_SEND_KEY
dz@820
   108
dz@820
   109
    PEPPhraseNotFound                            = 0x0701, // PEP_PHRASE_NOT_FOUND
dz@820
   110
dz@820
   111
    PEPSendFunctionNotRegistered                = 0x0801, // PEP_SEND_FUNCTION_NOT_REGISTERED
dz@820
   112
    PEPConstraintsViolated                         = 0x0802, // PEP_CONTRAINTS_VIOLATED
dz@820
   113
    PEPCannotEncode                               = 0x0803, // PEP_CANNOT_ENCODE
dz@820
   114
dz@820
   115
    PEPSyncNoNotifyCallback                     = 0x0901, // PEP_SYNC_NO_NOTIFY_CALLBACK
dz@820
   116
    PEPSyncIllegalMessage                        = 0x0902, // PEP_SYNC_ILLEGAL_MESSAGE
dz@820
   117
    PEPSyncNoInjectCallback                     = 0x0903, // PEP_SYNC_NO_INJECT_CALLBACK
dz@820
   118
    PEPSyncNoChannel                             = 0x0904, // PEP_SYNC_NO_CHANNEL
dz@820
   119
    PEPSyncCannotEncrypt                         = 0x0905, // PEP_SYNC_CANNOT_ENCRYPT
dz@820
   120
    PEPSyncNoMessageSendCallback               = 0x0906, // PEP_SYNC_NO_MESSAGE_SEND_CALLBACK
dz@820
   121
dz@820
   122
    PEPCannotIncreaseSequence                    = 0x0971, // PEP_CANNOT_INCREASE_SEQUENCE
dz@820
   123
dz@820
   124
    PEPStatemachineError                          = 0x0980, // PEP_STATEMACHINE_ERROR
dz@820
   125
    PEPNoTrust                                    = 0x0981, // PEP_NO_TRUST
dz@820
   126
    PEPStatemachineInvalidState                  = 0x0982, // PEP_STATEMACHINE_INVALID_STATE
dz@820
   127
    PEPStatemachineInvalidEvent                  = 0x0983, // PEP_STATEMACHINE_INVALID_EVENT
dz@820
   128
    PEPStatemachineInvalidCondition              = 0x0984, // PEP_STATEMACHINE_INVALID_CONDITION
dz@820
   129
    PEPStatemachineInvalidAction                 = 0x0985, // PEP_STATEMACHINE_INVALID_ACTION
dz@820
   130
    PEPStatemachineInhibitedEvent                = 0x0986, // PEP_STATEMACHINE_INHIBITED_EVENT
dz@820
   131
    PEPStatemachineCannotSend                    = 0x0987, // PEP_STATEMACHINE_CANNOT_SEND
dz@820
   132
dz@820
   133
    PEPCommitFailed                               = 0xff01, // PEP_COMMIT_FAILED
dz@820
   134
    PEPMessageConsume                             = 0xff02, // PEP_MESSAGE_CONSUME
dz@820
   135
    PEPMessageIgnore                              = 0xff03, // PEP_MESSAGE_IGNORE
dz@820
   136
dz@820
   137
    PEPRecordNotFound                            = -6, // PEP_RECORD_NOT_FOUND
dz@820
   138
    PEPCannotCreateTempFile                     = -5, // PEP_CANNOT_CREATE_TEMP_FILE
dz@820
   139
    PEPIllegalValue                               = -4, // PEP_ILLEGAL_VALUE
dz@820
   140
    PEPBufferTooSmall                            = -3, // PEP_BUFFER_TOO_SMALL
dz@820
   141
    PEPOutOfMemory                               = -2, // PEP_OUT_OF_MEMORY
dz@820
   142
    PEPUnknownError                               = -1, // PEP_UNKNOWN_ERROR
dz@820
   143
dz@820
   144
    PEPVersionMismatch                            = -7, // PEP_VERSION_MISMATCH
dz@820
   145
} PEPStatus;
dz@820
   146
dz@823
   147
typedef enum _ObjC_identity_flags {
dz@823
   148
    // the first octet flags are app defined settings
dz@823
   149
    PEPIdfNotForSync = 0x0001, // PEP_idf_not_for_sync = 0x0001,   // don't use this identity for sync
dz@823
   150
    PEPIdfList = 0x0002, // PEP_idf_list = 0x0002,           // identity of list of persons
dz@823
   151
    // the second octet flags are calculated
dz@823
   152
    PEPIdfDeviceGroup = 0x0100 // PEP_idf_devicegroup = 0x0100     // identity of a device group member
dz@823
   153
} PEPIdentityFlags;
dz@823
   154
dz@824
   155
typedef enum _ObjC_sync_handshake_result {
dz@827
   156
    PEPSyncHandshakeResultCancel = -1, // SYNC_HANDSHAKE_CANCEL = -1,
dz@827
   157
    PEPSyncHandshakeResultAccepted = 0, // SYNC_HANDSHAKE_ACCEPTED = 0,
dz@827
   158
    PEPSyncHandshakeResultRejected = 1 // SYNC_HANDSHAKE_REJECTED = 1
dz@827
   159
} PEPSyncHandshakeResult;
dz@824
   160
dz@832
   161
typedef enum _PEPCommType {
dz@832
   162
    PEPCtUnknown = 0, // PEP_ct_unknown = 0,
dz@832
   163
dz@832
   164
    // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable
dz@832
   165
dz@832
   166
    PEPCtNoEncryption = 0x01, // PEP_ct_no_encryption = 0x01,                // generic
dz@832
   167
    PEPCtNoEncrypted_channel = 0x02, // PEP_ct_no_encrypted_channel = 0x02,
dz@832
   168
    PEPCtKeyNotFound = 0x03, // PEP_ct_key_not_found = 0x03,
dz@832
   169
    PEPCtKeyExpired = 0x04, // PEP_ct_key_expired = 0x04,
dz@832
   170
    PEPCtKeyRevoked = 0x05, // PEP_ct_key_revoked = 0x05,
dz@832
   171
    PEPCtKeyBr0ken = 0x06, // PEP_ct_key_b0rken = 0x06,
dz@832
   172
    PEPCtKeyExpiredButConfirmed = 0x07, // PEP_ct_key_expired_but_confirmed = 0x07, // NOT with confirmed bit. Just retaining info here in case of renewal.
dz@832
   173
    PEPCtMyKeyNotIncluded = 0x09, // PEP_ct_my_key_not_included = 0x09,
dz@832
   174
dz@832
   175
    PEPCtSecurityByObscurity = 0x0a, // PEP_ct_security_by_obscurity = 0x0a,
dz@832
   176
    PEPCtBr0kenCrypto = 0x0b, // PEP_ct_b0rken_crypto = 0x0b,
dz@832
   177
    PEPCtKeyTooShort = 0x0c, // PEP_ct_key_too_short = 0x0c,
dz@832
   178
dz@832
   179
    PEPCtCompromised = 0x0e, // PEP_ct_compromized = 0x0e,                  // deprecated misspelling
dz@832
   180
    PEPCtMistrusted = 0x0f, // PEP_ct_mistrusted = 0x0f,                   // known mistrusted key
dz@832
   181
dz@832
   182
    // range 0x10 to 0x3f: unconfirmed encryption
dz@832
   183
dz@832
   184
    PEPCtUnconfirmedEncryption = 0x10, // PEP_ct_unconfirmed_encryption = 0x10,       // generic
dz@832
   185
    PEPCtOpenPGPWeakUnconfirmed = 0x11, // PEP_ct_OpenPGP_weak_unconfirmed = 0x11,     // RSA 1024 is weak
dz@832
   186
dz@832
   187
    PEPCtToBeChecked = 0x20, // PEP_ct_to_be_checked = 0x20,                // generic
dz@832
   188
    PEPCtSMIMEUnconfirmed = 0x21, // PEP_ct_SMIME_unconfirmed = 0x21,
dz@832
   189
    PEPCtCMSUnconfirmed = 0x22, // PEP_ct_CMS_unconfirmed = 0x22,
dz@832
   190
dz@832
   191
    PEPCtStongButUnconfirmed = 0x30, // PEP_ct_strong_but_unconfirmed = 0x30,       // generic
dz@832
   192
    PEPCtOpenPGPUnconfirmed = 0x38, // PEP_ct_OpenPGP_unconfirmed = 0x38,          // key at least 2048 bit RSA or EC
dz@832
   193
    PEPCtOTRUnconfirmed = 0x3a, // PEP_ct_OTR_unconfirmed = 0x3a,
dz@832
   194
dz@832
   195
    // range 0x40 to 0x7f: unconfirmed encryption and anonymization
dz@832
   196
dz@832
   197
    PEPCtUnconfirmedEncAnon = 0x40, // PEP_ct_unconfirmed_enc_anon = 0x40,         // generic
dz@832
   198
    PEPCtPEPUnconfirmed = 0x7f, // PEP_ct_pEp_unconfirmed = 0x7f,
dz@832
   199
dz@832
   200
    PEPCtConfirmed = 0x80, // PEP_ct_confirmed = 0x80,                    // this bit decides if trust is confirmed
dz@832
   201
dz@832
   202
    // range 0x81 to 0x8f: reserved
dz@832
   203
    // range 0x90 to 0xbf: confirmed encryption
dz@832
   204
dz@832
   205
    PEPCtConfirmedEncryption = 0x90, // PEP_ct_confirmed_encryption = 0x90,         // generic
dz@832
   206
    PEPCtOpenPGPWeak = 0x91, // PEP_ct_OpenPGP_weak = 0x91,                 // RSA 1024 is weak (unused)
dz@832
   207
dz@832
   208
    PEPCtToBeCheckedConfirmed = 0xa0, // PEP_ct_to_be_checked_confirmed = 0xa0,      // generic
dz@832
   209
    PEPCtSMIME = 0xa1, // PEP_ct_SMIME = 0xa1,
dz@832
   210
    PEPCtCMS = 0xa2, // PEP_ct_CMS = 0xa2,
dz@832
   211
dz@832
   212
    PEPCtStongEncryption = 0xb0, // PEP_ct_strong_encryption = 0xb0,            // generic
dz@832
   213
    PEPCtOpenPGP = 0xb8, // PEP_ct_OpenPGP = 0xb8,                      // key at least 2048 bit RSA or EC
dz@832
   214
    PEPCtOTR = 0xba, // PEP_ct_OTR = 0xba,
dz@832
   215
dz@832
   216
    // range 0xc0 to 0xff: confirmed encryption and anonymization
dz@832
   217
dz@832
   218
    PEPCtConfirmedEncAnon = 0xc0, // PEP_ct_confirmed_enc_anon = 0xc0,           // generic
dz@832
   219
    PEPCtPEP = 0xff // PEP_ct_pEp = 0xff
dz@832
   220
} PEPCommType;
dz@832
   221
dz@844
   222
typedef enum _ObjC_PEP_msg_direction {
dz@844
   223
    PEPDirIncoming = 0,
dz@844
   224
    PEPDirOutgoing
dz@844
   225
} PEPMsgDirection;
dz@844
   226
dz@852
   227
typedef enum _ObjC_PEP_color {
dz@852
   228
    PEPColorNoColor = 0,
dz@852
   229
    PEPColorYellow,
dz@852
   230
    PEPColorGreen,
dz@852
   231
    PEPColorRed = -1,
dz@852
   232
} PEPColor;
dz@852
   233
dz@857
   234
typedef enum {
dz@857
   235
    PEPContentDispAttachment = 0,
dz@857
   236
    PEPContentDispInline = 1,
dz@857
   237
    PEPContentDispOther = -1      // must be affirmatively set
dz@858
   238
} PEPContentDisposition;
dz@857
   239
dz@839
   240
#endif /* PEPTypes_h */