IOSAD-172 Convert encryptMessageDict (encrypt_message_and_add_priv_key) IOSAD-172
authorDirk Zimmermann <dz@pep.security>
Sat, 27 Jun 2020 15:02:27 +0200
branchIOSAD-172
changeset 1516891baa5770c5
parent 1515 27d017b6255a
child 1517 2aa3f8ebb4d6
IOSAD-172 Convert encryptMessageDict (encrypt_message_and_add_priv_key)
pEpObjCAdapter/PEPInternalSession.m
     1.1 --- a/pEpObjCAdapter/PEPInternalSession.m	Sat Jun 27 14:53:17 2020 +0200
     1.2 +++ b/pEpObjCAdapter/PEPInternalSession.m	Sat Jun 27 15:02:27 2020 +0200
     1.3 @@ -406,12 +406,16 @@
     1.4                                      error:(NSError * _Nullable * _Nullable)error __deprecated
     1.5  {
     1.6      message *src = PEP_messageDictToStruct([self removeEmptyRecipients:messageDict]);
     1.7 -    message *dst = NULL;
     1.8 +    __block message *dst = NULL;
     1.9  
    1.10 -    PEPStatus theStatus = (PEPStatus)
    1.11 -    encrypt_message_and_add_priv_key(_session, src, &dst,
    1.12 -                                     [[toFpr precomposedStringWithCanonicalMapping] UTF8String],
    1.13 -                                     (PEP_enc_format) encFormat, flags);
    1.14 +    PEPStatus theStatus = [self runWithPasswords:^PEP_STATUS(PEP_SESSION session) {
    1.15 +        return encrypt_message_and_add_priv_key(session,
    1.16 +                                                src,
    1.17 +                                                &dst,
    1.18 +                                                [[toFpr precomposedStringWithCanonicalMapping] UTF8String],
    1.19 +                                                (PEP_enc_format) encFormat,
    1.20 +                                                flags);
    1.21 +    }];
    1.22  
    1.23      if (status) {
    1.24          *status = theStatus;