ENGINE-214: it woooooorks! ENGINE-214
authorKrista Bennett <krista@pep-project.org>
Mon, 09 Oct 2017 16:34:08 +0200
branchENGINE-214
changeset 214722394e4b5047
parent 2138 018bf5daa50d
child 2148 4c114255f86d
ENGINE-214: it woooooorks!
src/message.h
src/message_api.c
src/message_api.h
test/external_revoke_test.cc
     1.1 --- a/src/message.h	Fri Oct 06 09:37:06 2017 +0200
     1.2 +++ b/src/message.h	Mon Oct 09 16:34:08 2017 +0200
     1.3 @@ -163,4 +163,3 @@
     1.4  #ifdef __cplusplus
     1.5  }
     1.6  #endif
     1.7 -
     2.1 --- a/src/message_api.c	Fri Oct 06 09:37:06 2017 +0200
     2.2 +++ b/src/message_api.c	Mon Oct 09 16:34:08 2017 +0200
     2.3 @@ -530,7 +530,7 @@
     2.4      // Right now, we only encrypt inner messages or outer messages. There
     2.5      // is no in-between. All messages are to be wrapped or are a wrapper.
     2.6      // FIXME: rename this flag!!!
     2.7 -    const char* msg_wrap_info = (flags & PEP_encrypt_flag_no_wrap_message ? 
     2.8 +    const char* msg_wrap_info = (flags & PEP_encrypt_flag_inner_message ? 
     2.9                                   "INNER" : "OUTER");
    2.10      
    2.11      ptext = encapsulate_message_wrap_info(msg_wrap_info, src->longmsg);
    2.12 @@ -1396,10 +1396,10 @@
    2.13          
    2.14          // FIXME - this logic may need to change if we allow
    2.15          // wrappers to attach keys (e.g w/ transport)        
    2.16 -        if (!(flags & PEP_encrypt_flag_no_wrap_message)) {
    2.17 +        if (!(flags & PEP_encrypt_flag_inner_message)) {
    2.18              PEP_STATUS status = encrypt_message(session, src, extra, &inner_message,
    2.19                                                  enc_format,
    2.20 -                                                flags | PEP_encrypt_flag_no_wrap_message);
    2.21 +                                                flags | PEP_encrypt_flag_inner_message);
    2.22              _src = wrap_message_as_attachment(NULL, inner_message);
    2.23          } else {
    2.24              if (!(flags & PEP_encrypt_flag_force_no_attached_key))
    2.25 @@ -2361,12 +2361,13 @@
    2.26  
    2.27                          message* inner_dec_msg = NULL;
    2.28                          
    2.29 -                        PEP_STATUS decrypt_status = decrypt_message(session,
    2.30 -                                                                    inner_message,
    2.31 -                                                                    &inner_dec_msg,
    2.32 -                                                                    keylist,
    2.33 -                                                                    rating,
    2.34 -                                                                    flags);
    2.35 +                        decrypt_status = decrypt_message(session,
    2.36 +                                                         inner_message,
    2.37 +                                                         &inner_dec_msg,
    2.38 +                                                         keylist,
    2.39 +                                                         rating,
    2.40 +                                                         flags);
    2.41 +                                                         
    2.42                          *dst = inner_dec_msg;
    2.43                          return decrypt_status;
    2.44                      }
     3.1 --- a/src/message_api.h	Fri Oct 06 09:37:06 2017 +0200
     3.2 +++ b/src/message_api.h	Mon Oct 09 16:34:08 2017 +0200
     3.3 @@ -37,7 +37,7 @@
     3.4      
     3.5      // This is used for outer messages (used to wrap the real message)
     3.6      // This is only used internally and (eventually) by transport functions
     3.7 -    PEP_encrypt_flag_no_wrap_message = 0x8
     3.8 +    PEP_encrypt_flag_inner_message = 0x8
     3.9  } PEP_encrypt_flags; 
    3.10  
    3.11  typedef unsigned int PEP_encrypt_flags_t;
     4.1 --- a/test/external_revoke_test.cc	Fri Oct 06 09:37:06 2017 +0200
     4.2 +++ b/test/external_revoke_test.cc	Mon Oct 09 16:34:08 2017 +0200
     4.3 @@ -247,6 +247,9 @@
     4.4      
     4.5      // encrypt something to the key
     4.6      cout << "Creating message…\n";
     4.7 +    
     4.8 +    // cout << "First, update identity though!\n";
     4.9 +    // status = update_identity(session, recip1);
    4.10      to_list = new_identity_list(identity_dup(recip1)); // to bob
    4.11      outgoing_msg = new_message(PEP_dir_outgoing);
    4.12      assert(outgoing_msg);
    4.13 @@ -258,8 +261,8 @@
    4.14      cout << "Message created.\n";
    4.15  
    4.16      status = encrypt_message(session, outgoing_msg, NULL, &encrypted_outgoing_msg, PEP_enc_PGP_MIME, 0);
    4.17 -
    4.18      ct = (encrypted_outgoing_msg ? encrypted_outgoing_msg->to->ident->comm_type : outgoing_msg->to->ident->comm_type);
    4.19 +    
    4.20  
    4.21      // CHECK STATUS???
    4.22      cout << "Encryption returns with status " << tl_status_string(status) << endl;
    4.23 @@ -285,11 +288,13 @@
    4.24      status = decrypt_message(session, encrypted_outgoing_msg, &decrypted_msg, &keylist, &rating, &flags);
    4.25      cout << "Decryption returns with status " << tl_status_string(status) << endl;
    4.26      assert(status == PEP_STATUS_OK);
    4.27 -
    4.28 +    assert(decrypted_msg);
    4.29 +    
    4.30      // check rating
    4.31      cout << "Rating of decrypted message to trusted recip: " << tl_rating_string(rating) << endl;
    4.32      assert(rating == PEP_rating_reliable);
    4.33  
    4.34 +    status = update_identity(session, decrypted_msg->to->ident);
    4.35      ct = (decrypted_msg ? decrypted_msg->to->ident->comm_type : outgoing_msg->to->ident->comm_type);
    4.36  
    4.37      cout << "comm_type: " << tl_ct_string(ct) << endl;