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 Shawn McKinney <sm...@sbcglobal.net> on 2005/04/27 23:11:02 UTC

Problem running Simple UsernameToken Encrypt Example

Apologize for the "newbie" question here but I'm at a
dead end.  I'm trying to run a simple scenario using
WSS4J and Axis using WSDoAll handlers.  Have
successfully  sent username token via SOAP, now want
to encrypt the token before sending.  Here's what I've
done:

1. Create keystore using Sun Java keytool command:
keytool -genkey -keyalg RSA -keystore xes.keystore
-alias xeskey
What is your first and last name?
  [Unknown]:  Shawn McKinney
What is the name of your organizational unit?
  [Unknown]:  abc
What is the name of your organization?
  [Unknown]:  def
What is the name of your City or Locality?
  [Unknown]:  Xyz
What is the name of your State or Province?
  [Unknown]:  AX
What is the two-letter country code for this unit?
  [Unknown]:  US
Is CN=Shawn McKinney, OU=abc, O=def, L=Xyz, ST=ZX,
C=US correct?
  [no]:  y

Enter key password for <xeskey>
        (RETURN if same as keystore password):

2. Copy keystore to
<TomcatHome>/webapps/axis/WEB-INF/classes 

3. Create crypto.properties file:
org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=changeit
org.apache.ws.security.crypto.merlin.keystore.alias=xeskey
org.apache.ws.security.crypto.merlin.alias.password=changeit
org.apache.ws.security.crypto.merlin.file=xes.keystore


4. Copy crypto.properties file to same place as # 2.

5. Edit client side .wsdl file:

<requestFlow >
 <handler 
 type=
"java:org.apache.ws.axis.security.WSDoAllSender" >
    <parameter name="action" value="UsernameToken
Encrypt"/>
    <parameter name="passwordCallbackClass"
value="samples.message.PWCallback"/>
	  <parameter name="passwordType" value="PasswordText"
/>		 
    <parameter name="encryptionPropFile"
value="crypto.properties" />			
    <parameter name="encryptionKeyIdentifier"
value="X509KeyIdentifier" />
		<parameter name="encryptionUser" value="xeskey" />
    <parameter name="encryptionParts" 
       
value="{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameToken"
/>
  </handler>