Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » [NEON] Key Generation with secp256k1(Key Generation fails with java.security.InvalidAlgorithmParameterException)
[NEON] Key Generation with secp256k1 [message #1740531] Mon, 15 August 2016 12:52 Go to next message
Thomas Mangold is currently offline Thomas MangoldFriend
Messages: 7
Registered: October 2013
Junior Member
With new Scout Neon, the generation of a new Scout-Project compiles, but the client can't connect, because the generation of the key pair fails. I'm working on Linux Fedora24 x64 with jdk1.8.0_101.

On generation of the new scout project this warning is thrown, but the project is generated:
[WARNING]: Could not generate a new key pair.
java.security.InvalidAlgorithmParameterException: Unknown curve name: secp256k1
	at sun.security.ec.ECKeyPairGenerator.initialize(ECKeyPairGenerator.java:100)
	at java.security.KeyPairGenerator$Delegate.initialize(KeyPairGenerator.java:667)
	at org.eclipse.scout.sdk.core.util.CoreUtils.generateKeyPair(CoreUtils.java:126)
	at org.eclipse.scout.sdk.core.s.project.ScoutProjectNewHelper.generateKeyPair(ScoutProjectNewHelper.java:123)
	at org.eclipse.scout.sdk.core.s.project.ScoutProjectNewHelper.createProject(ScoutProjectNewHelper.java:106)
	at org.eclipse.scout.sdk.s2e.operation.project.ScoutProjectNewOperation.run(ScoutProjectNewOperation.java:95)
	at org.eclipse.scout.sdk.s2e.job.ResourceBlockingOperationJob.run(ResourceBlockingOperationJob.java:104)
	at org.eclipse.scout.sdk.s2e.job.AbstractResourceBlockingJob.doRun(AbstractResourceBlockingJob.java:87)
	at org.eclipse.scout.sdk.s2e.job.AbstractResourceBlockingJob.run(AbstractResourceBlockingJob.java:75)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
[WARNING]: Could not generate a new key pair.
java.security.InvalidAlgorithmParameterException: Unknown curve name: secp256k1
	at sun.security.ec.ECKeyPairGenerator.initialize(ECKeyPairGenerator.java:100)
	at java.security.KeyPairGenerator$Delegate.initialize(KeyPairGenerator.java:667)
	at org.eclipse.scout.sdk.core.util.CoreUtils.generateKeyPair(CoreUtils.java:126)
	at org.eclipse.scout.sdk.core.s.project.ScoutProjectNewHelper.generateKeyPair(ScoutProjectNewHelper.java:123)
	at org.eclipse.scout.sdk.core.s.project.ScoutProjectNewHelper.createProject(ScoutProjectNewHelper.java:107)
	at org.eclipse.scout.sdk.s2e.operation.project.ScoutProjectNewOperation.run(ScoutProjectNewOperation.java:95)
	at org.eclipse.scout.sdk.s2e.job.ResourceBlockingOperationJob.run(ResourceBlockingOperationJob.java:104)
	at org.eclipse.scout.sdk.s2e.job.AbstractResourceBlockingJob.doRun(AbstractResourceBlockingJob.java:87)
	at org.eclipse.scout.sdk.s2e.job.AbstractResourceBlockingJob.run(AbstractResourceBlockingJob.java:75)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)


