实现:html
1.c#将xml报文作数字签名发送到java服务,java服务成功验签。java
2.c#服务对收到java服务推送的xml报文成功验签。git
前提:算法
1.java服务要求c#
遇到问题:api
1.Java和.net 以前 RSA 私钥秘钥格式问题。加密
2.framework4.0 SignatureDescription could not be created for the signature algorithm supplied. .net
没法为所提供的签名算法建立SignatureDescription。——资料6 第二个连接,关键在:在全局文件中,对加密配置(CryptoConfig)添加算法 RsaPkcs1Sha256SignatureDescriptionxml
3.htm
资料:
1.msdn:xml签名:https://docs.microsoft.com/zh-cn/dotnet/standard/security/how-to-sign-xml-documents-with-digital-signatures
2.msdn:xml验签:https://docs.microsoft.com/zh-cn/dotnet/standard/security/how-to-verify-the-digital-signatures-of-xml-documents
3.csdn讨论帖:https://bbs.csdn.net/topics/392005202
4.C#下解析、生成JAVA的RSA密钥、公钥:https://blog.csdn.net/starfd/article/details/51838589
5.微软对xml加签验签的举例:https://docs.microsoft.com/zh-cn/dotnet/api/system.security.cryptography.xml.signedxml?view=netframework-4.7.2
6.stack overflow对xml sha256签名的讨论帖:
1). https://stackoverflow.com/questions/17258800/c-sharp-support-for-rsa-sha-256-signing-for-individual-xml-elements
2). http://www.voidcn.com/article/p-ezohxnnk-bty.html