c# - Adding KeyInfo reference in SOAP request -
so i'm having similar issue post here. soap keyinfo values
i wanting add reference within keyinfo can't seem find way through code.
here expected output should be:
<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>
and have above trying reference from:
<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>
every attempt @ creating keyinfo portion allows me insert item, key, fill in part in want reference. code i've been working not creating want @ moment.
//this creates x509 clause it's far i've got. //the "keyinfodata" needs of different type 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;
thanks looking, appreciated.
so piece of code lets me add want keyinfo portion.
keyinfo keyinfo = new keyinfo(); xmlelement x = doc.createelement("wsse","securitytokenreference", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"); xmlelement y = doc.createelement("wsse","reference", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"); y.setattribute("uri","#securitytest"); y.setattribute("valuetype", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#x509v3"); x.appendchild(y); var keyinfodata = new keyinfonode(x); keyinfo.addclause(keyinfodata); signer.keyinfo = keyinfo;
this produces following result:
<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>
this didn't seem fix issue though soap "looks" correct. maybe else.
Comments
Post a Comment