Where an how do I have do put in the key pair into the configuration? On starting the client, this error is thrown and I presume, this is somehow related to the missing key pair:
2016-08-15 14:47:48,004 INFO  [main] org.eclipse.scout.dev.jetty.JettyServer - Starting Jetty with resourceBase=/home/u111979/workspaces/clique/trunk/clique/clique.ui.html.app.dev/src/main/webapp - MDC[]
2016-08-15 14:47:48,030 INFO  [main] org.eclipse.jetty.server.Server - jetty-9.2.13.v20150730 - MDC[]
2016-08-15 14:47:48,141 INFO  [main] org.eclipse.jetty.webapp.StandardDescriptorProcessor - NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet - MDC[]
2016-08-15 14:47:48,270 INFO  [Thread-9] org.eclipse.scout.rt.platform.inventory.internal.JandexInventoryBuilder - forcing rebuild of index 'file:/home/u111979/workspaces/clique/trunk/clique/clique.ui.html/target/classes/META-INF/jandex.idx'. scanning location... - MDC[]
2016-08-15 14:47:48,423 INFO  [Thread-9] org.eclipse.scout.rt.platform.inventory.internal.JandexInventoryBuilder - forcing rebuild of index 'file:/home/u111979/workspaces/clique/trunk/clique/clique.client/target/classes/META-INF/jandex.idx'. scanning location... - MDC[]
2016-08-15 14:47:48,434 INFO  [Thread-9] org.eclipse.scout.rt.platform.inventory.internal.JandexInventoryBuilder - forcing rebuild of index 'file:/home/u111979/workspaces/clique/trunk/clique/clique.shared/target/classes/META-INF/jandex.idx'. scanning location... - MDC[]
2016-08-15 14:47:48,438 INFO  [Thread-9] org.eclipse.scout.rt.platform.inventory.ClassInventory - Finished preparation of jandex class inventory in 233.264369 ms - MDC[]
2016-08-15 14:47:48,720 INFO  [Thread-9] org.eclipse.scout.rt.platform.job.internal.DevelopmentThreadNameDecorator - +++ Development thread name decoration - MDC[]
2016-08-15 14:47:48,727 INFO  [Thread-9] org.eclipse.scout.rt.platform.logger.LoggerPlatformListener - registered logger support [org.eclipse.scout.rt.platform.logger.LogbackLoggerSupport] - MDC[]
2016-08-15 14:47:48,728 INFO  [Thread-9] org.eclipse.scout.rt.shared.services.common.code.CodeTypeRegistrator - 0 code type classes registered. - MDC[]
2016-08-15 14:47:48,752 INFO  [Thread-9] org.eclipse.scout.rt.shared.servicetunnel.RegisterTunnelToServerPlatformListener - Tunnel to server proxies registered. - MDC[]
2016-08-15 14:47:48,754 INFO  [Thread-9] org.eclipse.scout.rt.shared.servicetunnel.http.MultiSessionCookieStoreInstaller - Successfully installed java.net.CookieManager@5e4fac9b (Cookie store: org.eclipse.scout.rt.shared.servicetunnel.http.MultiSessionCookieStore@9596e8f) - MDC[]
2016-08-15 14:47:48,868 INFO  [main] org.eclipse.jetty.server.handler.ContextHandler - Started o.e.s.d.j.P_WebAppContext@5d76b067{/,file:/home/u111979/workspaces/clique/trunk/clique/clique.ui.html.app.dev/src/main/webapp/,AVAILABLE} - MDC[]
2016-08-15 14:47:48,872 ERROR [scout-thread-2 ClientNotificationPoller] org.eclipse.scout.rt.client.clientnotification.ClientNotificationPoller - Error receiving client notifications - MDC[principal=notification-authenticator, jobName=ClientNotificationPoller]
org.eclipse.scout.rt.platform.exception.PlatformException: org.eclipse.scout.rt.platform.exception.PlatformException: Invalid signature setup [translator=org.eclipse.scout.rt.platform.exception.DefaultRuntimeExceptionTranslator, user=notification-authenticator, calling-thread=scout-thread-2 ClientNotificationPoller, job=Tunneling service request [seq=1, submitter=ClientNotificationPoller]]
	at org.eclipse.scout.rt.platform.exception.DefaultRuntimeExceptionTranslator.translateInternal(DefaultRuntimeExceptionTranslator.java:54)
	at org.eclipse.scout.rt.platform.exception.DefaultRuntimeExceptionTranslator.translate(DefaultRuntimeExceptionTranslator.java:37)
	at org.eclipse.scout.rt.platform.exception.DefaultRuntimeExceptionTranslator.translate(DefaultRuntimeExceptionTranslator.java:1)
	at org.eclipse.scout.rt.platform.job.internal.JobExceptionTranslator.translateExecutionException(JobExceptionTranslator.java:63)
	at org.eclipse.scout.rt.platform.job.internal.JobFutureTask.awaitDoneAndGet(JobFutureTask.java:392)
	at org.eclipse.scout.rt.platform.job.internal.JobFutureTask.awaitDoneAndGet(JobFutureTask.java:381)
	at org.eclipse.scout.rt.shared.servicetunnel.http.HttpServiceTunnel.tunnel(HttpServiceTunnel.java:230)
	at org.eclipse.scout.rt.shared.servicetunnel.AbstractServiceTunnel.invokeService(AbstractServiceTunnel.java:48)
	at org.eclipse.scout.rt.shared.servicetunnel.AbstractServiceTunnel.invokeService(AbstractServiceTunnel.java:42)
	at org.eclipse.scout.rt.shared.servicetunnel.http.HttpServiceTunnel.invokeService(HttpServiceTunnel.java:191)
	at org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelProxyProducer.invoke(ServiceTunnelProxyProducer.java:43)
	at org.eclipse.scout.rt.platform.interceptor.DecoratingProxy.invokeImpl(DecoratingProxy.java:134)
	at org.eclipse.scout.rt.platform.interceptor.DecoratingProxy$P_InvocationHandler.invoke(DecoratingProxy.java:172)
	at com.sun.proxy.$Proxy16.getNotifications(Unknown Source)
	at org.eclipse.scout.rt.client.clientnotification.ClientNotificationPoller$P_NotificationPoller.run(ClientNotificationPoller.java:84)
	at org.eclipse.scout.rt.platform.util.concurrent.Callables$1.call(Callables.java:37)
	at org.eclipse.scout.rt.platform.util.concurrent.Callables$1.call(Callables.java:1)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:185)
	at org.eclipse.scout.rt.platform.job.internal.ExceptionProcessor.intercept(ExceptionProcessor.java:41)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:180)
	at org.eclipse.scout.rt.platform.context.RunContextRunner$1.call(RunContextRunner.java:42)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:185)
	at org.eclipse.scout.rt.platform.security.SubjectProcessor$1.run(SubjectProcessor.java:47)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:422)
	at org.eclipse.scout.rt.platform.security.SubjectProcessor.intercept(SubjectProcessor.java:43)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:180)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:135)
	at org.eclipse.scout.rt.platform.context.RunContext.call(RunContext.java:121)
	at org.eclipse.scout.rt.platform.context.RunContextRunner.intercept(RunContextRunner.java:38)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:180)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:135)
	at org.eclipse.scout.rt.platform.job.internal.JobFutureTask$1.call(JobFutureTask.java:100)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at org.eclipse.scout.rt.platform.job.internal.JobFutureTask.run(JobFutureTask.java:160)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
	at org.eclipse.scout.rt.platform.job.internal.NamedThreadFactory$1.run(NamedThreadFactory.java:54)
