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 Dave Bagguley <da...@hotmail.com> on 2006/11/09 17:56:26 UTC

How Do I Use a Custom Crypto Provider?

Hello,

I want to set the contents of crypto.properties dynamically, I believe to do 
this I need to subclass Merlin and then reference this new class in the 
crypto.properties file.

So far I have a subclass of Merlin and have referenced it in my 
crypto.properties file.  What I don't understand is where I set my 
properties.

Where do I define the properties that get passed to the new subclass of 
Merlin?  The call to the new subclass seems to be done automatically so I 
don't know how to customise the properties it recieves.

Please can someone give me some help of how to use a subclass of merlin to 
dynamically set the crypto properties.

Thanks

_________________________________________________________________
The new Windows Live Toolbar helps you guard against viruses 
http://toolbar.live.com/?mkt=en-gb


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


RE: How Do I Use a Custom Crypto Provider?

Posted by Dave Bagguley <da...@hotmail.com>.
I'm not at my development computer at the moment so haven't got access to 
the code.  The MyMerlin class is just a class that extends 
org.apache.ws.security.components.crypto.Merlin and only contains the two 
methods that were contained in my previous post (you'll obviously need to 
ensure you add the correct imports and you need to make the MyMerlin 
constructor throw a CredentialException and an IOException) but that's all 
there is to it.

As for the SecurityProperties class this is just a simple singleton.  It 
must be called before the call to the service is made and you need to set 
the properties in it that you would normally have put in the 
crypto.properties file.  This means that MyMerlin's addExtraProps method can 
get access to the properties that you want to use.

You will also need to change you crypto.properties file so that it only 
contains the following line:
org.apache.ws.security.crypto.provider=com.mycode.MyMerlin
(assuming you have put MyMerlin in the com.mycode package)

That's all that there is to it.

>From: "Shyam Shukla " <sh...@persistent.co.in>
>To: "'Dave Bagguley'" <da...@hotmail.com>, <ws...@ws.apache.org>
>Subject: RE: How Do I Use a Custom Crypto Provider?
>Date: Fri, 10 Nov 2006 18:18:12 +0530
>
>Hi Dave,
>
>Could you please send me the complete code of your MyMerlin and
>SecurityProperties singleton class as I am also working on the similar
>problem that you have solved?
>
>
>
>Best Regards,
>Shyam Shukla
>-----Original Message-----
>From: Dave Bagguley [mailto:davebagguley@hotmail.com]
>Sent: Friday, November 10, 2006 6:08 PM
>To: wss4j-dev@ws.apache.org
>Subject: RE: How Do I Use a Custom Crypto Provider?
>
>Hello, I have found a sort of way of doing this.  I have created a 
>singleton
>
>class called SecurityProperties where I set the properties I want to put in
>crypto.properties. In my custom Merlin class, MyMerlin I do the following
>
>public MyMerlin(Properties props,ClassLoader cl)
>{
>      super(addExtraProps(props),cl);
>}
>
>private Properties addExtraProps(Properties props)
>{
>      props.put("org.apache.ws.security.crypto.merlin.file",
>SecurityProperties.getInstance().getProperty("keystoreLocation"));
>}
>
>This works fine for what I wanted to do.
>
>Cheers.
>
> >From: "Dave Bagguley" <da...@hotmail.com>
> >To: wss4j-dev@ws.apache.org
> >Subject: How Do I Use a Custom Crypto Provider?
> >Date: Thu, 09 Nov 2006 16:56:26 +0000
> >
> >Hello,
> >
> >I want to set the contents of crypto.properties dynamically, I believe to
> >do this I need to subclass Merlin and then reference this new class in 
>the
> >crypto.properties file.
> >
> >So far I have a subclass of Merlin and have referenced it in my
> >crypto.properties file.  What I don't understand is where I set my
> >properties.
> >
> >Where do I define the properties that get passed to the new subclass of
> >Merlin?  The call to the new subclass seems to be done automatically so I
> >don't know how to customise the properties it recieves.
> >
> >Please can someone give me some help of how to use a subclass of merlin 
>to
> >dynamically set the crypto properties.
> >
> >Thanks
> >
> >_________________________________________________________________
> >The new Windows Live Toolbar helps you guard against viruses
> >http://toolbar.live.com/?mkt=en-gb
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
> >For additional commands, e-mail: wss4j-dev-help@ws.apache.org
> >
>
>_________________________________________________________________
>Be the first to hear what's new at MSN - sign up to our free newsletters!
>http://www.msn.co.uk/newsletters
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>
>
>DISCLAIMER
>==========
>This e-mail may contain privileged and confidential information which is 
>the property of Persistent Systems Pvt. Ltd. It is intended only for the 
>use of the individual or entity to which it is addressed. If you are not 
>the intended recipient, you are not authorized to read, retain, copy, 
>print, distribute or use this message. If you have received this 
>communication in error, please notify the sender and delete all copies of 
>this message. Persistent Systems Pvt. Ltd. does not accept any liability 
>for virus infected mails.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>

