消息传输
AS2协议可以选择签名、加密,或者不选择加密、不选择签名,都可以使用HTTP协议进行传输。
- 不签名不加密时,如下图:
实际报文样式:
POST /Contoso/ReceiveHTTP/1.1 Content-Type: text/plain AS2-Version: 1.2 Content-Transfer-Encoding: binary Mime-Version: 1.0 Message-ID: <BIZSRV-2_1C32C2AA-4A0D-4944-A425-801D4E5CD793> Content-Description: body Content-ID: {58FC446E-7D8C-413F-A0D0-45956E48D80E} AS2-To: Fabrikam Disposition-Notification-To: Contoso AS2-From: Contoso EDIINT-Features: multiple-attachments User-Agent: Microsoft (R) BizTalk (R) Server 2010 Host: bizsrv-1 Content-Length: 64 Expect: 100-continue Connection: Close Static text.8320591249.6521165843.NLRM.CN04.8320591249.PDF.INV
- 签名不加密
POST /Contoso/Receive HTTP/1.1 Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg="sha1"; boundary="_99C8D355-8E1E-4E4C-8E3C-21DC6BB66D50_" Disposition-Notification-Options: signed-receipt-protocol=required,pkcs7-signature; signed-receipt-micalg=required,sha1 AS2-Version: 1.2 Message-ID: <BIZSRV-2_5610D942-F883-4BE4-995A-60C949D1C430> Mime-Version: 1.0 EDIINT-Features: multiple-attachments AS2-To: Fabrikam Content-ID: {9BE235D2-2B8E-4892-B3B9-AB2C41880D0F} Disposition-Notification-To: Contoso AS2-From: Contoso User-Agent: Microsoft (R) BizTalk (R) Server 2010 Host: bizsrv-1 Content-Length: 2224 Expect: 100-continue Connection: Close --_99C8D355-8E1E-4E4C-8E3C-21DC6BB66D50_ Content-Type: text/plain Content-Transfer-Encoding: binary Content-Description: body Static text.8320591249.6521165843.NLRM.CN04.8320591249.PDF.INV --_99C8D355-8E1E-4E4C-8E3C-21DC6BB66D50_ Content-type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIDtzCCA7Mw ggKboAMCAQICCmEsP7IAAAA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V7xtVskNKIRyGGu0HryxA945J844jwkpaDMUk5zh3YBnshVyqV0WS1IyuWfjoiKssFBd iC3E4l4wrAj+AWvH0IiZujsR1tJ6RWyScX2ULMxrM2InWYwhVyEtKA2oFdBmHws+Oopvd9d8s6/u zy2WCzrdPLxEAAwL6LLeys5FRj1wqlJ5BRxF3R9v2bCJZjGCAUswggFHAgEBMCQwFjEUMBIGA1UE AxMLQklaU1JWLTEtQ0ECCmEsP7IAAAAAAA4wCQYFKw4DAhoFADANBgkqhkiG9w0BAQEFAASCAQBf nM0som9k/Q6hpUPd48rVY0420CuIu49v+L1Kh5fKjksDcueCAjaBnuTBjoNkLoL+Hvt/DnIpFNvU tDQtO6eSikICC6BS91LW7GSTFl6Sot1fMNZpFg2SH+PYR89V1pZfJ4r5wXFCVXe1w+yPTFeeCdIo 0/JMiZ+eQodvDdFGoEFBrhvdT2OYKfZ5DhEPs8Dxb4wWSck3oZC6SI8UwMTFMEW/RokQ+xZptTTL CNmM1mXUfQ5I9BsbCxX0FzGDzITH6BQpMlF7i5MJM2y/3LfBly5MIWoRoddJtjqAY/BASeIVBtOQ 0ulrnortWhDUbtz9YMYAJg6C0sfCduAF42QRAAAAAAAA --_99C8D355-8E1E-4E4C-8E3C-21DC6BB66D50_--
- 加密不签名
POST /Contoso/Receive HTTP/1.1 Content-Type: application/pkcs7-mime; smime-type=enveloped-data; name="smime.p7m" Disposition-Notification-Options: signed-receipt-protocol=required,pkcs7-signature; signed-receipt-micalg=required,sha1 AS2-Version: 1.2 Content-Transfer-Encoding: binary Mime-Version: 1.0 Message-ID: <BIZSRV-2_F0F79DDB-3231-495E-AFE1-3153325B6744> AS2-To: Fabrikam Disposition-Notification-To: Contoso AS2-From: Contoso EDIINT-Features: multiple-attachments User-Agent: Microsoft (R) BizTalk (R) Server 2010 Host: bizsrv-1 Content-Length: 517 Expect: 100-continue Connection: Close 0.....*.H.. .......0......1..@0..<...0$0.1.0...U....BIZSRV-1-CA. .2qW......0 ..*.H.. .........x 6........~....xk...>..tz<.I.!..:R.uu...l....S.<#oBm..^)..y...U.?s."......T;...p..u..X,......a.h.`...rG.......O4..:....=:......{..A.C.....q>q.....qd....v.d.<..9..e6A8D....0....*.H.. ...0...*.H.. .......K..4......+W.=e ...fo......J9..)._t8.......@...v.1..i.4Q..l.. .q.....fEN...@....-...W...i...6..L.^._=......|)..)......-+..pJ....Z..qNVs
- 签名加密
POST /Contoso/Receive HTTP/1.1 Content-Type: application/pkcs7-mime; smime-type=enveloped-data; name="smime.p7m" Disposition-Notification-Options: signed-receipt-protocol=required,pkcs7-signature; signed-receipt-micalg=required,sha1 AS2-Version: 1.2 Content-Transfer-Encoding: binary Mime-Version: 1.0 Message-ID: <BIZSRV-2_FA1CFD9E-9744-45A9-9E3D-0009BDA1C0EB> AS2-To: Fabrikam Disposition-Notification-To: Contoso AS2-From: Contoso EDIINT-Features: multiple-attachments User-Agent: Microsoft (R) BizTalk (R) Server 2010 Host: bizsrv-1 Content-Length: 2759 Expect: 100-continue Connection: Close 0. ...*.H.. ..... .0. ....1..@0..<...0$0.1.0...U....BIZSRV-1-CA. .2qW......0 ..*.H.. .........%..g..1.,u..Yg..i.H0c./0fl....^....5.....g.+R..].@.k ^tr9..1F.zr.T....A........1.z.......WP.?~.*0J.[........[.......iy.....+. Ou._C.(.K..cB....r....>..S. i...$.)!...8....j}9xZG...xTP?...;.....d...f....m..m.g.c.J....g.D..P.... ....Y=.f.v......,qEJ5_B.z..O.Ol......c..Q.5T..Ov..4.*.D....r...zp...B.x|w*.V..&"K...2...P....I. ...kGN.......i...........g5..K.......lS...".....r.0..z..8.vb...l..7.~.F.>.@.H.|.....9B!.b.V.Qi..J.,...ap..I..8....tmU.e.O....~......fH....~9..h.,*U.%..8O.R.=8/...".w .....K>...F.J..>......_.u.Rn:<.... ......E...;Q.*.VA,l]V........ .m....i ).Qu:n..............l....G...T......E.f..^..1q.x..nY..s0..C.r:....T.q.4>...]1.........0.T7._.S..*.?9.....,}..6e..b....@...LJ.a...|8...s..3.aX.N......6..m......G..._jL.+.....V.U.IB..6w|.x<.H..F....Mu..h..V.t..<.8.. . ......k.G.^0.../...42m.).. FJ....].=Fi...#K.Y.Wg..h...........(...z.........j.nk.....w.y.)..g&..}....s".f..E.S...a.$0.d..BY..9..b..../.(..-.}..[..3.<..D..^..r.....1.....uv.- |...pN.Q.d/...r...*2r. ^..p9.....z....?.y..xe......4. .p.[K..)= f]..+./......|A..... ...`.u..4.Y..9.>.$....[..?..8....o.aB......... ..-U...{.e |..w.........%c/X..S....> ..WMf....O/.....L...%.....q>.tO......`9..........6..a...>.ci.....W)!c.....|..........r.+.&X....S.SGS.R.~.H...qw.D.x...r.%.U{=..*. .3i......v....5....F......L..i6t.K_m..".]...D.........5.........yx.%.v..?W$.=.."o....`......;n......).T._........3EY?..DuMB....9vie.o.../..L.....#..a(..U.]....SLOzz.N..O..:? .._...Qz2.(of.8.V.-_.. ......R|d^..0..,W9..$....%Q.J......2.>.,.......fx......... (...&3.Y.@.exG.ey...!=...f`8... 0...............E.
MDN消息
MDN消息不能加密,只能签名。
MDN消息无论是签名还是不签名,都是MIME格式的消息。
MDN不签名
HTTP/1.1 200 OK Content-Length: 681 Content-Type: multipart/report; report-type=disposition-notification; .boundary="_E4BB7B25-A5C0-4BA7-BA06-176B374C8A30_" Server: Microsoft-IIS/7.5 AS2-Version: 1.2 Message-ID: <BIZSRV-1_9676DD36-B582-410C-A431-7FC467005D45> Mime-Version: 1.0 EDIINT-Features: multiple-attachments AS2-To: Contoso AS2-From: Fabrikam X-Powered-By: ASP.NET Date: Wed, 09 Nov 2016 03:30:52 GMT Connection: close --_E4BB7B25-A5C0-4BA7-BA06-176B374C8A30_ Content-Type: text/plain Content-Transfer-Encoding: binary Content-ID: {243F1896-6016-48A8-B2F9-13C718B2D015} Content-Description: plain This is Toll MDN --_E4BB7B25-A5C0-4BA7-BA06-176B374C8A30_ Content-Type: message/disposition-notification Content-Transfer-Encoding: 7bit Content-ID: {5A37A23A-A50F-4FD4-89C8-5FB23EAF2478} Content-Description: body Final-Recipient: rfc822; Fabrikam Original-Message-ID: <BIZSRV-2_1C32C2AA-4A0D-4944-A425-801D4E5CD793> Disposition: automatic-action/MDN-sent-automatically; processed Received-Content-MIC: IhpgpyGz330b6V/lb2gEvHHAbJ4=, sha1 --_E4BB7B25-A5C0-4BA7-BA06-176B374C8A30_--
MDN签名
HTTP/1.1 200 OK Content-Length: 2880 Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg="sha1"; boundary="_60276327-5600-4CA2-86E1-06CEDAED1A46_" Server: Microsoft-IIS/7.5 AS2-Version: 1.2 Message-ID: <BIZSRV-1_EC23F83B-501A-4CC0-9C06-F7CBB4CF6767> Mime-Version: 1.0 EDIINT-Features: multiple-attachments AS2-To: Contoso AS2-From: Fabrikam X-Powered-By: ASP.NET Date: Wed, 09 Nov 2016 02:23:42 GMT Connection: close --_60276327-5600-4CA2-86E1-06CEDAED1A46_ Content-Type: multipart/report; report-type=disposition-notification; .boundary="_554A0419-2C77-4521-9668-42E8C1EB4548_" --_554A0419-2C77-4521-9668-42E8C1EB4548_ Content-Type: text/plain Content-Transfer-Encoding: binary Content-ID: {529F03AA-AF3F-453A-B890-D6A88176C500} Content-Description: plain This is Toll MDN --_554A0419-2C77-4521-9668-42E8C1EB4548_ Content-Type: message/disposition-notification Content-Transfer-Encoding: 7bit Content-ID: {0D047958-8B3C-40D1-9CCC-1F48098FBDA4} Content-Description: body Final-Recipient: rfc822; Fabrikam Original-Message-ID: <BIZSRV-2_2CF73B67-1A9A-4931-91E0-A57FFCBAF260> Disposition: automatic-action/MDN-sent-automatically; processed Received-Content-MIC: IhpgpyGz330b6V/lb2gEvHHAbJ4=, sha1 --_554A0419-2C77-4521-9668-42E8C1EB4548_-- --_60276327-5600-4CA2-86E1-06CEDAED1A46_ Content-type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAG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