diff --git a/src/message_api.c b/src/message_api.c index c60521e0..78035bd6 100644 --- a/src/message_api.c +++ b/src/message_api.c @@ -2754,9 +2754,13 @@ DYNAMIC_API PEP_STATUS encrypt_message( else { // hide subject if (enc_format != PEP_enc_inline && enc_format != PEP_enc_inline_EA) { - status = replace_subject(_src); - if (status == PEP_OUT_OF_MEMORY) - goto enomem; + // do not replace subject if message format 1.x and unencrypted + // subject is enabled + if (!(wrap_type == PEP_message_unwrapped && session->unencrypted_subject)) { + status = replace_subject(_src); + if (status == PEP_OUT_OF_MEMORY) + goto enomem; + } } if (!(flags & PEP_encrypt_flag_force_no_attached_key)) added_key_to_real_src = true;