现在的位置: 首页 > 综合 > 正文

CPIM:消息格式

2014年02月16日 ⁄ 综合 ⁄ 共 2683字 ⁄ 字号 评论关闭

CPIM:消息格式

                                                                                                   ——MoaKap整理

Message/CPIM是一个两部分实体,第一部分为消息元数据,第二部分为消息内容。这两部分与包装好的MIME头域相互独立,并且两部分之间用空格行隔开。消息元数据头信息遵循比MIME消息内容的头格式更严格的格式要求。

一个完整的消息格式如下:

      m: Content-type: Message/CPIM

      s:

      h: (message-metadata-headers)

      s:

      e: (encapsulated MIME message-body)

其中,标签“m:”,“s:”,“h:”,“x:”并不是消息格式的一部分,而是用来区分消息的不同部分。具体含义如下:

      m:  整个消息的MIME消息头

      s:   空格分隔行

      h:   消息头

      e:   包含消息内容在内的封装好的MIME对象

      x:   符合MIME安全的若干消息包装

u  Message/CPIM消息的MIME消息头(m:)

      消息的MIME消息头表示该消息采用的CPIM格式。具体形式为:

      Content-type: Message/CPIM

u  消息头(h:)

在传输过程中,消息头的格式、顺序及内容都不能被修改。

具体格式为:KeyValue

对消息头的要求有:

    确保一个消息头在同一行;

    每行一个消息头;

    处理器不能对消息头的长度限制;

    消息头的开始和结尾不能出现空格;

    必须使用UTF-8字符;

    使用CRLF结束该行;

    消息头名称只能包含US ASCII码字符;

    不能包含任何控制字符;

    消息头名称冒号后必须有一个空格;

    多行可以使用相同的消息头;

    消息 头必须配对;

    在不能识别消息头的情况下,该消息头将被忽略;

    消息头的顺序不能改变;

例如:

To: Pooh Bear <im:pooh@100akerwood.com>

From: <im:piglet@100akerwood.com>

DateTime: 2001-02-02T10:48:54-05:00

CPIM定义的消息头有:NSRequireFromToccDateTimeSunject

 

 

下面是一个Message/CPIM消息的例子:

      m: Content-type: Message/CPIM

      s:

      h: From: MR SANDERS <im:piglet@100akerwood.com>

      h: To: Depressed Donkey <im:eeyore@100akerwood.com>

      h: DateTime: 2000-12-13T13:40:00-08:00

      h: Subject: the weather will be fine today

      h: Subject:;lang=fr beau temps prevu pour aujourd'hui

      h: NS: MyFeatures <mid:MessageFeatures@id.foo.com>

      h: Require: MyFeatures.VitalMessageOption

      h: MyFeatures.VitalMessageOption: Confirmation-requested

      h: MyFeatures.WackyMessageOption: Use-silly-font

      s:

      e: Content-type: text/xml; charset=utf-8

      e: Content-ID: <1234567890@foo.com>

      e:

      e: <body>

      e: Here is the text of my message.

      e: </body>

为了确保Message/CPIM的安全性,应用部署可以使用RFC1847,或其它合适的安全协议(如S/MIMEopenPGP)对上述消息加密。

使用S/MIMEpkcs7,上述消息变为:

      x: Content-Type: multipart/signed; boundary=next;micalg=sha1; protocol=application/pkcs7-signature

      x:

      x: --next

      m: Content-Type: Message/CPIM

      s:

      h: From: MR SANDERS <im:piglet@100akerwood.com>

      h: To: Dopey Donkey <im:eeyore@100akerwood.com>

      h: DateTime: 2000-12-13T13:40:00-08:00

      h: Subject: the weather will be fine today

      h: Subject:;lang=fr beau temps prevu pour aujourd'hui

      h: NS: MyFeatures <mid:MessageFeatures@id.foo.com>

      h: Require: MyFeatures.VitalMessageOption

      h: MyFeatures.VitalMessageOption: Confirmation-requested

      h: MyFeatures.WackyMessageOption: Use-silly-font

      s:

      e: Content-type: text/xml; charset=utf-8

      e: Content-ID: <1234567890@foo.com>

      e:

      e: <body>

      e: Here is the text of my message.

      e: </body>

      x: --next

      x: Content-Type: application/pkcs7-signature

      x:

      x: (signature stuff)

          :

      x: --next--

 

参考:

          RFC3862  CPIM: Message Format 

抱歉!评论已关闭.