_________________________________________________________________
Download the new Windows Live Toolbar, including Desktop search! 
http://toolbar.live.com/?mkt=en-gb


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


RE: How Do I Use a Custom Crypto Provider?

Posted by Dave Bagguley <da...@hotmail.com>.
I'm not at my development computer at the moment so haven't got access to 
the code.  The MyMerlin class is just a class that extends 
org.apache.ws.security.components.crypto.Merlin and only contains the two 
methods that were contained in my previous post (you'll obviously need to 
ensure you add the correct imports and you need to make the MyMerlin 
constructor throw a CredentialException and an IOException) but that's all 
there is to it.

As for the SecurityProperties class this is just a simple singleton.  It 
must be called before the call to the service is made and you need to set 
the properties in it that you would normally have put in the 
crypto.properties file.  This means that MyMerlin's addExtraProps method can 
get access to the properties that you want to use.

You will also need to change you crypto.properties file so that it only 
contains the following line:
org.apache.ws.security.crypto.provider=com.mycode.MyMerlin
(assuming you have put MyMerlin in the com.mycode package)

That's all that there is to it.

>From: "Shyam Shukla " <sh...@persistent.co.in>
>To: "'Dave Bagguley'" <da...@hotmail.com>, <ws...@ws.apache.org>
>Subject: RE: How Do I Use a Custom Crypto Provider?
>Date: Fri, 10 Nov 2006 18:18:12 +0530
>
>Hi Dave,
>
>Could you please send me the complete code of your MyMerlin and
>SecurityProperties singleton class as I am also working on the similar
>problem that you have solved?
>
>
>
>Best Regards,
>Shyam Shukla
>-----Original Message-----
>From: Dave Bagguley [mailto:davebagguley@hotmail.com]
>Sent: Friday, November 10, 2006 6:08 PM
>To: wss4j-dev@ws.apache.org
>Subject: RE: How Do I Use a Custom Crypto Provider?
>
>Hello, I have found a sort of way of doing this.  I have created a 
>singleton
>
>class called SecurityProperties where I set the properties I want to put in
>crypto.properties. In my custom Merlin class, MyMerlin I do the following
>
>public MyMerlin(Properties props,ClassLoader cl)
>{
>      super(addExtraProps(props),cl);
>}
>
>private Properties addExtraProps(Properties props)
>{
>      props.put("org.apache.ws.security.crypto.merlin.file",
>SecurityProperties.getInstance().getProperty("keystoreLocation"));
>}
>
>This works fine for what I wanted to do.
>
>Cheers.
>
> >From: "Dave Bagguley" <da...@hotmail.com>
> >To: wss4j-dev@ws.apache.org
> >Subject: How Do I Use a Custom Crypto Provider?
> >Date: Thu, 09 Nov 2006 16:56:26 +0000
> >
> >Hello,
> >
> >I want to set the contents of crypto.properties dynamically, I believe to
> >do this I need to subclass Merlin and then reference this new class in 
>the
> >crypto.properties file.
> >
> >So far I have a subclass of Merlin and have referenced it in my
> >crypto.properties file.  What I don't understand is where I set my
> >properties.
> >
> >Where do I define the properties that get passed to the new subclass of
> >Merlin?  The call to the new subclass seems to be done automatically so I
> >don't know how to customise the properties it recieves.
> >
> >Please can someone give me some help of how to use a subclass of merlin 
>to
> >dynamically set the crypto properties.
> >
> >Thanks
> >
> >_________________________________________________________________
> >The new Windows Live Toolbar helps you guard against viruses
> >http://toolbar.live.com/?mkt=en-gb
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
> >For additional commands, e-mail: wss4j-dev-help@ws.apache.org
> >
>
>_________________________________________________________________
>Be the first to hear what's new at MSN - sign up to our free newsletters!
>http://www.msn.co.uk/newsletters
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>
>
>DISCLAIMER
>==========
>This e-mail may contain privileged and confidential information which is 
>the property of Persistent Systems Pvt. Ltd. It is intended only for the 
>use of the individual or entity to which it is addressed. If you are not 
>the intended recipient, you are not authorized to read, retain, copy, 
>print, distribute or use this message. If you have received this 
>communication in error, please notify the sender and delete all copies of 
>this message. Persistent Systems Pvt. Ltd. does not accept any liability 
>for virus infected mails.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>

