如何做公证网站网页发布时间,个人备案的域名拿来做经营网站,建设公司上市企业有多少?,辽源做网站公司由于客户的需要#xff0c;项目中需要使用AS2协议与客户进行系统连接#xff0c;因此对AS2的协议进行研究和学习。AS2的协议是支持B2B的贸易伙伴间进行EDI数据交换的协议。以下是学习的笔记。 术语#xff08;涉及的名词#xff09; MIME简介 AS2消息 AS2消息传送 项目中需要使用AS2协议与客户进行系统连接因此对AS2的协议进行研究和学习。AS2的协议是支持B2B的贸易伙伴间进行EDI数据交换的协议。以下是学习的笔记。 术语涉及的名词 MIME简介 AS2消息 AS2消息传送 HTTP AS2-MDN消息 项目简介 与应用实例 术语 1AS2 :Applicability Statement 2 2MIME : 多用途的网际邮件扩充协议(Multipurpose Internet Mail Extension protocol) 3B2B : Business to Business 4EDI :Electronic Data Interchange 5EC: Business-to-Business Electronic Commerce 6Receipt: 收据 是一个功能性的消息是接受者发送给发送者的一个信息交换的确认收据这个收据可以是异步发送也可以是同步发送 7Signed Receipt:经过签名的收据 8Synchronous Receipt: 同步收据收据返回和发送者发送的信息在同一个httpsession中发生。 9Asynchronous Receipt:异步收据收据返回和发送者发送的信息不在同一个http session中发送 10Message Disposition Notification (MDN): 用来传送收据的一种消息格式一个mdn是一个收据 11Non-repudiation of receipt (NRR): 收据的认可性或者说收据的作用当经过签名edi/ec交换信息的原始发送者验证了接收者返回的签名收据时就标志一个法律事件的发生。 12S/MIME: 是对Internet MIME messages进行数字签名或者加密的格式和协议 13Cryptographic Message Syntax (CMS): 对任意消息进行加密、字数签名、鉴别的一种封装方法 14SHA-1: 一种安全的、用来进行数字签名的hash算法在AS2中被推荐使用的算法 15MD5: 一种安全的数字签名hash算法在AS2中允许使用的算法 16MIC: The message integrity check (MIC), 消息完成行校验也称为消息的摘要是hash算法摘要的输出。 17User Agent (UA): AS2请求的操作和处理应用。 2 MIME介绍 MIME协议用于定义复杂邮件体的格式它可以表达多段平行的文本内容和非文本的邮件内容例如在邮件体中内嵌的图像数据和邮件附件等。另外MIME协议的数据格式也可以避免邮件内容在传输过程中发生信息丢失。MIME协议不是对RFC822邮件格式的升级和替代而是基于RFC822邮件格式的扩展应用。 MIME HEADER一个采用了 MIME协议的电子邮件就叫做MIME邮件MIME邮件在RFC822文档中定义的邮件头字段的基础上扩充了一些自己专用的邮件头字段如使用Content-Type头字段指定邮件体的MIME类型。 Content-Type:multipart/mixed; boundary----_Part_13_15604459.1297646186406.其中“multipart/mixed”部分说明邮件体中包含有多段数据每段数据之间使用boundary属性中指定的字符文本作为分隔标识符。 Content-Transfer-Encoding HEADER: Content-Transfer-Encoding头字段用于指定MIME消息体中的内容所采用的邮件编码方式 7bit:指消息体内容全部是没有经过编码的ASCII字符。 8bit:指消息体内容是没有经过编码的原始数据且其中包含有非ASCII字符的数据。现在的邮件服务器基本上都支持8Bit编码。 BASE64Base64是将二进制数据转换成可打印的ASCII字符的一种最常见的编码方式它的基本原理是将一组连续的字节数据按6个bit位进行分组然后对每组数据用一个ASCII字符来表示。 BINARY使用文件源内容HTTP支持 Content-Disposition:Content- Disposition头字段用于指定邮件阅读程序处理数据内容的方式有inline和attachment两种标准方式inline表示直接处理而attachment表示当做附件处理。 3 S/MIME S/MIME是一套标准它描述客户端如何创建操作接受和读被数字签名、信息加密的邮件。 S/MIME增加了新的MIME数据类型用于提供数据保密、完整性保护、认证和鉴定服务等功能这些数据类型包括“应用 /pkcs7-MIME”application/pkcs7-MIME、“复合/已签名”multipart/signed和“应用 /pkcs7-签名”application/pkcs7-signature等。 S/MIME只保护邮件的邮件主体对头部信息则不进行加密以便让邮件成功地在发送者和接收者的网关之间传递。 MIME 消息可以包含文本、图象、声音、视频及其它应用程序的特定数据。 S/MIME 并不仅限于邮件的使用它也能应用于任何可以传送 MIME 数据的传输机制例如 HTTP 。 4 AS2 AS2协议是用来让贸易伙伴的双方交换EDI数据的协议AS2协议中的报文分为两种一种是发送方发送EDI数据的报文另一种是接收方对收到数据后发送给发送方的消息首先来看一下发送方发送给贸易伙伴的接收方的消息格式。 AS2协议可以选择签名、加密或者不选择加密、不选择签名都可以使用HTTP协议进行传输。 不签名不加密时如下图 实际报文样式 POST / HTTP/1.1 as2-version: 1.2 ediint-features: multiple-attachments, CEM mime-version: 1.0 recipient-address: http://localhost:10080 message-id: mendelson_opensource_AS2-1297645774218-2mycompanyAS2_mendelsontestAS2 as2-from: mycompanyAS2 as2-to: mendelsontestAS2 subject: AS2 message from: as2company.com Connection: close, TE date: Mon, 14 Feb 2011 09:09:34 CST content-type: application/EDI-Consent disposition-notification-to: http://localhost:8080/as2/HttpReceiver disposition-notification-options: signed-receipt-protocoloptional, pkcs7-signature; signed-receipt-micalgoptional, sha1, md5 content-disposition: attachment; filenameAS2Message8994276009463294233.as2 host: localhost:10080 Content-Length: 1075 User-Agent: mendelson opensource AS2 1.1 build 33 - www.mendelson-e-c.com Expect: 100-Continue ISA*00*ASCENTIAL *01*92511930 *zz*myPartner *zz*myCompany *940401*0942*U*00201*000000002*0*T* GS*PO*006250740*3122721850*940401*0942*1*X*002003 ST*850*1 BEG**BY*ab100**931028 NTE**This is a header message 签名不加密 POST / HTTP/1.1 as2-version: 1.2 ediint-features: multiple-attachments, CEM mime-version: 1.0 recipient-address: http://localhost:10080 message-id: mendelson_opensource_AS2-1297646186359-5mycompanyAS2_mendelsontestAS2 as2-from: mycompanyAS2 as2-to: mendelsontestAS2 subject: AS2 message from: as2company.com connection: close, TE date: Mon, 14 Feb 2011 09:16:26 CST content-type: multipart/signed; protocolapplication/pkcs7-signature; micalgsha1; boundary----_Part_13_15604459.1297646186406 disposition-notification-to: http://localhost:8080/as2/HttpReceiver disposition-notification-options: signed-receipt-protocoloptional, pkcs7-signature; signed-receipt-micalgoptional, sha1, md5 content-disposition: attachment; filenamesmime.p7m host: localhost:10080 Content-Length: 3344 User-Agent: mendelson opensource AS2 1.1 build 33 - www.mendelson-e-c.com Expect: 100-Continue ------_Part_13_15604459.1297646186406 Content-Type: application/EDI-Consent Content-Transfer-Encoding: binary Content-Disposition: attachment; filenameAS2Message8994276009463294233.as2 ISA*00*ASCENTIAL *01*92511930 *zz*myPartner *zz*myCompany * ------_Part_13_15604459.1297646186406 Content-Type: application/pkcs7-signature; namesmime.p7s; smime-typesigned-data Content-Transfer-Encoding: base64 Content-Disposition: attachment; filenamesmime.p7s Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIAwggLQMIIC ------_Part_13_15604459.1297646186406-- 加密不签名 实际报文样式 POST / HTTP/1.1 as2-version: 1.2 ediint-features: multiple-attachments, CEM mime-version: 1.0 recipient-address: http://192.168.1.101:10080 message-id: mendelson_opensource_AS2-1298089731500-1mycompanyAS2_mendelsontestAS2 as2-from: mycompanyAS2 as2-to: mendelsontestAS2 subject: AS2 message from: as2company.com connection: close, TE date: Sat, 19 Feb 2011 12:28:51 CST content-type: application/pkcs7-mime; smime-typeenveloped-data; namesmime.p7m receipt-delivery-option: http://192.168.1.101:8080/as2/HttpReceiver disposition-notification-to: http://192.168.1.101:8080/as2/HttpReceiver disposition-notification-options: signed-receipt-protocoloptional, pkcs7-signature; signed-receipt-micalgoptional, sha1, md5 content-disposition: attachment; filenameinbound.EDIX12 host: 192.168.1.101:10080 Content-Length: 1496 User-Agent: mendelson opensource AS2 1.1 build 33 - www.mendelson-e-c.com Expect: 100-Continue 0