Chinaunix首页 | 论坛 | 博客
  • 博客访问: 276155
  • 博文数量: 83
  • 博客积分: 2393
  • 博客等级: 大尉
  • 技术积分: 640
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-24 15:14
文章分类

全部博文(83)

文章存档

2019年(21)

2011年(5)

2010年(2)

2009年(1)

2008年(9)

2007年(33)

2006年(12)

我的朋友

分类: IT业界

2011-02-20 11:51:38

  • 如何请求MDN

       MDN是由发送方指定,要求接收方回应MDN,并且可以指定MDN回应方式,即回应同步或者异步的MDN.

      接收方要发送一个MDN的地址放置在发送方发过来的AS2消息的如下头字段中,
    MDN-request-header = "Disposition-notification-to"
                            ":"  mail-address
   例如:Disposition-notification-to:
  
   MDN使用SMTP传输的用法是遗留的语法。因为这个规范在从SMTP到HTTP协议是被修正过。
   这个地址不用来标识MDN要返回的位置。接收应用程序必须忽略这个值,并且不能校验这个地址的语法。

   当请求一个基于MDN的收据时,消息创建方在消息体之前提供附加的头信息。这个头的标记如下:
   一个Message-ID被增加用来支持消息的顺序,所以一个Original-Message-Id可以作为MDN的一部分被返回。
   其他头,尤其是"Subject" 和 "Date"应该被提供,这些头的值经常在人工读取MDN是用到,用来帮助识别原始信息。

  •    请求异步MDN

   当请求时,除非要求一个异步消息否则MDN将会在HTTP响应中返回。
    为了请求一个异步的MDN如下的头必须防止在发送的信息中:
   Receipt-Delivery-Option: return-URL
   例如:  Receipt-Delivery-Option:
   "receipt-delivery-option: return-url"字符串标志MDN使用的URL,如果收据是同步的则这个头不是会出现。
   email值在receipt-delivery-option中是不会出现的因为这个是一个限制地址(参见RFC 2822 )。
   receipt-delivery-option的值必须是一个URL;
   例如:
    Receipt-delivery-option:
    Receipt-delivery-option:

  •    MDN发送时的头

       Disposition-notification-options头标志了MDN的特性。在这些选项中最重要是的是MDN的签名选项标志。
如下例:
        Disposition-notification-options:
             signed-receipt-protocol=optional,pkcs7-signature;
             signed-receipt-micalg=optional,sha1,md5
