all groups > dotnet web services enhancements > november 2004 >
You're in the

dotnet web services enhancements

group:

WS Secure Conversation -UsernameToken Encryption- PLEASE PLEASE HELP ME-Very urgent


WS Secure Conversation -UsernameToken Encryption- PLEASE PLEASE HELP ME-Very urgent sumaira.ahmad NO[at]SPAM gmail.com
11/17/2004 8:59:57 AM
dotnet web services enhancements:
Hi,

Please help me solve this problem.. This is very urgent, i have to
demo it tommorrow and need to fix it before tomorrow..

I am using WS Secure Conversation and am using a USername Token to
sign the request for a initial request from the client to tokenissuer
for securitycontexttoken.
I would like to encrypt the UsernameToken before sending it across.
My code patch is as below:

SecurityToken token = new UsernameToken(t_username.Text,
t_password.Text,
PasswordOption.SendPlainText);

// Create a SecurityContextTokenServiceClient that will get the
SecurityContextToken
string secureConvEndpoint =
ConfigurationSettings.AppSettings["tokenIssuer"];
SecurityContextTokenServiceClient client = new
SecurityContextTokenServiceClient(new Uri( secureConvEndpoint ));

// retrieve server's cert
SecurityToken issuerToken = GetServerTokenForEncryption();

// Sign the security token request.
client.RequestSoapContext.Security.Elements.Add( new EncryptedData(
issuerToken, string.Format("#{0}",token.Id )) );

// Request the token, use the signing token as the Base
SecurityContextToken sct =
client.IssueSecurityContextTokenAuthenticated(token, issuerToken);


But somehow I am not able to access the RequestSoapContext of the
client proxy.
It gives me error:
'Microsoft.Web.Services2.Security.SecurityTokenServiceClient.RequestSoapContext'
is inaccessible due to its protection level

I cannot send the password as hashed because I am authenticating
against ADAM hence password has to go as plain text.

Can someone tell me how I can access the RequestSoapConext of the
proxy so that I can encrypt the usernametoken that is carried in the
SOAP Header to the token issuer.
Please help me.. I have an urgent demonstration to show tommorrow and
need to get it work.

PLEASE PLEASE HELP ME...
Regards,
Re: WS Secure Conversation -UsernameToken Encryption- PLEASE PLEASE HELP ME-Very urgent Martin Kulov
11/19/2004 2:24:30 AM
Hi Sumaira,

I had this problem two months ago when I prepared a presentation also. It seems that WSE is unable to encrypt the UsernameToken in this version. As Hervey pointed out there will be progress in this area in WSE SP2 which we expect to be available very soon. I hope your demo went smooth though.

Best regards,

Martin Kulov
www.codeattest.com
Re: WS Secure Conversation -UsernameToken Encryption- PLEASE PLEASE HELP ME-Very urgent sumaira.ahmad NO[at]SPAM gmail.com
11/19/2004 10:30:09 AM
Martin,

Thanks for replying. So how did u plan to go about sending the
password or UsernameToken in encrypted/hashed form??? Did u find a
solution to it.or did u have a workaround??
Please let me know.. I haven't been able to figure out what to do..I
would really appreciate your reply..
Thanks,
Sumaira

[quoted text, click to view]
Re: WS Secure Conversation -UsernameToken Encryption- PLEASE PLEASE HELP ME-Very urgent Martin Kulov
11/19/2004 5:26:04 PM
Hi Sumaira,

Well I have not found a solution yet. I just gave my presentation and said them 'it is really nice to use UsernameToken, but for now, as you see, it requires SSL for the initiating the conversation. Go now and start using it and by the time you are prepared there will be solution for encrypting the token.' :).
That's it.

HTH,
Martin Kulov
www.codeattest.com

Re: WS Secure Conversation -UsernameToken Encryption- PLEASE PLEASE HELP ME-Very urgent Softwaremaker
11/21/2004 8:22:36 AM
1) You can send the password in hash or encrypted form via the
passwordoption enum

2) You can also send the usernametoken in encrypted form as well.
http://www.softwaremaker.net/blog/PermaLink,guid,43d85031-3e0b-48a7-bdd7-1f49932db40a.aspx

hth.
--
Thank you.

Regards,
Softwaremaker

==================================


[quoted text, click to view]
It seems that WSE is unable to encrypt the UsernameToken in this version. As
Hervey pointed out there will be progress in this area in WSE SP2 which we
expect to be available very soon. I hope your demo went smooth though.
[quoted text, click to view]

Re: WS Secure Conversation -UsernameToken Encryption- PLEASE PLEASE HELP ME-Very urgent Martin Kulov
11/21/2004 9:10:21 AM
[quoted text, click to view]

What is this enum value?


Martin Kulov
www.codeattest.com
Re: WS Secure Conversation -UsernameToken Encryption- PLEASE PLEASE HELP ME-Very urgent Henning Krause [MVP]
11/21/2004 11:12:44 AM
Hello,

[quoted text, click to view]
http://www.softwaremaker.net/blog/PermaLink,guid,43d85031-3e0b-48a7-bdd7-1f49932db40a.aspx

The problem with this approach is that the server must have a certificate.

While the certificate itself is not a problem for me, the circumstance that
the client program must know the public key of that certificate is certainly
one.

And hardcoding the public key into the client is not an option for me.

What I would like to do is the following:

1. Client requests the server public key from a special webservice on the
server.
2. Client encrypts the Usernametoken with the servers public key and signs
it with its own private key.
3. The Server creates a security token and encrypts it with the clients
public key.
4. The client uses this security token to call the webservice.

After step 2, both actors have exchanged each public keys, thus they can
protect the entire comunication. I would create the key-pairs on each
application start.

Ideally this would be implemented with WS-SecureConversation.

A propos WS-SecureConversation. Does WSE implement some sort of
sequence-numbering in WS-SC? I only saw a relative short ticket-lifetime as
replay detection, whereas the WS-SC specification mentions sequence
numbering.

So, is that even possible and what must I do to asymetrically encrypt the
SecurityContextToken with my own public/private keypair?

Greetings,
Henning Krause [MVP]

[quoted text, click to view]

Re: WS Secure Conversation -UsernameToken Encryption- PLEASE PLEASE HELP ME-Very urgent Henning Krause [MVP]
11/21/2004 8:32:32 PM
Hello,

this enumeration allows you to specify how the password is sent over the
wire: Either in cleartext or a hashed version or not sent at all.

If you are using the first option (Unencrypted) you shuld secure the
password otherwise, i.e. with SSL/TLS or an X.509 certificate.

Greetings,
Henning Krause [MVP]
==========================
Visit my website: http://www.infinitec.de
Try my free Exchange Explorer: Mistaya
(http://www.infinitec.de/?page=products)


[quoted text, click to view]

Re: WS Secure Conversation -UsernameToken Encryption- PLEASE PLEASE HELP ME-Very urgent Martin Kulov
11/21/2004 11:47:23 PM
Hi Henning,

I am aware that there is enumeration for setting password in clear text or hashed value. I did not understand what is its value for sending it in encrypted form.

[quoted text, click to view]
1) You can send the password in hash or encrypted form via the passwordoption enum

So what is the value of the enum for sending the password in encrypted form.

Thanks,
Martin Kulov
www.codeattest.com
Re: WS Secure Conversation -UsernameToken Encryption- PLEASE PLEASE HELP ME-Very urgent Henning Krause [MVP]
11/22/2004 10:44:31 AM
Hello,

you can't. That enumeration has the three values I outlined before: None,
Hashed, Plaintext.

If you want to encrypt it, you must encrypt the usertoken with an X.509
Certificate or similar.

Greetings,
Henning Krause [MVP]
==========================
Visit my website: http://www.infinitec.de
Try my free Exchange Explorer: Mistaya
(http://www.infinitec.de/?page=products)


[quoted text, click to view]
hashed value. I did not understand what is its value for sending it in
encrypted form.
[quoted text, click to view]

Re: WS Secure Conversation -UsernameToken Encryption- PLEASE PLEASE HELP ME-Very urgent sumaira.ahmad NO[at]SPAM gmail.com
11/22/2004 7:07:57 PM
The problem with WS secure conversation is this:

When u want to send the password as PlainText( because u are
authenticating against Active Directory or SQL that requires plainText
Password option), there is no way of encrypting the Username token.

In Normal scenario if you want to send the password in Plain Text, you
encrypt the username token as follows:

EncryptedData encrypted = new EncryptedData(encrToken,
usernameToken.Id)
proxy.RequestSoapContext.Elements.Add(encrypted)

But in Secure Conversation there is a bug( according to me).

See code below

// Create a SecurityContextTokenServiceClient that will get the
SecurityContextToken
string secureConvEndpoint =
ConfigurationSettings.AppSettings["tokenIssuer"];
SecurityContextTokenServiceClient client = new
SecurityContextTokenServiceClient(new Uri( secureConvEndpoint ));

Now ideally you should be able to do this:

client.RequestSoapContext.Security.Elements.Add( new EncryptedData(
issuerToken, string.Format("#{0}",usernameToken.Id )) );

But when I do this, it says:
that the RequestSoapContext of client is a protected member and hence
cannot be accessed.

Now the next option would be to encrypt ONLY the password using X.509
certs or whatever and add it to the UsernameToken. and send the
UsernameToken as it is.Then on the server it should decrypt it..
Is that possible???I haven't tried it yet.. Can u suggest a workaround
( other not SSL)..
Please let me know..I have spent God knows how many days trying to
find a solution to it..

Thanks,
Sumaira


[quoted text, click to view]
Re: WS Secure Conversation -UsernameToken Encryption- PLEASE PLEASE HELP ME-Very urgent sumaira.ahmad NO[at]SPAM gmail.com
11/22/2004 7:30:17 PM
All examples on WSE Secure Conversation, wherein we have to use a
token issuer shows u can access the RequestSoapContext for a
SecuritTokenServiceClient Proxy, but as per

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wseref/html/P_Microsoft_Web_Services2_Security_SecurityTokenServiceClient_RequestSoapContext.asp

it is a protected member?? Sorry if this is a foolish question , but
is there anyway of changing its property to public from protected??

Thanks,
Sumaira

[quoted text, click to view]
Re: WS Secure Conversation -UsernameToken Encryption- PLEASE PLEASE HELP ME-Very urgent Softwaremaker
11/23/2004 6:16:21 PM
Sorry, my mistake. I meant hash, plain text or no-show password. I wonder
how the word encrypted got in there....hmmm...

Thanks.
=================================================

[quoted text, click to view]

AddThis Social Bookmark Button