Caused by: java.io.IOException: org.eclipse.scout.rt.platform.exception.PlatformException: Invalid signature setup
	at org.eclipse.scout.rt.shared.servicetunnel.http.HttpServiceTunnel.addSignatureHeader(HttpServiceTunnel.java:137)
	at org.eclipse.scout.rt.shared.servicetunnel.http.HttpServiceTunnel.addCustomHeaders(HttpServiceTunnel.java:125)
	at org.eclipse.scout.rt.shared.servicetunnel.http.HttpServiceTunnel.createURLConnection(HttpServiceTunnel.java:113)
	at org.eclipse.scout.rt.shared.servicetunnel.http.RemoteServiceInvocationCallable.call(RemoteServiceInvocationCallable.java:73)
	at org.eclipse.scout.rt.shared.servicetunnel.http.RemoteServiceInvocationCallable.call(RemoteServiceInvocationCallable.java:1)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:185)
	at org.eclipse.scout.rt.platform.context.RunContextRunner$1.call(RunContextRunner.java:42)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:185)
	... 12 common frames omitted
Caused by: org.eclipse.scout.rt.platform.exception.PlatformException: Invalid signature setup
	at org.eclipse.scout.rt.shared.servicetunnel.http.DefaultAuthToken.init(DefaultAuthToken.java:103)
	at org.eclipse.scout.rt.shared.servicetunnel.http.HttpServiceTunnel.createAuthToken(HttpServiceTunnel.java:164)
	at org.eclipse.scout.rt.shared.servicetunnel.http.HttpServiceTunnel.addSignatureHeader(HttpServiceTunnel.java:131)
	... 19 common frames omitted
Caused by: org.eclipse.scout.rt.platform.exception.ProcessingException: unable to create signature. [severity=ERROR]
	at org.eclipse.scout.rt.platform.security.SecurityUtility.createSignature(SecurityUtility.java:423)
	at org.eclipse.scout.rt.shared.servicetunnel.http.DefaultAuthToken.sign(DefaultAuthToken.java:156)
	at org.eclipse.scout.rt.shared.servicetunnel.http.DefaultAuthToken.init(DefaultAuthToken.java:100)
	... 21 common frames omitted