实际样式:disposition-notification-options = signed-receipt-protocol=optional, pkcs7-signature; signed-receipt-micalg=optional, sha1, md5

  • disposition-notification-options语法
    语法如下:

     如下:Disposition-notification-options =
         "Disposition-Notification-Options" ":"
                  disposition-notification-parameters

         disposition-notification-parameters部分的语法如下:

         disposition-notification-parameters =
                               parameter *(";" parameter)
          parameter的语法如下:
          parameter = attribute "=" importance ", " 1#value"
 
           importance的语法如下:
           importance = "required" | "optional"

          所以Disposition-notification-options 部分值形式如下所示:
          signed-receipt-protocol=optional,;
          signed-receipt-micalg=optional,,,...;

         通常情况下:对于S/MIME分离签名的格式情况 值为 "pkcs7-signature"
         MIC的算法通常情况是:
           算法名        值
           SHA-1        sha1
            MD5          md5

  • MDN的格式和值

      MDN一般格式,AS2-MDN的规范定义如下("|"标志或的关系),AS2-MDN的格式如下:
       AS2-MDN=AS2-sync-MDN | AS2-async-http-MDN |  AS2-async-smtp-MDN

  •       同步的MDN

      AS2-sync-MDN =
       Status-Line
       *(( general-header | response-header | entity-header )
       CRLF )
       CRLF
       AS2-MDN-body

  •    异步的MDN

      AS2-async-http-MDN =
       Request-Line
       *(( general-header | request-header | entity-header )
       CRLF )
       CRLF
       AS2-MDN-body

  • MDN-BODY格式

     AS2-MDN-body =
       AS2-signed-MDN-body | AS2-unsigned-MDN-body

       AS2-MDN-body是一个带有“disposition-notification”报告类型为multipart/report的MIME 。
       当消息是不签名时AS2-MDN包含指定为"multipart/report"类型的。

 

       第一部分是可以人工读取的部分,包含了部署信息的普通描述。
        第二部分是机器可以读取的部分,它的定义如下:
      AS2-disposition-notification-content =
       [ reporting-ua-field CRLF ]
       [ mdn-gateway-field CRLF ]
       final-recipient-field CRLF
       [ original-message-id-field CRLF ]
       AS2-disposition-field CRLF
       *( failure-field CRLF )
       *( error-field CRLF )
       *( warning-field CRLF )
       *( extension-field CRLF )
       [ AS2-received-content-MIC-field CRLF ]

    

         

    实际报文样式

        

  1. ediint-features = multiple-attachments, CEM
  2. recipient-address =
  3. host = 192.168.1.101:8080
  4. expect = 100-continue
  5. server = mendelson opensource AS2 1.1 build 33 -
  6. connection = close, TE
  7. date = Sun, 13 Feb 2011 13:51:20 CST
  8. content-type = multipart/signed; protocol="application/pkcs7-signature"; micalg=sha1; boundary="----=_Part_4_10679349.1297576280390"
  9. as2-from = mendelsontestAS2
  10. mime-version = 1.0
  11. message-id =
  12. user-agent = mendelson opensource AS2 1.1 build 33 -
  13. content-length = 3062
  14. from = as2@mendelson-e-c.com
  15. as2-to = mycompanyAS2
  16. as2-version = 1.2
  17. subject = Message Delivery Notification

 

  1. ------=_Part_4_10679349.1297576280390
  2. Content-Type: multipart/report; report-type=disposition-notification;
  3. boundary="----=_Part_1_17359925.1297576280312"
  4. ------=_Part_1_17359925.1297576280312
  5. Content-Type: text/plain
  6. Content-Transfer-Encoding: 7bit
  7. The AS2 message has been received. Thank you for exchanging AS2 messages with mendelson opensource AS2.
  8. Please download your free copy of mendelson opensource AS2 today at
  9. ------=_Part_1_17359925.1297576280312
  10. Content-Type: message/disposition-notification
  11. Content-Transfer-Encoding: 7bit
  12. Reporting-UA: mendelson opensource AS2
  13. Original-Recipient: rfc822; mendelsontestAS2
  14. Final-Recipient: rfc822; mendelsontestAS2
  15. Original-Message-ID:
  16. Disposition: automatic-action/MDN-sent-automatically; processed
  17. Received-Content-MIC: Y4rcJno6TpZTZG5Xl037Ov5WSnk=, sha1
  18. ------=_Part_1_17359925.1297576280312--
  19. ------=_Part_4_10679349.1297576280390
  20. Content-Type: application/pkcs7-signature; name=smime.p7s; smime-type=signed-data
  21. Content-Transfer-Encoding: base64
  22. Content-Disposition: attachment; filename="smime.p7s"
  23. Content-Description: S/MIME Cryptographic Signature
  24. MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIAwggLQMIIC
  25. ZnZIlytkRzMY4cR1K8A9zweWgVlBwGsbSWwAAAAAAAA=
  26. ------=_Part_4_10679349.1297576280390--
  • AS2-MDN部分字段介绍 

AS2-disposition-field =
       "Disposition" ":" disposition-mode ";"
       AS2-disposition-type [ '/' AS2-disposition-modifier ]

    disposition-mode =
       action-mode "/" sending-mode
 action-mode =
       "manual-action" | "automatic-action“

 sending-mode =
       "MDN-sent-manually" | "MDN-sent-automatically"

 AS2-disposition-type =
       "processed" | "failed"

 
 AS2-disposition-modifier =
       ( "error" | "warning" ) | AS2-disposition-modifier-extension

 AS2-disposition-modifier-extension =
       "error: authentication-failed" |
       "error: decompression-failed" |
       "error: decryption-failed" |
       "error: insufficient-message-security" |
       "error: integrity-check-failed" |
       "error: unexpected-processing-error" |
       "warning: " AS2-MDN-warning-description |
       "failure: " AS2-MDN-failure-description

 AS2-MDN-warning-description = *( TEXT )

   AS2-MDN-failure-description = *( TEXT )


 AS2-received-content-MIC-field =
       "Received-content-MIC" ":" encoded-message-digest ","
       digest-alg-id CRLF

   encoded-message-digest =
       1*( 'A'-Z' | 'a'-'z' | '0'-'9' | '/' | '+' | '=' )  (
       i.e. base64( message-digest ) )

   digest-alg-id = "sha1" | "md5"

  • 开源的项目

    开源的OPENAS2,提供了基本的AS2协议交换和实现方式。
     MENDELSON OPENSOURCE AS2,提供了很好的测试工具,可以验证自己系统的功能,是否符合标准的协议。

        以上的协议内容主要来自rfc4130。

   
 


阅读(6646) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~