AS2报文包括如下四种情况(注意AS2 1.1支持对报文进行压缩传输)
一、情景1( No encryption, no signature)没有加密,没有数字签名
MIME只有一个主体:传递报文的明文,如下
application/xxxx根据报文格式不同而不同,如application/octet-stream,application/xml,application/edifact.下同
AS2头 content-type: application/xxxx AS2头 报文明文
二、 情景2 (No encryption, signature)没有加密,有数字签名
MIME包括两个并列的主题
----zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz指分割符,不同实现不同但是往往比较长和复杂。
AS2头 content-type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha1; boundary="----zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" AS2头 ----zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz Content-Type: application/octet-stream 主体相关的头 报文明文 ----zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz Content-Type: application/pkcs7-signature; name=smime.p7s; smime-type=signed-data 主体相关的头 数字签名(签名算法在AS2头中给出,本例子使用sha1) ----zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
三、情景3 (Encryption, no signature)加密没有签名
MIME外层只有一个主体
AS2头 content-type: application/pkcs7-mime; name="smime.p7m"; smime-type=enveloped-data AS2头 加密后的报文 (加密前是一个仅仅包含报文,content type为 application/xxxx的MIME包)
四、情景4 Encryption, signature(加密,数字签名)
MIME外层只有一个主体
AS2头 content-type: application/pkcs7-mime; name="smime.p7m"; smime-type=enveloped-data AS2头 加密后的报文(是与情景2类似的MIME包-不包含AS2头)
五、MDN回执有不签名和签名两种情景
5.1 情景1 MDN over HTTP, no signature(不签名)
AS2头 Content-Type: multipart/report; report-type=disposition-notification; boundary="----zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" AS2头 ----zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: binary The message you sent on "Tue, 26 Oct 2010 04:32:24 GMT" from "xxxxxx" to "yyyyyyyy" with subject "AS2 test message" has been received successfully on 26 Oct 2010 04:32:24 GMT and this is no guarantee that the message has been read or understood. ----zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz Content-Type: message/disposition-notification Content-Transfer-Encoding: binary Reporting-UA: 223.1.1.128; XXXXXXXXXXXXXXXXXXXXX Original-Recipient: yyyyyyyyyyy Final-Recipient: yyyyyyyyyy Original-Message-ID: <1295227776399941288067544796> Disposition: automatic-action/MDN-sent-automatically; processed Received-content-MIC: poaQNS6MuGVvDwqONFw9L8Ng6jk=, sha1 ----zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
5.2 情景2 MDN over HTTP, signature(签名)
-----yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy:指另外一个分割符
AS2头 Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha1; boundary="----zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" AS2头 ----zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz Content-Type: multipart/report; report-type=disposition-notification;boundary="-----yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy" -----yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: binary The message you sent on "Tue, 26 Oct 2010 04:32:24 GMT" from "xxxxxx" to "yyyyyyyy" with subject "AS2 test message" has been received successfully on 26 Oct 2010 04:32:24 GMT and this is no guarantee that the message has been read or understood. -----yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy Content-Type: message/disposition-notification Content-Transfer-Encoding: binary Reporting-UA: 223.1.1.128 Original-Recipient: yyyyyy Final-Recipient: yyyyyyy Original-Message-ID: <2575437176399941288067570296> Disposition: automatic-action/MDN-sent-automatically; processed Received-content-MIC: SNQ7jE8yo/nTyI4AKOKlNQlkQc4=, sha1 -----yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy ----zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz Content-Type: application/pkcs7-signature; name=smime.p7s; smime-type=signed-data Content-Transfer-Encoding: binary Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature 数字签名 ----zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz