You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wss4j-dev@ws.apache.org by Shital Joshi <sj...@gmail.com> on 2005/08/18 23:02:29 UTC

wss4j UserToken Encrypt not working

I am running my service using tomcat axis. My client and service are runing 
on the same machine. 
I used following command to generate the key.

C:\axis-1_2_1\samples\userguide\example3>keytool -genkey -alias test 
-keystore test.keystore

and my crypto.properties file looks like this:

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=security
org.apache.ws.security.crypto.merlin.keystore.alias=test
org.apache.ws.security.crypto.merlin.alias.password=security
org.apache.ws.security.crypto.merlin.file=test.keystore

I have the same test.keystore and crypto.properties in $TOMCAT_HOME/bin 
folder and $TOMCAT_HOME/webapss/axis/WEB-INF/classes folder. 

My client_deploy.wsdd file looks like this:

<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="
http://xml.apache.org/axis/wsdd/providers/java">
<transport name="http" pivot="java:org.apache.axis.transport.http.HTTPSender
"/>
<globalConfiguration >

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

</handler>
</requestFlow> 

</globalConfiguration >
</deployment>


When I try to run my client like this:

java -Daxis.ClientConfigFile=client_deploy.wsdd com.MyServiceClient IB

It gives me following error:

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.IllegalArgumentException: not an RSA key!
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.lang.IllegalArgumentExcepti
on: not an RSA key!

I think I am quite close. Any help is appreciated.

Thanks







-- 
Progress isn't made by early risers. It's made by lazy men trying to find 
easier ways to do something.

Re: wss4j UserToken Encrypt not working

Posted by Shital Joshi <sj...@gmail.com>.
Thanks Ruchith. That works. 

But I am facing another problem. Part of my client_deploy.wsdd file looks 
like this:

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

What should be value of parameter encryptionUser? I used the alias name from 
the keystore. Now I am getting this exception:

faultCode: {
http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString: WSDoAllReceiver: security processing failed; nested exception 
is:
org.apache.ws.security.WSSecurityException: General security error (WSSe
curityEngine: Callback supplied no password for: shital)
faultActor:
faultNode:
faultDetail: {http://xml.apache.org/axis/}hostname:W2KDNYCRSUCOFF


My PWCallBack class doesn't have password for encryptionUser, it has 
password for user. I thought it is supposed to get password for 
encryptionUser from keystore. Do I have to specify password for encryption 
user in PWCallBack class?

Thanks.


On 8/18/05, Ruchith Fernando <ru...@gmail.com> wrote:
> 
> Hi,
> 
> Try :
> 
> keytool -genkey -alias test -keystore test.keystore -keyalg RSA
> 
> You cna specify the key algo with the -keyalg option
> 
> - Ruchith
> 
> On 8/19/05, Shital Joshi <sj...@gmail.com> wrote:
> > I am running my service using tomcat axis. My client and service are 
> runing
> > on the same machine.
> > I used following command to generate the key.
> >
> > C:\axis-1_2_1\samples\userguide\example3>keytool -genkey
> > -alias test -keystore test.keystore
> >
> > and my crypto.properties file looks like this:
> >
> > 
> 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=security
> > org.apache.ws.security.crypto.merlin.keystore.alias=test
> > org.apache.ws.security.crypto.merlin.alias.password=security
> > org.apache.ws.security.crypto.merlin.file=test.keystore
> >
> > I have the same test.keystore and crypto.properties in $TOMCAT_HOME/bin
> > folder and $TOMCAT_HOME/webapss/axis/WEB-INF/classes
> > folder.
> >
> > My client_deploy.wsdd file looks like this:
> >
> > <deployment xmlns="http://xml.apache.org/axis/wsdd/"
> > xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
> > >
> > <transport name="http"
> > pivot="java:org.apache.axis.transport.http.HTTPSender"/>
> > <globalConfiguration >
> >
> > <requestFlow>
> > <handler
> > type="java:org.apache.ws.axis.security.WSDoAllSender" >
> > <parameter name="action" value="UsernameToken Encrypt"/>
> > <parameter name="user" value="wss4j"/>
> > <parameter name="passwordCallbackClass" value="com.PWCallback"/>
> > <parameter name="passwordType" value="PasswordText" />
> > <parameter name="addUTElement" value="Nonce Created" />
> > <parameter name="encryptionPropFile" value="crypto.properties" />
> > <parameter name="encryptionKeyIdentifier" value="X509KeyIdentifier"
> > />
> > <parameter name="encryptionUser" value="test" />
> > <parameter name="encryptionParts"
> >
> > value="{Element}{
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameToken"
> > />
> > </handler>
> > </requestFlow>
> >
> > </globalConfiguration >
> > </deployment>
> >
> >
> > When I try to run my client like this:
> >
> > java -Daxis.ClientConfigFile=client_deploy.wsdd
> > com.MyServiceClient IB
> >
> > It gives me following error:
> >
> > AxisFault
> > faultCode:
> > {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
> > faultSubcode:
> > faultString: java.lang.IllegalArgumentException: not an
> > RSA key!
> > faultActor:
> > faultNode:
> > faultDetail:
> >
> > {http://xml.apache.org/axis/}stackTrace:java.lang.IllegalArgumentExcepti
> > on: not an RSA key!
> >
> > I think I am quite close. Any help is appreciated.
> >
> > Thanks
> >
> >
> >
> >
> >
> >
> >
> > --
> > Progress isn't made by early risers. It's made by lazy men trying to 
> find
> > easier ways to do something.
> >
> 



-- 
Progress isn't made by early risers. It's made by lazy men trying to find 
easier ways to do something.

Re: wss4j UserToken Encrypt not working

Posted by Shital Joshi <sj...@gmail.com>.
Thanks Ruchith. That works. 

But I am facing another problem. Part of my client_deploy.wsdd file looks 
like this:

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

What should be value of parameter encryptionUser? I used the alias name from 
the keystore. Now I am getting this exception:

faultCode: {
http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString: WSDoAllReceiver: security processing failed; nested exception 
is:
org.apache.ws.security.WSSecurityException: General security error (WSSe
curityEngine: Callback supplied no password for: shital)
faultActor:
faultNode:
faultDetail: {http://xml.apache.org/axis/}hostname:W2KDNYCRSUCOFF


My PWCallBack class doesn't have password for encryptionUser, it has 
password for user. I thought it is supposed to get password for 
encryptionUser from keystore. Do I have to specify password for encryption 
user in PWCallBack class?

Thanks.


On 8/18/05, Ruchith Fernando <ru...@gmail.com> wrote:
> 
> Hi,
> 
> Try :
> 
> keytool -genkey -alias test -keystore test.keystore -keyalg RSA
> 
> You cna specify the key algo with the -keyalg option
> 
> - Ruchith
> 
> On 8/19/05, Shital Joshi <sj...@gmail.com> wrote:
> > I am running my service using tomcat axis. My client and service are 
> runing
> > on the same machine.
> > I used following command to generate the key.
> >
> > C:\axis-1_2_1\samples\userguide\example3>keytool -genkey
> > -alias test -keystore test.keystore
> >
> > and my crypto.properties file looks like this:
> >
> > 
> 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=security
> > org.apache.ws.security.crypto.merlin.keystore.alias=test
> > org.apache.ws.security.crypto.merlin.alias.password=security
> > org.apache.ws.security.crypto.merlin.file=test.keystore
> >
> > I have the same test.keystore and crypto.properties in $TOMCAT_HOME/bin
> > folder and $TOMCAT_HOME/webapss/axis/WEB-INF/classes
> > folder.
> >
> > My client_deploy.wsdd file looks like this:
> >
> > <deployment xmlns="http://xml.apache.org/axis/wsdd/"
> > xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
> > >
> > <transport name="http"
> > pivot="java:org.apache.axis.transport.http.HTTPSender"/>
> > <globalConfiguration >
> >
> > <requestFlow>
> > <handler
> > type="java:org.apache.ws.axis.security.WSDoAllSender" >
> > <parameter name="action" value="UsernameToken Encrypt"/>
> > <parameter name="user" value="wss4j"/>
> > <parameter name="passwordCallbackClass" value="com.PWCallback"/>
> > <parameter name="passwordType" value="PasswordText" />
> > <parameter name="addUTElement" value="Nonce Created" />
> > <parameter name="encryptionPropFile" value="crypto.properties" />
> > <parameter name="encryptionKeyIdentifier" value="X509KeyIdentifier"
> > />
> > <parameter name="encryptionUser" value="test" />
> > <parameter name="encryptionParts"
> >
> > value="{Element}{
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameToken"
> > />
> > </handler>
> > </requestFlow>
> >
> > </globalConfiguration >
> > </deployment>
> >
> >
> > When I try to run my client like this:
> >
> > java -Daxis.ClientConfigFile=client_deploy.wsdd
> > com.MyServiceClient IB
> >
> > It gives me following error:
> >
> > AxisFault
> > faultCode:
> > {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
> > faultSubcode:
> > faultString: java.lang.IllegalArgumentException: not an
> > RSA key!
> > faultActor:
> > faultNode:
> > faultDetail:
> >
> > {http://xml.apache.org/axis/}stackTrace:java.lang.IllegalArgumentExcepti
> > on: not an RSA key!
> >
> > I think I am quite close. Any help is appreciated.
> >
> > Thanks
> >
> >
> >
> >
> >
> >
> >
> > --
> > Progress isn't made by early risers. It's made by lazy men trying to 
> find
> > easier ways to do something.
> >
> 



-- 
Progress isn't made by early risers. It's made by lazy men trying to find 
easier ways to do something.

Re: wss4j UserToken Encrypt not working

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

Try :

keytool -genkey -alias test -keystore test.keystore -keyalg RSA

You cna specify the key algo with the -keyalg option

- Ruchith

On 8/19/05, Shital Joshi <sj...@gmail.com> wrote:
> I am running my service using tomcat axis. My client and service are runing
> on the same machine. 
>  I used following command to generate the key.
>  
>  C:\axis-1_2_1\samples\userguide\example3>keytool -genkey
> -alias test -keystore test.keystore
>  
>  and my crypto.properties file looks like this:
>  
> 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=security
>  org.apache.ws.security.crypto.merlin.keystore.alias=test
> org.apache.ws.security.crypto.merlin.alias.password=security
>  org.apache.ws.security.crypto.merlin.file=test.keystore
>  
>  I have the same test.keystore and crypto.properties in $TOMCAT_HOME/bin
> folder and $TOMCAT_HOME/webapss/axis/WEB-INF/classes
> folder. 
>  
>  My client_deploy.wsdd file looks like this:
>  
>  <deployment xmlns="http://xml.apache.org/axis/wsdd/"
> xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
> >
>   <transport name="http"
> pivot="java:org.apache.axis.transport.http.HTTPSender"/>
>    <globalConfiguration >
>     
>      <requestFlow>
>        <handler
> type="java:org.apache.ws.axis.security.WSDoAllSender" >
>         <parameter name="action" value="UsernameToken Encrypt"/>
>         <parameter name="user" value="wss4j"/>
>         <parameter name="passwordCallbackClass" value="com.PWCallback"/>
>         <parameter name="passwordType" value="PasswordText" />
>         <parameter name="addUTElement" value="Nonce Created" />
>         <parameter name="encryptionPropFile" value="crypto.properties" />
>         <parameter name="encryptionKeyIdentifier" value="X509KeyIdentifier"
> />
>         <parameter name="encryptionUser" value="test" />
>         <parameter name="encryptionParts" 
>          
> value="{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameToken"
> />  
>        </handler>
>    </requestFlow>  
>       
>    </globalConfiguration >
>  </deployment>
>  
>  
>  When I try to run my client like this:
>  
>  java -Daxis.ClientConfigFile=client_deploy.wsdd
> com.MyServiceClient IB
>  
>  It gives me following error:
>  
>  AxisFault
>   faultCode:
> {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
>   faultSubcode:
>   faultString: java.lang.IllegalArgumentException: not an
> RSA key!
>   faultActor:
>   faultNode:
>   faultDetail:
>         
> {http://xml.apache.org/axis/}stackTrace:java.lang.IllegalArgumentExcepti
>  on: not an RSA key!
>  
>  I think I am quite close. Any help is appreciated.
>  
>  Thanks
>  
>  
>  
>  
>  
>  
> 
> -- 
> Progress isn't made by early risers. It's made by lazy men trying to find
> easier ways to do something.
>

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


Re: wss4j UserToken Encrypt not working

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

Try :

keytool -genkey -alias test -keystore test.keystore -keyalg RSA

You cna specify the key algo with the -keyalg option

- Ruchith

On 8/19/05, Shital Joshi <sj...@gmail.com> wrote:
> I am running my service using tomcat axis. My client and service are runing
> on the same machine. 
>  I used following command to generate the key.
>  
>  C:\axis-1_2_1\samples\userguide\example3>keytool -genkey
> -alias test -keystore test.keystore
>  
>  and my crypto.properties file looks like this:
>  
> 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=security
>  org.apache.ws.security.crypto.merlin.keystore.alias=test
> org.apache.ws.security.crypto.merlin.alias.password=security
>  org.apache.ws.security.crypto.merlin.file=test.keystore
>  
>  I have the same test.keystore and crypto.properties in $TOMCAT_HOME/bin
> folder and $TOMCAT_HOME/webapss/axis/WEB-INF/classes
> folder. 
>  
>  My client_deploy.wsdd file looks like this:
>  
>  <deployment xmlns="http://xml.apache.org/axis/wsdd/"
> xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
> >
>   <transport name="http"
> pivot="java:org.apache.axis.transport.http.HTTPSender"/>
>    <globalConfiguration >
>     
>      <requestFlow>
>        <handler
> type="java:org.apache.ws.axis.security.WSDoAllSender" >
>         <parameter name="action" value="UsernameToken Encrypt"/>
>         <parameter name="user" value="wss4j"/>
>         <parameter name="passwordCallbackClass" value="com.PWCallback"/>
>         <parameter name="passwordType" value="PasswordText" />
>         <parameter name="addUTElement" value="Nonce Created" />
>         <parameter name="encryptionPropFile" value="crypto.properties" />
>         <parameter name="encryptionKeyIdentifier" value="X509KeyIdentifier"
> />
>         <parameter name="encryptionUser" value="test" />
>         <parameter name="encryptionParts" 
>          
> value="{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameToken"
> />  
>        </handler>
>    </requestFlow>  
>       
>    </globalConfiguration >
>  </deployment>
>  
>  
>  When I try to run my client like this:
>  
>  java -Daxis.ClientConfigFile=client_deploy.wsdd
> com.MyServiceClient IB
>  
>  It gives me following error:
>  
>  AxisFault
>   faultCode:
> {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
>   faultSubcode:
>   faultString: java.lang.IllegalArgumentException: not an
> RSA key!
>   faultActor:
>   faultNode:
>   faultDetail:
>         
> {http://xml.apache.org/axis/}stackTrace:java.lang.IllegalArgumentExcepti
>  on: not an RSA key!
>  
>  I think I am quite close. Any help is appreciated.
>  
>  Thanks
>  
>  
>  
>  
>  
>  
> 
> -- 
> Progress isn't made by early risers. It's made by lazy men trying to find
> easier ways to do something.
>

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