## CamelMultipartSigned

CamelMultipartSigned

## Synopsis

                        CamelMultipartSigned;
    CamelMultipartSigned * camel_multipart_signed_new       (void);
    CamelStream *       camel_multipart_signed_get_content_stream
                                                            (CamelMultipartSigned *mps,
                                                             CamelException *ex);

## Description

## Details

### CamelMultipartSigned

    typedef struct {
    	CamelMultipart parent_object;

    	/* these are the client visible parts, decoded forms of our data wrapper content */
    	CamelMimePart *content;
    	CamelMimePart *signature;

    	/* the raw content which must go over the wire, if we have generated it */
    	/* perhaps this should jsut set data_wrapper->stream and update start1/end1 accordingly, as it is done
    	   for other parts, or visa versa? */
    	CamelStream *contentraw;

    	/*int state;*/

    	/* just cache some info we use */
    	char *protocol;
    	char *micalg;

    	/* offset pointers of start of boundary in content object */
    	off_t start1, end1;
    	off_t start2, end2;
    } CamelMultipartSigned;

### camel_multipart_signed_new ()

    CamelMultipartSigned * camel_multipart_signed_new       (void);

Create a new CamelMultipartSigned object.

A MultipartSigned should be used to store and create parts of type "multipart/signed". This is because multipart/signed is entirely broken-by-design (tm) and uses completely different semantics to other mutlipart types. It must be treated as opaque data by any transport. See rfc 3156 for details.

There are 3 ways to create the part: Use construct_from_stream. If this is used, then you must set the mime_type appropriately to match the data uses, so that the multiple parts my be extracted.

Use construct_from_parser. The parser MUST be in the CAMEL_MIME_PARSER_STATE_HEADER state, and the current content_type MUST be "multipart/signed" with the appropriate boundary and it SHOULD include the appropriate protocol and hash specifiers.

Use sign_part. A signature part will automatically be created and the whole part may be written using write_to_stream to create a 'transport-safe' version (as safe as can be expected with such a broken specification).

Returns : | a new CamelMultipartSigned object

### camel_multipart_signed_get_content_stream ()

    CamelStream *       camel_multipart_signed_get_content_stream
                                                            (CamelMultipartSigned *mps,
                                                             CamelException *ex);

Get the raw signed content stream of the multipart/signed MIME part suitable for use with verification of the signature.

`mps` : | a CamlMultipartSigned object
`ex` : | a CamelException
Returns : | the signed content stream