On 18/05/2010 18:17, webp...@tigris.org wrote:
> Hi Bruno,
> I'd like to sincerely thanks for your answer :)
>
> After following your suggestions now I set parameters in this way:
>
> org.restlet.Server https_server = new org.restlet.Server(Protocol.HTTPS, 
> https_port);
> https_server.setContext(new Context()); //otherwise getContext() returns null
> Series<Parameter>  parameters = https_server.getContext().getParameters();
> parameters.add("sslContextFactory", 
> "org.restlet.engine.security.DefaultSslContextFactory");
> parameters.add("keystorePath", KEYSTORE_PATH);
> parameters.add("keystorePassword", 
> myApplication.properties.get(ADMIN_PASSWORD_KEY));
> parameters.add("keyPassword", 
> myApplication.properties.get(ADMIN_PASSWORD_KEY));
> parameters.add("keystoreType", "JKS");                
>
> I use DefaultSslContextFactory and DSA as keyalg as suggested by you in other 
> threads (such as 
> http://www.mail-archive.com/discuss@restlet.tigris.org/msg07087.html )
> but now the following exception gets thrown:

I can't remember suggesting DSA, and the DefaultSslContextFactory is now 
the default anyway (so you don't need to specify it).

If you created the Server after created the component, it would have a 
context:
Server server = component.getServers().add(Protocol.HTTPS, 8183);


> java.io.IOException: Invalid keystore format
>       at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:633)
>       at 
> sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:38)
>       at java.security.KeyStore.load(KeyStore.java:1185)
>       at 
> org.restlet.engine.security.DefaultSslContextFactory.createSslContext(DefaultSslContextFactory.java:198)
>       at 
> org.restlet.ext.simple.HttpsServerHelper.start(HttpsServerHelper.java:272)
>       at org.restlet.Server.start(Server.java:571)
>       at org.restlet.Component.startServers(Component.java:581)
>       at org.restlet.Component.start(Component.java:508)

I'm not sure, what's in KEYSTORE_PATH? Have you checked for example that 
you can read its content using keytool?
  keytool -list -keystore your_file.jks -storetype JKS


Best wishes,

Bruno.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2610810

Reply via email to