You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by Xinjun Chen <xj...@gmail.com> on 2006/09/05 06:17:21 UTC

WSS4J Interoperate with .NET

I am trying to use WSS4J to add UsernameToken and sign some SOAP
headers and SOAP body using that UsernameToken. This is the security
policy defined in an end .NET web service.

In my first test case, I do not want to use Axis or Axis2. I am trying
to do in the following way:

1) read an xml file which contains SOAP Envelope, and construct
SOAPEnvelope from the data read from the xml file.

2) Using WSS4J to sign SOAP headers and SOAP body.

3) Send the signed SOAPEnvelope through HttpClient.

I have some question in step 2). What class should I use? Shall I use
WSSignEnvelope#build(Document, Crypto) method? Do I need to
setUsernameToken(WSSAddUsernameToken)?
Could anyone recommend me how to do that?

The other question is not related to this first test case.
In the second test case, I want to encrypt some SOAP headers and SOAP
body using the UsernameToken. Shall I use
WSEncryptBody#build(Document, Crypto)? There are a few method to set
encryption key like setKey(byte[]) and setEmbeddedKeyName(String),
which one should I use?
Will the DerivedKeyToken been used when encrypting SOAP with UsernameToken?

Thank you in advance for any suggestions and comments.


Regards,

Xinjun

---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Re: WSS4J Interoperate with .NET

Posted by Ruchith Fernando <ru...@gmail.com>.
Hi Xinjun,

On 9/5/06, Xinjun Chen <xj...@gmail.com> wrote:
> I am trying to use WSS4J to add UsernameToken and sign some SOAP
> headers and SOAP body using that UsernameToken. This is the security
> policy defined in an end .NET web service.
>
> In my first test case, I do not want to use Axis or Axis2. I am trying
> to do in the following way:
>
> 1) read an xml file which contains SOAP Envelope, and construct
> SOAPEnvelope from the data read from the xml file.
>
> 2) Using WSS4J to sign SOAP headers and SOAP body.
>
> 3) Send the signed SOAPEnvelope through HttpClient.
>
> I have some question in step 2). What class should I use? Shall I use
> WSSignEnvelope#build(Document, Crypto) method? Do I need to
> setUsernameToken(WSSAddUsernameToken)?
> Could anyone recommend me how to do that?

If you are doing UsernameToken signature you please have a look at :
org.apache.ws.security.action.UsernameTokenSignedAction how the
org.apache.ws.security.message.WSSec* classes are used.

>
> The other question is not related to this first test case.
> In the second test case, I want to encrypt some SOAP headers and SOAP
> body using the UsernameToken. Shall I use
> WSEncryptBody#build(Document, Crypto)? There are a few method to set
> encryption key like setKey(byte[]) and setEmbeddedKeyName(String),
> which one should I use?
> Will the DerivedKeyToken been used when encrypting SOAP with UsernameToken?

Do you want to use a DerivedKeyToken derived from the username token and use it?

If so you can should
  - Add a username token using the WSSecUsernameToken
  - Compute the main ephemeral key using the usernametoken
  - Set the above computed value in WSSecDKEncrypt and call build of
the WSSecDKEncrypt instance.

Thanks,
Ruchith

-- 
www.ruchith.org

---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Re: WSS4J Interoperate with .NET

Posted by Ruchith Fernando <ru...@gmail.com>.
Hi Xinjun,

On 9/5/06, Xinjun Chen <xj...@gmail.com> wrote:
> I am trying to use WSS4J to add UsernameToken and sign some SOAP
> headers and SOAP body using that UsernameToken. This is the security
> policy defined in an end .NET web service.
>
> In my first test case, I do not want to use Axis or Axis2. I am trying
> to do in the following way:
>
> 1) read an xml file which contains SOAP Envelope, and construct
> SOAPEnvelope from the data read from the xml file.
>
> 2) Using WSS4J to sign SOAP headers and SOAP body.
>
> 3) Send the signed SOAPEnvelope through HttpClient.
>
> I have some question in step 2). What class should I use? Shall I use
> WSSignEnvelope#build(Document, Crypto) method? Do I need to
> setUsernameToken(WSSAddUsernameToken)?
> Could anyone recommend me how to do that?

If you are doing UsernameToken signature you please have a look at :
org.apache.ws.security.action.UsernameTokenSignedAction how the
org.apache.ws.security.message.WSSec* classes are used.

>
> The other question is not related to this first test case.
> In the second test case, I want to encrypt some SOAP headers and SOAP
> body using the UsernameToken. Shall I use
> WSEncryptBody#build(Document, Crypto)? There are a few method to set
> encryption key like setKey(byte[]) and setEmbeddedKeyName(String),
> which one should I use?
> Will the DerivedKeyToken been used when encrypting SOAP with UsernameToken?

Do you want to use a DerivedKeyToken derived from the username token and use it?

If so you can should
  - Add a username token using the WSSecUsernameToken
  - Compute the main ephemeral key using the usernametoken
  - Set the above computed value in WSSecDKEncrypt and call build of
the WSSecDKEncrypt instance.

Thanks,
Ruchith

-- 
www.ruchith.org

---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org