ENGINE-441: PEP_encrypt_flag_force_version_1 added for encrypt message. Can be passed through encrypt_message_and_add_priv_key (or whatever it's called) for PGP-only devices
authorKrista Bennett <krista@pep-project.org>
Tue, 26 Jun 2018 14:05:05 +0200
changeset 277008d7cf271f57
parent 2767 e6746b18e6d5
child 2771 b0c0d39f643d
ENGINE-441: PEP_encrypt_flag_force_version_1 added for encrypt message. Can be passed through encrypt_message_and_add_priv_key (or whatever it's called) for PGP-only devices
src/message_api.c
src/message_api.h
     1.1 --- a/src/message_api.c	Tue Jun 26 12:06:24 2018 +0200
     1.2 +++ b/src/message_api.c	Tue Jun 26 14:05:05 2018 +0200
     1.3 @@ -1584,6 +1584,8 @@
     1.4      if (src->enc_format != PEP_enc_none)
     1.5          return PEP_ILLEGAL_VALUE;
     1.6  
     1.7 +    bool force_v_1 = flags & PEP_encrypt_flag_force_version_1;
     1.8 +    
     1.9      *dst = NULL;
    1.10  
    1.11      if (src->from && (!src->from->user_id || src->from->user_id[0] == '\0')) {
    1.12 @@ -1801,7 +1803,7 @@
    1.13      }
    1.14      else {
    1.15          // FIXME - we need to deal with transport types (via flag)
    1.16 -        if ((max_comm_type | PEP_ct_confirmed) == PEP_ct_pEp) {
    1.17 +        if ((!PEP_encrypt_flag_force_version_1) && ((max_comm_type | PEP_ct_confirmed) == PEP_ct_pEp)) {
    1.18              _src = wrap_message_as_attachment(NULL, src, false);
    1.19              if (!_src)
    1.20                  goto pep_error;
    1.21 @@ -2046,7 +2048,7 @@
    1.22      }
    1.23              
    1.24      // Ok, it's in there. Let's do this.        
    1.25 -    status = encrypt_message(session, src, keys, dst, enc_format, 0);
    1.26 +    status = encrypt_message(session, src, keys, dst, enc_format, flags);
    1.27      
    1.28      // Delete what we added to src
    1.29      free_bloblist(created_bl);
     2.1 --- a/src/message_api.h	Tue Jun 26 12:06:24 2018 +0200
     2.2 +++ b/src/message_api.h	Tue Jun 26 14:05:05 2018 +0200
     2.3 @@ -37,7 +37,11 @@
     2.4      
     2.5      // This is used for outer messages (used to wrap the real message)
     2.6      // This is only used internally and (eventually) by transport functions
     2.7 -    PEP_encrypt_flag_inner_message = 0x8
     2.8 +    PEP_encrypt_flag_inner_message = 0x8,
     2.9 +    
    2.10 +    // This is mainly used by pEp clients to send private keys to 
    2.11 +    // their own PGP-only device
    2.12 +    PEP_encrypt_flag_force_version_1 = 0x16
    2.13      
    2.14  } PEP_encrypt_flags; 
    2.15