_________________________________________________________________
Download the new Windows Live Toolbar, including Desktop search! 
http://toolbar.live.com/?mkt=en-gb


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


RE: How Do I Use a Custom Crypto Provider?

Posted by Shyam Shukla <sh...@persistent.co.in>.
Hi Dave,

Could you please send me the complete code of your MyMerlin and
SecurityProperties singleton class as I am also working on the similar
problem that you have solved?



Best Regards,
Shyam Shukla
-----Original Message-----
From: Dave Bagguley [mailto:davebagguley@hotmail.com] 
Sent: Friday, November 10, 2006 6:08 PM
To: wss4j-dev@ws.apache.org
Subject: RE: How Do I Use a Custom Crypto Provider?

Hello, I have found a sort of way of doing this.  I have created a singleton

class called SecurityProperties where I set the properties I want to put in 
crypto.properties. In my custom Merlin class, MyMerlin I do the following

public MyMerlin(Properties props,ClassLoader cl)
{
     super(addExtraProps(props),cl);
}

private Properties addExtraProps(Properties props)
{
     props.put("org.apache.ws.security.crypto.merlin.file", 
SecurityProperties.getInstance().getProperty("keystoreLocation"));
}

This works fine for what I wanted to do.

Cheers.

>From: "Dave Bagguley" <da...@hotmail.com>
>To: wss4j-dev@ws.apache.org
>Subject: How Do I Use a Custom Crypto Provider?
>Date: Thu, 09 Nov 2006 16:56:26 +0000
>
>Hello,
>
>I want to set the contents of crypto.properties dynamically, I believe to 
>do this I need to subclass Merlin and then reference this new class in the 
>crypto.properties file.
>
>So far I have a subclass of Merlin and have referenced it in my 
>crypto.properties file.  What I don't understand is where I set my 
>properties.
>
>Where do I define the properties that get passed to the new subclass of 
>Merlin?  The call to the new subclass seems to be done automatically so I 
>don't know how to customise the properties it recieves.
>
>Please can someone give me some help of how to use a subclass of merlin to 
>dynamically set the crypto properties.
>
>Thanks
>
>_________________________________________________________________
>The new Windows Live Toolbar helps you guard against viruses 
>http://toolbar.live.com/?mkt=en-gb
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>

_________________________________________________________________
Be the first to hear what's new at MSN - sign up to our free newsletters! 
http://www.msn.co.uk/newsletters


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


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

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


RE: How Do I Use a Custom Crypto Provider?

Posted by Shyam Shukla <sh...@persistent.co.in>.
Hi Dave,

Could you please send me the complete code of your MyMerlin and
SecurityProperties singleton class as I am also working on the similar
problem that you have solved?



Best Regards,
Shyam Shukla
-----Original Message-----
From: Dave Bagguley [mailto:davebagguley@hotmail.com] 
Sent: Friday, November 10, 2006 6:08 PM
To: wss4j-dev@ws.apache.org
Subject: RE: How Do I Use a Custom Crypto Provider?

Hello, I have found a sort of way of doing this.  I have created a singleton

class called SecurityProperties where I set the properties I want to put in 
crypto.properties. In my custom Merlin class, MyMerlin I do the following

public MyMerlin(Properties props,ClassLoader cl)
{
     super(addExtraProps(props),cl);
}

private Properties addExtraProps(Properties props)
{
     props.put("org.apache.ws.security.crypto.merlin.file", 
SecurityProperties.getInstance().getProperty("keystoreLocation"));
}

This works fine for what I wanted to do.

Cheers.

