Highlighted
New Member.
96 views

Scripting problem with federated security logon (ADFS) and encrypted/encoded WCF calls

Spoiler

Hi

 

I am trying to record and replay a WPF application using WCF calls in VuGen version 11.52.

The application is using a federated security model implemented via Microsoft ADFS.

After logon the WCF communication is encrypted via server certificates (message based security) and is encoded with MTOM.

My VuGen scripting problem can be divided into 2 sub problems.

-   Logon

-   Encrypted data communication.

 

Logon

I have the following code from the developers. They are setting a few properties in the c# .net code like this:

var adfsBinding = new WS2007FederationHttpBinding(WSFederationHttpSecurityMode.TransportWithMessageCredential);

adfsBinding.Security.Message.EstablishSecurityContext = false;

adfsBinding.Security.Message.IssuedKeyType = SecurityKeyType.BearerKey;

 

var channelFactory = new WSTrustChannelFactory(adfsBinding, _resourceProviderEndpointAdress);

channelFactory.TrustVersion = TrustVersion.WSTrust13;

channelFactory.Credentials.SupportInteractive = false;

channelFactory.Credentials.UseIdentityConfiguration = true;

return channelFactory;

 

and

var requestSecurityToken = new RequestSecurityToken(RequestTypes.Issue, KeyTypes.Bearer);

requestSecurityToken.AppliesTo = _relyingPartyIdentifier;

return requestSecurityToken;

 

My problem is that the second server request in my script has a DigestValue and a SignedValue that I can’t correlate.

 

…<DigestValue>7XqWVH15HepZnau91LPRAXJsDrI=</DigestValue></Reference></SignedInfo>
 <SignatureValue>gSXKF+4LKy6Ek0lCQnZR2b5ebVI=</SignatureValue>…

 

It seems like the request is signed by the client, but the developer doesn’t know exactly what happens internally in the WCF framework.

 

Have any of you out there tried to script something like the above, and did you succeed scripting it?

 

In VuGen in “Manage Services” under the “Protocol and Security” tab I can set a lot of different settings regarding security. I can for example see that one of the options is “WCF – WSFederationHTTPBinding”, but I really don’t know how to set the options. I have tried to read the chapter about “Web Services – Security” in the user’s guide to LoadRunner but it mostly states the possible options for each field, and not how to figure out how you should set the options.

 

Is there a guide to setting these options?

 

Encrypted data communication

 

When logon is done I can’t see the real content of the “data communication”, because it is encrypted. I can see the XML tag names, but all data is encrypted with a server certificate and then encoded via MTOM. Can VuGen help me decrypting and decoding this kind of WCF request?

 

I have looked at the Data Format Extention, but again I can’t figure out how to set the options.

 

A part of the WCF request looks like this:

...<e:EncryptedData Id=\"_3\" Type=\"http://www.w3.org/2001/04/xmlenc#Content\" xmlns:e=\"http://www.w3.org/2001/04/xmlenc#\"><e:EncryptionMethod "

                      "Algorithm=\"http://www.w3.org/2001/04/xmlenc#aes256-cbc\"/><KeyInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><o:SecurityTokenReference xmlns:o=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><o:Reference ValueType=\"http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512/dk\" URI=\"#_1\"/></o:SecurityTokenReference></KeyInfo><e:CipherData><e:CipherValue>iwiv5D98GhyQQ9vu25ts3h3zEGGsU0cfqIenkI4LUup0Xc5MxrDLehtPP4mv2ybT8x41qt+qx3+"

                      "BcV4ks4Lgm26J0LkhUa0bYIyVPFqjY1hVYJGmucBtMqmpLA4beMw4C76Sr7NNQD4sXIgEaU3Tsg==</e:CipherValue></e:CipherData></e:EncryptedData></s:Body></s:Envelope>\r\n--uuid:ef636835-787a-473a-ab4b-c7b03e28bc21+id=75\r\nContent-ID: <http://tempuri.org/1/635151027239211385>\r\nContent-Transfer-Encoding: binary\r\nContent-Type: application/octet-stream\r\n\r\n\\xD8\\xEE\\xD6x\\xFC\\xA3y\\xBD\\x9Dm^\\xF6vq8\\x95\\xD7\\x08\\xA5\\xBF\\x84\\x80\\xF0&!q!f9\\xB5\\xC5]\\xAD=\\xE1\\xC4;~\\x198q="

                      "r\\xADf\\x86rW'\\xA5e\\xF7\\xDF\\x1C\\xDE\\x8COfJ\\x19?\\x9BK\\x19\\xADNc\\xDF\\xB3(\\xF9H\\xD03]8\\x01\\xD7N\\x95\\xF9U\\xBB\\x80\\x915k\\xB8k\\xAA\\xD6\\x9D\\xDB\\xCB\\x9F\\xA6=3\\x00\\xF4m\\x19\\x10\\x9EI\\xDE>9\\x94OT\\xB2\\x9B\\xDE\\xDC\\xA6\\xF3\\xAF\\xBEW\\x85\\xA0\\xD6v\\xF2\\xC0\\x14)vI\\x01\\xB2\\x06\\xD2\\xE3$\\x8C\\xDD\\xC7+\\xDD\\x12\\xBF\\x8D\\xF7\\x99Hq\\xB5\\xAEf@\\x1F~%\\xD7\\x10\\x0E\\x92\\xC2\\xBD\\x0B\\xC94^r\\x8F>O\\x16\\xE6\\xFD\\xDD\\x8F~{\\x03\\x8A\\xC4\\xE2U\\xE1~"

                      "RO\\xEE\\xEEI\\xB4\\xAA\\x02\\xD0u\\x7F\\xDA\\xD2\\xB70\\x1B\\xE6\\xC2\\x85\\x92q\\xB2\\x96SF/F\\x02\\xDE\\xBF\\x05\\x84\\xD3SO\\xB4\\xDD(\\xC3WS\\xEC\\x17\\xF4\\x93\\x11\\xE1q-\\xA1\\xDF\r\\x06\\xD1~\\x9Dct\\x06$\"\\xE2\\xC2V(\\xBC\\xAA\\x1E\\xC5\\xAEL\\xCB<&\\xE3\\xAB36\"\\xC7K\\\\\\x04\\x16\\x0BN\\xB4\\x05\\xB0\\xFBl\\xE4\\x82g_6;\\xE8\\xBC\\xDDAL!\\xC6y\\xD3\\xE2\\xBDl\\xAEL\\xBEk\\x19\\x0C\\xD2g;.\\xA8o\\xB1e\\xFA\\x10Z7\\x0C \\xFF\\x11\\x8A\\xA3o\\xD4\\xAD,\\x06\\x92VR\\x1D\\x84l\\xE9~"

                      "Aa\\x98\\x9F\\x96\\x13\\xE9\\xB4\\xD1\\xA4e\\x84B...

 

 

So if you are skilled in handling this kind of requests I would like to hear from you.

If you know where to find documentation on how to script these issues I would also like to hear from you.

Thank you in advance.

Kind regards

Per Thyssen

 

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.