Caused by: java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: IOException : DerInputStream.getLength(): lengthTag=96, too big.
	at sun.security.ec.ECKeyFactory.engineGeneratePrivate(ECKeyFactory.java:169)
	at java.security.KeyFactory.generatePrivate(KeyFactory.java:366)
	at org.eclipse.scout.rt.platform.security.SecurityUtility.createSignature(SecurityUtility.java:413)
	... 23 common frames omitted
Caused by: java.security.InvalidKeyException: IOException : DerInputStream.getLength(): lengthTag=96, too big.
	at sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:351)
	at sun.security.pkcs.PKCS8Key.decode(PKCS8Key.java:356)
	at sun.security.ec.ECPrivateKeyImpl.<init>(ECPrivateKeyImpl.java:73)
	at sun.security.ec.ECKeyFactory.implGeneratePrivate(ECKeyFactory.java:237)
	at sun.security.ec.ECKeyFactory.engineGeneratePrivate(ECKeyFactory.java:165)
	... 25 common frames omitted
2016-08-15 14:47:48,883 INFO  [main] org.eclipse.jetty.server.ServerConnector - Started ServerConnector@4a615877{HTTP/1.1}{0.0.0.0:8082} - MDC[]
Re: [NEON] Key Generation with secp256k1 [message #1740754 is a reply to message #1740531] Thu, 18 August 2016 07:25 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1237
Registered: October 2011
Senior Member
Thomas Mangold wrote on Mon, 15 August 2016 14:52
Where and how do I have do put in the key pair into the configuration?


My guess is that the hello-world application is not correctly generated (we are using maven archetypes to create the initial project). Let compare your result with what I got. My guess is that the "scout.auth.privatekey" and "scout.auth.publickey" are not correctly generated.

In the projects to start from Eclipse (using Jetty):
* config.properties in helloworld.server.app.dev
* config.properties in helloworld.ui.html.app.dev

In the projects to build the wars:
* config.properties in helloworld.server.app.war
* config.properties in helloworld.ui.html.app.war

Re: [NEON] Key Generation with secp256k1 [message #1741163 is a reply to message #1740754] Tue, 23 August 2016 12:24 Go to previous messageGo to next message
Thomas Mangold is currently offline Thomas MangoldFriend
Messages: 7
Registered: October 2013
Junior Member
Jeremie Bresson wrote on Thu, 18 August 2016 03:25


My guess is that the hello-world application is not correctly generated (we are using maven archetypes to create the initial project). Let compare your result with what I got. My guess is that the "scout.auth.privatekey" and "scout.auth.publickey" are not correctly generated.


Hi Jeremie

Thats exactly the thruth because on generating the application, the key pair should be generated. In each config.properties file exist the missing key:
scout.auth.privatekey=TODO_use_org.eclipse.scout.rt.platform.security.SecurityUtility.main(String[]))


Trying to generate the key pair with the mentioned standalone java class org.eclipse.scout.rt.platform.security.SecurityUtility throws the same exception.

Debugging the process shows, that the package sun.security is provided in the Linux distribution of Eclipse Scout Neon without the branch sun.security.ec and hence missing the class ECKeyPairGenerator from this class.
Re: [NEON] Key Generation with secp256k1 [message #1741933 is a reply to message #1741163] Tue, 30 August 2016 16:30 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1237
Registered: October 2011
Senior Member
The Problem is that the requested security algorithm is not provided by the JVM you use to run Eclipse IDE and the Scout Application.

Which JVM (Version and implementation) are you using?
Do you know what KeyPairGenerator algorithms are available in the JVM you use?

I think it is possible to change the algo used by your scout application, but this requires some work... If you know what you can use, I might be able to help you with the requested changes.
Re: [NEON] Key Generation with secp256k1 [message #1742248 is a reply to message #1741933] Thu, 01 September 2016 06:24 Go to previous message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1237
Registered: October 2011
Senior Member
I have tried open JDK 7 and 8 (zulu distribution) on windows, the algorithm "secp256k1" is available.
Previous Topic:FormData not generated
Next Topic:Login Form
Goto Forum:
  


Current Time: Wed May 24 00:35:02 GMT 2017

Powered by FUDForum. Page generated in 0.05427 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software