1
所以我在这里有一个非常类似的问题。 SOAP KeyInfo values在SOAP请求中添加KeyInfo参考
我想在KeyInfo中添加引用,但似乎无法找到通过代码执行的方法。
这里是预期的输出应该是什么:
<KeyInfo>
<wsse:SecurityTokenReference>
<wsse:Reference URI="#SecurityTest" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>
</wsse:SecurityTokenReference>
</KeyInfo>
而且我确实有这个上面它尝试引用自:
<wsse:BinarySecurityToken ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"
EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
wsu:Id="SecurityTest">Base64CertStuffBlahblah
</wsse:BinarySecurityToken>
在创建的密钥信息部分将尽力只允许我插入一个项目,像一个键,填写这部分,但我只是想参考。这段代码是我一直在努力的,但目前还没有创造出我想要的。
//This creates a X509 clause but it's as far as I've got.
//The "keyInfoData" needs to be of a different type to allow custom reference?
var signer = new SignedXmlWithId(doc) {SigningKey = Key};
KeyInfo keyInfo = new KeyInfo();
KeyInfoX509Data keyInfoData = new KeyInfoX509Data();
keyInfoData.AddCertificate(cert);
keyInfo.AddClause(keyInfoData);
signer.KeyInfo = keyInfo;
感谢您的期待,任何帮助将不胜感激。