是否有人有任何实现AS2服务器以接收和解密AS2消息的经验。 .NET CORE+?
我知道可以使用BizTalk或Azure Logic应用程序,但正在寻找一种在C#代码中实现的方法。在网上找不到很多东西。除了AS2年龄外,这是出于任何特殊原因吗?
我需要具体;
-
通过https
接收AS2消息
- 验证签名
解密消息并提取XML内容
-
发送MDN
因此不确定从哪里开始,因此任何示例或指向此& amp;证书要求将不胜感激。
编辑:
是否找到了以下答案提供的相同链接,以及在同一博客上发送部分文章的消息,但是这不包括MDN和签名验证,是否有人有这些部分的代码示例?
Does anyone have any experience of implementing an AS2 server to receive and decrypt AS2 messages in C# & .NET Core+?
I know it's possible to use Biztalk or Azure Logic Apps but looking for a way to implement this in C# code. Have not been able to find a lot on this online. Is this for any particular reason apart from AS2 being old?
Specifically I need to;
Due to lack of examples not really sure where to start with this so any examples or pointing in the right direction on this & the certificate requirements would be appreciated.
Edit:
Have found the same link provided by an answer below, as well as the message sending part of the article on the same blog, however this doesn't include the MDN and signature validation, does anyone have code examples of these parts?
发布评论
评论(3)
实际上在Net Core中实现AS2端点并不难。我从慢慢发现Mimekit几乎可以做所有的您上面提到的任务。
要充分了解AS2通信的工作原理,您必须阅读很多RFC,这是唯一困难的部分。在您有一个想法之后,将所有内容放在代码中很容易。
Actually implementing an As2 endpoint in net core isn't that hard. I started from https://mattfrear.com/2011/01/03/receiving-as2-messages-with-net/ and slowly found out that Mimekit can do almost all of the tasks you mentioned above.
To fully understand how the As2 communication works you have to read through a lot of rfc's and that's the only hard part. After you get an idea putting it all together in code is easy.
在.NET Core 6中创建的Azure Marketplace中有一个AS2客户端。它称为“ Integration Microservice AS2”,如果Azure不适合您,它们还可以为您的前提项目提供自定义解决方案。
there is an AS2 Client available in Azure Marketplace that is created in .NET Core 6. It is called "Integration Microservice AS2", they can also provide a custom solution for your on premise project if Azure is not working for you.
我过去曾广泛搜索过,但没有提出任何可行的东西。解决方案的关键是能够生成加密的多部分信封。我在BCL中没有发现任何明确支持这一点的东西。
另一方面,我能够在powershell中创建一个测试安全带,以使用opensl for Windows发送 AS2消息来生成加密和签名的信封。遗憾的是,这是我无法共享的商业代码,但是该过程的概述是:
openssl smime -sign -sign -in< raw content file file path> gt; -out<签名的内容文件路径> -signer<私有密钥证书路径>
openssl smime -ecrypt -Outform der -lt;签名的内容文件path> gt; -out<加密内容文件路径> -des3<公共密钥证书路径>
,我没有将其推广到接收消息,但大概OpenSSL支持以相反的方式运行相同的操作。
我提到为POINTERS而言,这是为了实现这一目标的POINTERS 我的答案提到了从Windows/Azure惯例转换为证书转换为OpenSSL/*NIX惯例的复杂性。
I have searched extensively in the past and not come up with anything that works. Key to a solution is the ability to generate an encrypted, multipart envelope. I haven't found anything in the BCL that clearly supports this.
On the other hand I was able to create a test harness in PowerShell for sending AS2 messages using OpenSSL for Windows to generate the encrypted and signed envelope. Regrettably this is commercial code which I cannot share, but an outline of the process is:
openssl smime -sign -in <raw content file path> -out <signed content file path> -signer <private key certificate path>
openssl smime -encrypt -outform DER -in <signed content file path> -out <encrypted content file path> -des3 <public key certificate path>
I didn't generalise this to receiving messages, but presumably openssl supports running the same operations in reverse.
I referred to this question for pointers on how to achieve this. My answer there mentions some complexity about converting from Windows/Azure conventions for certificates to OpenSSL/*nix conventions.