>From: "Dave Bagguley" <da...@hotmail.com>
>To: wss4j-dev@ws.apache.org
>Subject: How Do I Use a Custom Crypto Provider?
>Date: Thu, 09 Nov 2006 16:56:26 +0000
>
>Hello,
>
>I want to set the contents of crypto.properties dynamically, I believe to 
>do this I need to subclass Merlin and then reference this new class in the 
>crypto.properties file.
>
>So far I have a subclass of Merlin and have referenced it in my 
>crypto.properties file.  What I don't understand is where I set my 
>properties.
>
>Where do I define the properties that get passed to the new subclass of 
>Merlin?  The call to the new subclass seems to be done automatically so I 
>don't know how to customise the properties it recieves.
>
>Please can someone give me some help of how to use a subclass of merlin to 
>dynamically set the crypto properties.
>
>Thanks
>
>_________________________________________________________________
>The new Windows Live Toolbar helps you guard against viruses 
>http://toolbar.live.com/?mkt=en-gb
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>

_________________________________________________________________
Be the first to hear what's new at MSN - sign up to our free newsletters! 
http://www.msn.co.uk/newsletters


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


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

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


RE: How Do I Use a Custom Crypto Provider?

Posted by Dave Bagguley <da...@hotmail.com>.
Hello, I have found a sort of way of doing this.  I have created a singleton 
class called SecurityProperties where I set the properties I want to put in 
crypto.properties. In my custom Merlin class, MyMerlin I do the following

public MyMerlin(Properties props,ClassLoader cl)
{
     super(addExtraProps(props),cl);
}

private Properties addExtraProps(Properties props)
{
     props.put("org.apache.ws.security.crypto.merlin.file", 
SecurityProperties.getInstance().getProperty("keystoreLocation"));
}

This works fine for what I wanted to do.

Cheers.

>From: "Dave Bagguley" <da...@hotmail.com>
>To: wss4j-dev@ws.apache.org
>Subject: How Do I Use a Custom Crypto Provider?
>Date: Thu, 09 Nov 2006 16:56:26 +0000
>
>Hello,
>
>I want to set the contents of crypto.properties dynamically, I believe to 
>do this I need to subclass Merlin and then reference this new class in the 
>crypto.properties file.
>
>So far I have a subclass of Merlin and have referenced it in my 
>crypto.properties file.  What I don't understand is where I set my 
>properties.
>
>Where do I define the properties that get passed to the new subclass of 
>Merlin?  The call to the new subclass seems to be done automatically so I 
>don't know how to customise the properties it recieves.
>
>Please can someone give me some help of how to use a subclass of merlin to 
>dynamically set the crypto properties.
>
>Thanks
>
>_________________________________________________________________
>The new Windows Live Toolbar helps you guard against viruses 
>http://toolbar.live.com/?mkt=en-gb
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>

_________________________________________________________________
Be the first to hear what's new at MSN - sign up to our free newsletters! 
http://www.msn.co.uk/newsletters


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


RE: How Do I Use a Custom Crypto Provider?

Posted by Dave Bagguley <da...@hotmail.com>.
Hello, I have found a sort of way of doing this.  I have created a singleton 
class called SecurityProperties where I set the properties I want to put in 
crypto.properties. In my custom Merlin class, MyMerlin I do the following

public MyMerlin(Properties props,ClassLoader cl)
{
     super(addExtraProps(props),cl);
}

private Properties addExtraProps(Properties props)
{
     props.put("org.apache.ws.security.crypto.merlin.file", 
SecurityProperties.getInstance().getProperty("keystoreLocation"));
}

This works fine for what I wanted to do.

Cheers.

>From: "Dave Bagguley" <da...@hotmail.com>
>To: wss4j-dev@ws.apache.org
>Subject: How Do I Use a Custom Crypto Provider?
>Date: Thu, 09 Nov 2006 16:56:26 +0000
>
>Hello,
>
>I want to set the contents of crypto.properties dynamically, I believe to 
>do this I need to subclass Merlin and then reference this new class in the 
>crypto.properties file.
>
>So far I have a subclass of Merlin and have referenced it in my 
>crypto.properties file.  What I don't understand is where I set my 
>properties.
>
>Where do I define the properties that get passed to the new subclass of 
>Merlin?  The call to the new subclass seems to be done automatically so I 
>don't know how to customise the properties it recieves.
>
>Please can someone give me some help of how to use a subclass of merlin to 
>dynamically set the crypto properties.
>
>Thanks
>
>_________________________________________________________________
>The new Windows Live Toolbar helps you guard against viruses 
>http://toolbar.live.com/?mkt=en-gb
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
>For additional commands, e-mail: wss4j-dev-help@ws.apache.org
>

_________________________________________________________________
Be the first to hear what's new at MSN - sign up to our free newsletters! 
http://www.msn.co.uk/newsletters


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