merge default IOS-1823
authorDirk Zimmermann <dz@pep.security>
Wed, 16 Oct 2019 11:03:40 +0200
branchIOS-1823
changeset 1322484053fa7b68
parent 1317 a7a5570094d3
parent 1321 5ac4a2debde6
child 1429 c5ff92cd88bb
merge default
pEpObjCAdapter/PEPInternalSession.m
     1.1 --- a/pEpObjCAdapter.xcodeproj/xcshareddata/xcschemes/PEPObjCAdapterFramework.xcscheme	Tue Oct 15 11:33:24 2019 +0200
     1.2 +++ b/pEpObjCAdapter.xcodeproj/xcshareddata/xcschemes/PEPObjCAdapterFramework.xcscheme	Wed Oct 16 11:03:40 2019 +0200
     1.3 @@ -1,6 +1,6 @@
     1.4  <?xml version="1.0" encoding="UTF-8"?>
     1.5  <Scheme
     1.6 -   LastUpgradeVersion = "1020"
     1.7 +   LastUpgradeVersion = "1110"
     1.8     version = "1.3">
     1.9     <BuildAction
    1.10        parallelizeBuildables = "YES"
    1.11 @@ -29,8 +29,6 @@
    1.12        shouldUseLaunchSchemeArgsEnv = "YES">
    1.13        <Testables>
    1.14        </Testables>
    1.15 -      <AdditionalOptions>
    1.16 -      </AdditionalOptions>
    1.17     </TestAction>
    1.18     <LaunchAction
    1.19        buildConfiguration = "Debug"
    1.20 @@ -51,8 +49,6 @@
    1.21              ReferencedContainer = "container:pEpObjCAdapter.xcodeproj">
    1.22           </BuildableReference>
    1.23        </MacroExpansion>
    1.24 -      <AdditionalOptions>
    1.25 -      </AdditionalOptions>
    1.26     </LaunchAction>
    1.27     <ProfileAction
    1.28        buildConfiguration = "Release"
     2.1 --- a/pEpObjCAdapter.xcodeproj/xcshareddata/xcschemes/pEpObjCAdapterTests.xcscheme	Tue Oct 15 11:33:24 2019 +0200
     2.2 +++ b/pEpObjCAdapter.xcodeproj/xcshareddata/xcschemes/pEpObjCAdapterTests.xcscheme	Wed Oct 16 11:03:40 2019 +0200
     2.3 @@ -1,6 +1,6 @@
     2.4  <?xml version="1.0" encoding="UTF-8"?>
     2.5  <Scheme
     2.6 -   LastUpgradeVersion = "1020"
     2.7 +   LastUpgradeVersion = "1110"
     2.8     version = "1.3">
     2.9     <BuildAction
    2.10        parallelizeBuildables = "YES"
    2.11 @@ -23,8 +23,6 @@
    2.12              </BuildableReference>
    2.13           </TestableReference>
    2.14        </Testables>
    2.15 -      <AdditionalOptions>
    2.16 -      </AdditionalOptions>
    2.17     </TestAction>
    2.18     <LaunchAction
    2.19        buildConfiguration = "Debug"
    2.20 @@ -36,8 +34,6 @@
    2.21        debugDocumentVersioning = "YES"
    2.22        debugServiceExtension = "internal"
    2.23        allowLocationSimulation = "YES">
    2.24 -      <AdditionalOptions>
    2.25 -      </AdditionalOptions>
    2.26     </LaunchAction>
    2.27     <ProfileAction
    2.28        buildConfiguration = "Release"
     3.1 --- a/pEpObjCAdapter/PEPInternalSession.m	Tue Oct 15 11:33:24 2019 +0200
     3.2 +++ b/pEpObjCAdapter/PEPInternalSession.m	Wed Oct 16 11:03:40 2019 +0200
     3.3 @@ -75,23 +75,6 @@
     3.4  
     3.5  #pragma mark - DEBUG UTILS
     3.6  
     3.7 -/**
     3.8 - Saves the given message dict as a plist to the local filesystem
     3.9 - (directly under NSApplicationSupportDirectory).
    3.10 - Since the complete output file will be logged by `debugSaveToFilePath`,
    3.11 - you can get access to the files easily when it's the simulator.
    3.12 - */
    3.13 -- (void)debugOutPutMessageDict:(PEPDict * _Nonnull)src
    3.14 -{
    3.15 -    NSString *from = src[kPepFrom][kPepAddress];
    3.16 -    NSArray *tos = src[kPepTo];
    3.17 -    NSString *to = tos[0][kPepAddress];
    3.18 -    NSString *msgID = src[kPepID];
    3.19 -    NSString *fileName = [NSString stringWithFormat:@"%@_from(%@)_%@",
    3.20 -                          to, from, msgID];
    3.21 -    [src debugSaveToFilePath:fileName];
    3.22 -}
    3.23 -
    3.24  #pragma mark - PEPSessionProtocol
    3.25  
    3.26  void decryptMessageDictFree(message *src, message *dst, stringlist_t *extraKeys)
    3.27 @@ -272,8 +255,7 @@
    3.28      message *_dst = NULL;
    3.29      stringlist_t *_keys = PEP_arrayToStringlist(extraKeys);
    3.30  
    3.31 -    PEPStatus theStatus = (PEPStatus) encrypt_message(
    3.32 -                                                      _session,
    3.33 +    PEPStatus theStatus = (PEPStatus) encrypt_message(_session,
    3.34                                                        _src,
    3.35                                                        _keys,
    3.36                                                        &_dst,
    3.37 @@ -397,7 +379,6 @@
    3.38                         extraKeys:extraKeys
    3.39                         status:status
    3.40                         error:error];
    3.41 -
    3.42      if (target) {
    3.43          PEPMessage *encrypted = [PEPMessage new];
    3.44          [encrypted setValuesForKeysWithDictionary:target];
     4.1 --- a/pEpObjCAdapter/PEPSession.m	Tue Oct 15 11:33:24 2019 +0200
     4.2 +++ b/pEpObjCAdapter/PEPSession.m	Wed Oct 16 11:03:40 2019 +0200
     4.3 @@ -41,24 +41,6 @@
     4.4      [PEPSessionProvider cleanup];
     4.5  }
     4.6  
     4.7 -- (PEPDict * _Nullable)decryptMessageDict:(PEPMutableDict * _Nonnull)messageDict
     4.8 -                                    flags:(PEPDecryptFlags * _Nullable)flags
     4.9 -                                   rating:(PEPRating * _Nullable)rating
    4.10 -                                extraKeys:(PEPStringList * _Nullable * _Nullable)extraKeys
    4.11 -                                   status:(PEPStatus * _Nullable)status
    4.12 -                                    error:(NSError * _Nullable * _Nullable)error
    4.13 -{
    4.14 -    PEPInternalSession *session = [PEPSessionProvider session];
    4.15 -    RETURN_ON_ERROR(session, error, nil);
    4.16 -    return [session
    4.17 -            decryptMessageDict:messageDict
    4.18 -            flags:flags
    4.19 -            rating:rating
    4.20 -            extraKeys:extraKeys
    4.21 -            status:status
    4.22 -            error:error];
    4.23 -}
    4.24 -
    4.25  - (PEPMessage * _Nullable)decryptMessage:(PEPMessage * _Nonnull)message
    4.26                                     flags:(PEPDecryptFlags * _Nullable)flags
    4.27                                    rating:(PEPRating * _Nullable)rating
    4.28 @@ -77,21 +59,6 @@
    4.29              error:error];
    4.30  }
    4.31  
    4.32 -- (BOOL)reEvaluateMessageDict:(PEPDict * _Nonnull)messageDict
    4.33 -                     xKeyList:(PEPStringList * _Nullable)xKeyList
    4.34 -                       rating:(PEPRating * _Nonnull)rating
    4.35 -                       status:(PEPStatus * _Nullable)status
    4.36 -                        error:(NSError * _Nullable * _Nullable)error
    4.37 -{
    4.38 -    PEPInternalSession *session = [PEPSessionProvider session];
    4.39 -    RETURN_ON_ERROR(session, error, NO);
    4.40 -    return [session reEvaluateMessageDict:messageDict
    4.41 -                                 xKeyList:xKeyList
    4.42 -                                   rating:rating
    4.43 -                                   status:status
    4.44 -                                    error:error];
    4.45 -}
    4.46 -
    4.47  - (BOOL)reEvaluateMessage:(PEPMessage * _Nonnull)message
    4.48                   xKeyList:(PEPStringList * _Nullable)xKeyList
    4.49                     rating:(PEPRating * _Nonnull)rating
    4.50 @@ -107,22 +74,6 @@
    4.51                                  error:error];
    4.52  }
    4.53  
    4.54 -- (PEPDict * _Nullable)encryptMessageDict:(PEPDict * _Nonnull)messageDict
    4.55 -                                    extraKeys:(PEPStringList * _Nullable)extraKeys
    4.56 -                                encFormat:(PEPEncFormat)encFormat
    4.57 -                                   status:(PEPStatus * _Nullable)status
    4.58 -                                    error:(NSError * _Nullable * _Nullable)error
    4.59 -{
    4.60 -    PEPInternalSession *session = [PEPSessionProvider session];
    4.61 -    RETURN_ON_ERROR(session, error, nil);
    4.62 -    return [session
    4.63 -            encryptMessageDict:messageDict
    4.64 -            extraKeys:extraKeys
    4.65 -            encFormat:encFormat
    4.66 -            status:status
    4.67 -            error:error];
    4.68 -}
    4.69 -
    4.70  - (PEPMessage * _Nullable)encryptMessage:(PEPMessage * _Nonnull)message
    4.71                                 extraKeys:(PEPStringList * _Nullable)extraKeys
    4.72                                 encFormat:(PEPEncFormat)encFormat
    4.73 @@ -149,22 +100,6 @@
    4.74      return [session encryptMessage:message extraKeys:extraKeys status:status error:error];
    4.75  }
    4.76  
    4.77 -- (PEPDict * _Nullable)encryptMessageDict:(PEPDict * _Nonnull)messageDict
    4.78 -                                  forSelf:(PEPIdentity * _Nonnull)ownIdentity
    4.79 -                                extraKeys:(PEPStringList * _Nullable)extraKeys
    4.80 -                                   status:(PEPStatus * _Nullable)status
    4.81 -                                    error:(NSError * _Nullable * _Nullable)error
    4.82 -{
    4.83 -    PEPInternalSession *session = [PEPSessionProvider session];
    4.84 -    RETURN_ON_ERROR(session, error, nil);
    4.85 -    return [session
    4.86 -            encryptMessageDict:messageDict
    4.87 -            forSelf:ownIdentity
    4.88 -            extraKeys:extraKeys
    4.89 -            status:status
    4.90 -            error:error];
    4.91 -}
    4.92 -
    4.93  - (PEPMessage * _Nullable)encryptMessage:(PEPMessage * _Nonnull)message
    4.94                                   forSelf:(PEPIdentity * _Nonnull)ownIdentity
    4.95                                 extraKeys:(PEPStringList * _Nullable)extraKeys
    4.96 @@ -181,24 +116,6 @@
    4.97              error:error];
    4.98  }
    4.99  
   4.100 -- (PEPDict * _Nullable)encryptMessageDict:(PEPDict * _Nonnull)messageDict
   4.101 -                                    toFpr:(NSString * _Nonnull)toFpr
   4.102 -                                encFormat:(PEPEncFormat)encFormat
   4.103 -                                    flags:(PEPDecryptFlags)flags
   4.104 -                                   status:(PEPStatus * _Nullable)status
   4.105 -                                    error:(NSError * _Nullable * _Nullable)error __deprecated
   4.106 -{
   4.107 -    PEPInternalSession *session = [PEPSessionProvider session];
   4.108 -    RETURN_ON_ERROR(session, error, nil);
   4.109 -    return [session
   4.110 -            encryptMessageDict:messageDict
   4.111 -            toFpr:toFpr
   4.112 -            encFormat:encFormat
   4.113 -            flags:flags
   4.114 -            status:status
   4.115 -            error:error];
   4.116 -}
   4.117 -
   4.118  - (PEPMessage * _Nullable)encryptMessage:(PEPMessage * _Nonnull)message
   4.119                                     toFpr:(NSString * _Nonnull)toFpr
   4.120                                 encFormat:(PEPEncFormat)encFormat
     5.1 --- a/pEpObjCAdapterFramework/PEPSessionProtocol.h	Tue Oct 15 11:33:24 2019 +0200
     5.2 +++ b/pEpObjCAdapterFramework/PEPSessionProtocol.h	Wed Oct 16 11:03:40 2019 +0200
     5.3 @@ -18,14 +18,6 @@
     5.4  @protocol PEPSessionProtocol <NSObject>
     5.5  
     5.6  /** Decrypt a message */
     5.7 -- (PEPDict * _Nullable)decryptMessageDict:(PEPMutableDict * _Nonnull)messageDict
     5.8 -                                    flags:(PEPDecryptFlags * _Nullable)flags
     5.9 -                                   rating:(PEPRating * _Nullable)rating
    5.10 -                                extraKeys:(PEPStringList * _Nullable * _Nullable)extraKeys
    5.11 -                                   status:(PEPStatus * _Nullable)status
    5.12 -                                    error:(NSError * _Nullable * _Nullable)error __deprecated;
    5.13 -
    5.14 -/** Decrypt a message */
    5.15  - (PEPMessage * _Nullable)decryptMessage:(PEPMessage * _Nonnull)message
    5.16                                     flags:(PEPDecryptFlags * _Nullable)flags
    5.17                                    rating:(PEPRating * _Nullable)rating
    5.18 @@ -34,13 +26,6 @@
    5.19                                     error:(NSError * _Nullable * _Nullable)error;
    5.20  
    5.21  /** Re-evaluate rating of decrypted message */
    5.22 -- (BOOL)reEvaluateMessageDict:(PEPDict * _Nonnull)messageDict
    5.23 -                     xKeyList:(PEPStringList *_Nullable)xKeyList
    5.24 -                       rating:(PEPRating * _Nonnull)rating
    5.25 -                       status:(PEPStatus * _Nullable)status
    5.26 -                        error:(NSError * _Nullable * _Nullable)error __deprecated;
    5.27 -
    5.28 -/** Re-evaluate rating of decrypted message */
    5.29  - (BOOL)reEvaluateMessage:(PEPMessage * _Nonnull)message
    5.30                   xKeyList:(PEPStringList *_Nullable)xKeyList
    5.31                     rating:(PEPRating * _Nonnull)rating
    5.32 @@ -48,16 +33,6 @@
    5.33                      error:(NSError * _Nullable * _Nullable)error;
    5.34  
    5.35  /**
    5.36 - Encrypt a message dictionary, indicating the encoding format.
    5.37 - @note The resulting message dict could be the input one.
    5.38 - */
    5.39 -- (PEPDict * _Nullable)encryptMessageDict:(PEPDict * _Nonnull)messageDict
    5.40 -                                extraKeys:(PEPStringList * _Nullable)extraKeys
    5.41 -                                encFormat:(PEPEncFormat)encFormat
    5.42 -                                   status:(PEPStatus * _Nullable)status
    5.43 -                                    error:(NSError * _Nullable * _Nullable)error __deprecated;
    5.44 -
    5.45 -/**
    5.46   Encrypt a message, indicating the encoding format
    5.47   @note The resulting message dict could be the input one.
    5.48   */
    5.49 @@ -73,13 +48,6 @@
    5.50                                    status:(PEPStatus * _Nullable)status
    5.51                                     error:(NSError * _Nullable * _Nullable)error;
    5.52  
    5.53 -/** Encrypt a message dict for the given own identity */
    5.54 -- (PEPDict * _Nullable)encryptMessageDict:(PEPDict * _Nonnull)messageDict
    5.55 -                                  forSelf:(PEPIdentity * _Nonnull)ownIdentity
    5.56 -                                extraKeys:(PEPStringList * _Nullable)extraKeys
    5.57 -                                   status:(PEPStatus * _Nullable)status
    5.58 -                                    error:(NSError * _Nullable * _Nullable)error __deprecated;
    5.59 -
    5.60  /** Encrypt a message for the given own identity */
    5.61  - (PEPMessage * _Nullable)encryptMessage:(PEPMessage * _Nonnull)message
    5.62                                   forSelf:(PEPIdentity * _Nonnull)ownIdentity
    5.63 @@ -87,15 +55,7 @@
    5.64                                    status:(PEPStatus * _Nullable)status
    5.65                                     error:(NSError * _Nullable * _Nullable)error;
    5.66  
    5.67 -/** Encrypt a message dict to the given recipient FPR, attaching the private key */
    5.68 -- (PEPDict * _Nullable)encryptMessageDict:(PEPDict * _Nonnull)messageDict
    5.69 -                                    toFpr:(NSString * _Nonnull)toFpr
    5.70 -                                encFormat:(PEPEncFormat)encFormat
    5.71 -                                    flags:(PEPDecryptFlags)flags
    5.72 -                                   status:(PEPStatus * _Nullable)status
    5.73 -                                    error:(NSError * _Nullable * _Nullable)error __deprecated;
    5.74 -
    5.75 -/** Encrypt a message dict to the given recipient FPR, attaching the private key */
    5.76 +/** Encrypt a message to the given recipient FPR, attaching the private key */
    5.77  - (PEPMessage * _Nullable)encryptMessage:(PEPMessage * _Nonnull)message
    5.78                                     toFpr:(NSString * _Nonnull)toFpr
    5.79                                 encFormat:(PEPEncFormat)encFormat
    5.80 @@ -128,7 +88,6 @@
    5.81  /**
    5.82   Supply an account used by our user himself. The identity is supplemented with the missing parts
    5.83  
    5.84 - An identity is a `NSDictionary` mapping a field name as `NSString` to different values.
    5.85   An identity can have the following fields (all other keys are ignored).
    5.86   It is not necessary to supply all fields; missing fields are supplemented by p≡p engine.
    5.87  
    5.88 @@ -143,11 +102,9 @@
    5.89   As an example:
    5.90  
    5.91   User has a mailbox. The mail address is "Dipul Khatri <dipul@inboxcube.com>". Then this would be:
    5.92 -
    5.93 - NSDictionary *ident = [NSDictionary dictionaryWithObjectsAndKeys:
    5.94 - @"Dipul Khatri", @"username", @"dipul@inboxcube.com", @"address",
    5.95 - @"23", @"user_id", nil];
    5.96 -
    5.97 + username = @"Dipul Khatri"
    5.98 + address= @"dipul@inboxcube.com"
    5.99 + user_id" = 23"
   5.100   */
   5.101  - (BOOL)mySelf:(PEPIdentity * _Nonnull)identity error:(NSError * _Nullable * _Nullable)error;
   5.102  
   5.103 @@ -161,21 +118,18 @@
   5.104  
   5.105  /**
   5.106   Mark a key as trusted with a person.
   5.107 - See `mySelf:(NSMutableDictionary *)identity` for an explanation of identities.
   5.108   */
   5.109  - (BOOL)trustPersonalKey:(PEPIdentity * _Nonnull)identity
   5.110                     error:(NSError * _Nullable * _Nullable)error;
   5.111  
   5.112  /**
   5.113   if a key is not trusted by the user tell this using this message
   5.114 - See `mySelf:(NSMutableDictionary *)identity` for an explanation of identities.
   5.115   */
   5.116  - (BOOL)keyMistrusted:(PEPIdentity * _Nonnull)identity
   5.117                  error:(NSError * _Nullable * _Nullable)error;
   5.118  
   5.119  /**
   5.120   Use this to undo keyCompromized or trustPersonalKey
   5.121 - See `mySelf:(NSMutableDictionary *)identity` for an explanation of identities.
   5.122   */
   5.123  - (BOOL)keyResetTrust:(PEPIdentity * _Nonnull)identity
   5.124                  error:(NSError * _Nullable * _Nullable)error;