IOSAD-172 Convert encryptMessageDict IOSAD-172
authorDirk Zimmermann <dz@pep.security>
Sat, 27 Jun 2020 14:38:17 +0200
branchIOSAD-172
changeset 15123fe651c26d40
parent 1511 a4d7dc99ec1d
child 1513 f0f7bcb94640
IOSAD-172 Convert encryptMessageDict
pEpObjCAdapter/PEPInternalSession.m
     1.1 --- a/pEpObjCAdapter/PEPInternalSession.m	Sat Jun 27 14:37:54 2020 +0200
     1.2 +++ b/pEpObjCAdapter/PEPInternalSession.m	Sat Jun 27 14:38:17 2020 +0200
     1.3 @@ -259,18 +259,20 @@
     1.4                                     status:(PEPStatus * _Nullable)status
     1.5                                      error:(NSError * _Nullable * _Nullable)error
     1.6  {
     1.7 -    PEP_encrypt_flags_t flags = 0;
     1.8 +    __block PEP_encrypt_flags_t flags = 0;
     1.9  
    1.10 -    message *_src = PEP_messageDictToStruct([self removeEmptyRecipients:messageDict]);
    1.11 -    message *_dst = NULL;
    1.12 -    stringlist_t *_keys = PEP_arrayToStringlist(extraKeys);
    1.13 +    __block message *_src = PEP_messageDictToStruct([self removeEmptyRecipients:messageDict]);
    1.14 +    __block message *_dst = NULL;
    1.15 +    __block stringlist_t *_keys = PEP_arrayToStringlist(extraKeys);
    1.16  
    1.17 -    PEPStatus theStatus = (PEPStatus) encrypt_message(_session,
    1.18 -                                                      _src,
    1.19 -                                                      _keys,
    1.20 -                                                      &_dst,
    1.21 -                                                      (PEP_enc_format) encFormat,
    1.22 -                                                      flags);
    1.23 +    PEPStatus theStatus = [self runWithPasswords:^PEP_STATUS(PEP_SESSION session) {
    1.24 +        return encrypt_message(session,
    1.25 +                               _src,
    1.26 +                               _keys,
    1.27 +                               &_dst,
    1.28 +                               (PEP_enc_format) encFormat,
    1.29 +                               flags);
    1.30 +    }];
    1.31  
    1.32      if (status) {
    1.33          *status = theStatus;