On Fri, 9 Dec 2011 14:54:26 -0500, Austin Clements wrote: > + /* Handle PGP/MIME parts */ > + if (GMIME_IS_MULTIPART_ENCRYPTED (part) && out->ctx->decrypt) { > + if (out->children != 2) { > + /* this violates RFC 3156 section 4, so we won't bother with it. */ > + fprintf (stderr, "Error: %d part(s) for a multipart/encrypted " > + "message (should be exactly 2)\n", > + out->children); > + } else { > + out->is_encrypted = TRUE; As per Dmitry's previous point, maybe it's better to do something like: if (GMIME_IS_MULTIPART_ENCRYPTED (part)) { out->is_encrypted = TRUE; if (out->ctx->decrypt) { if (out->children != 2) { ... And similarly for is_signed. > + GMimeMultipartEncrypted *encrypteddata = > + GMIME_MULTIPART_ENCRYPTED (part); > + out->decrypted_child = g_mime_multipart_encrypted_decrypt > + (encrypteddata, out->ctx->cryptoctx, &err); > + if (out->decrypted_child) { > + out->decrypt_success = TRUE; > + out->is_signed = TRUE; > + out->sig_validity = g_mime_multipart_encrypted_get_signature_validity (encrypteddata); Encrypted messages are not necessarily signed, so we need to be careful about setting is_signed = TRUE based just on decryption status. The problem is that gmime's handling of this stuff (at least last I looked in 2.4) is not so good. g_mime_multipart_encrypted_get_signature_validity () should return GMIME_SIGNATURE_STATUS_UNKNOWN if there's no signature, so I think is_signed should be set TRUE only if sig_validity is not UNKNOWN. I've really been meaning to overhaul this stuff for gmime 2.6. Hopefully I'll start looking at that after these patches go through. jamie.