You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Felipe Jaekel <fk...@gmail.com> on 2017/10/26 12:57:35 UTC

Problem with KeyStore.load() after upgrading from 7.0.2 to 7.0.4

Hi,

I have a webapp where the user can upload a PFX file to digitally sign PDF
files. After upgrading from 7.0.2 to 7.0.4 I'm getting this exception:

java.security.UnrecoverableKeyException: failed to decrypt safe contents
entry: javax.crypto.BadPaddingException: pad block corrupted

First I tough it was something related to the upload process, but even
after pointing to a local PFX file and hardcoding the password I still get
this exception on 7.0.4.

ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(new FileInputStream("/home/fjaekel/Desktop/anima.pfx"),
"anima".toCharArray());

Debugging on both servers the KeyStore provider is *SUN version 1.8* and
the type is *jks*. Tested with OpenJDK 64-Bit Server VM (build 25.111-b15,
mixed mode)  and Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed
mode).

Any ideias?

Thanks

Re: Problem with KeyStore.load() after upgrading from 7.0.2 to 7.0.4

Posted by Felipe Jaekel <fk...@gmail.com>.
VM arguments:  -Dcatalina.base=/home/fjaekel/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1
-Dcatalina.home=/home/fjaekel/java/servers/apache-tomee-plus-7.0.4
-Dwtp.deploy=/home/fjaekel/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps
-Djava.endorsed.dirs=/home/fjaekel/java/servers/apache-tomee-plus-7.0.4/endorsed
-Dfile.encoding=UTF-8



Is there additional info I can provide?

2017-10-26 17:18 GMT-02:00 Romain Manni-Bucau <rm...@gmail.com>:

> jconsole will give you
>
> 1. the system properties of the jvm
> 2. the tomcat server.xml configuration - to ensure it is the file one
> which is loaded
>
> Romain Manni-Bucau
> @rmannibucau |  Blog | Old Blog | Github | LinkedIn
>
>
> 2017-10-26 19:57 GMT+02:00 Felipe Jaekel <fk...@gmail.com>:
> > Same result with 7.0.5-SNAPSHOT, but 7.0.3 works.
> >
> > I tried to run sudo jinfo -sysprops, but I'm getting
> > sun.jvm.hotspot.debugger.DebuggerException:
> > sun.jvm.hotspot.runtime.VMVersionMismatchException: Supported versions
> are
> > 25.151-b12. Target VM is 25.131-b11
> >
> > Anything in particular I can check using jconsole?
> >
> > Thanks
> >
> > 2017-10-26 11:59 GMT-02:00 Romain Manni-Bucau <rm...@gmail.com>:
> >
> >> hmm
> >>
> >> maybe check the JVM environment through JMX (systems props in
> particular)
> >>
> >> Romain Manni-Bucau
> >> @rmannibucau |  Blog | Old Blog | Github | LinkedIn
> >>
> >>
> >> 2017-10-26 15:56 GMT+02:00 Felipe Jaekel <fk...@gmail.com>:
> >> > I'm suspecting of Tomcat 8.5.20, but I'd like check first if is there
> >> > something I can do on TomEE config
> >> >
> >> > *Stacktrace:*
> >> > java.io.IOException: keystore password was incorrect
> >> > at sun.security.pkcs12.PKCS12KeyStore.engineLoad(
> >> PKCS12KeyStore.java:2015)
> >> > at
> >> > sun.security.provider.KeyStoreDelegator.engineLoad(
> >> KeyStoreDelegator.java:238)
> >> > at
> >> > sun.security.provider.JavaKeyStore$DualFormatJKS.
> >> engineLoad(JavaKeyStore.java:70)
> >> > at java.security.KeyStore.load(KeyStore.java:1445)
> >> > at br.com.pacsweb.util.SignatureInterop.<init>(
> SignatureInterop.java:38)
> >> > at
> >> > br.com.pacsweb.service.AssinaturaLaudoService.persist(
> >> AssinaturaLaudoService.java:40)
> >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> > at
> >> > sun.reflect.NativeMethodAccessorImpl.invoke(
> >> NativeMethodAccessorImpl.java:62)
> >> > at
> >> > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> >> DelegatingMethodAccessorImpl.java:43)
> >> > at java.lang.reflect.Method.invoke(Method.java:498)
> >> > at
> >> > org.apache.openejb.core.interceptor.ReflectionInvocationContext$
> >> Invocation.invoke(ReflectionInvocationContext.java:205)
> >> > at
> >> > org.apache.openejb.core.interceptor.ReflectionInvocationContext.
> proceed(
> >> ReflectionInvocationContext.java:186)
> >> > at
> >> > org.apache.openejb.monitoring.StatsInterceptor.record(
> >> StatsInterceptor.java:181)
> >> > at
> >> > org.apache.openejb.monitoring.StatsInterceptor.invoke(
> >> StatsInterceptor.java:100)
> >> > at sun.reflect.GeneratedMethodAccessor245.invoke(Unknown Source)
> >> > at
> >> > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> >> DelegatingMethodAccessorImpl.java:43)
> >> > at java.lang.reflect.Method.invoke(Method.java:498)
> >> > at
> >> > org.apache.openejb.core.interceptor.ReflectionInvocationContext$
> >> Invocation.invoke(ReflectionInvocationContext.java:205)
> >> > at
> >> > org.apache.openejb.core.interceptor.ReflectionInvocationContext.
> proceed(
> >> ReflectionInvocationContext.java:186)
> >> > at
> >> > org.apache.openejb.core.interceptor.InterceptorStack.
> >> invoke(InterceptorStack.java:85)
> >> > at
> >> > org.apache.openejb.core.stateless.StatelessContainer._
> >> invoke(StatelessContainer.java:252)
> >> > at
> >> > org.apache.openejb.core.stateless.StatelessContainer.
> >> invoke(StatelessContainer.java:212)
> >> > at
> >> > org.apache.openejb.core.ivm.EjbObjectProxyHandler.
> >> synchronizedBusinessMethod(EjbObjectProxyHandler.java:265)
> >> > at
> >> > org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(
> >> EjbObjectProxyHandler.java:260)
> >> > at
> >> > org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(
> >> EjbObjectProxyHandler.java:89)
> >> > at
> >> > org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(
> >> BaseEjbProxyHandler.java:347)
> >> > at
> >> > br.com.pacsweb.service.AssinaturaLaudoService$$
> >> LocalBeanProxy.persist(br/com/spdata/pacsweb/service/
> >> AssinaturaLaudoService.java)
> >> > at
> >> > br.com.pacsweb.page.ImpressaoLaudoController.assinar(
> >> ImpressaoLaudoController.java:156)
> >> > at
> >> > br.com.pacsweb.page.ImpressaoLaudoController$$
> >> OwbNormalScopeProxy0.assinar(br/com/spdata/pacsweb/page/
> >> ImpressaoLaudoController.java)
> >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> > at
> >> > sun.reflect.NativeMethodAccessorImpl.invoke(
> >> NativeMethodAccessorImpl.java:62)
> >> > at
> >> > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> >> DelegatingMethodAccessorImpl.java:43)
> >> > at java.lang.reflect.Method.invoke(Method.java:498)
> >> > at org.apache.el.parser.AstValue.invoke(AstValue.java:247)
> >> > at org.apache.el.MethodExpressionImpl.invoke(
> >> MethodExpressionImpl.java:267)
> >> > at
> >> > org.apache.webbeans.el22.WrappedMethodExpression.invoke(
> >> WrappedMethodExpression.java:52)
> >> > at
> >> > org.apache.myfaces.view.facelets.el.ContextAwareTagMethodExpressio
> >> n.invoke(ContextAwareTagMethodExpression.java:96)
> >> > at
> >> > org.apache.myfaces.application.ActionListenerImpl.processAction(
> >> ActionListenerImpl.java:74)
> >> > at javax.faces.component.UICommand.broadcast(UICommand.java:120)
> >> > at javax.faces.component.UIViewRoot._broadcastAll(
> UIViewRoot.java:1174)
> >> > at javax.faces.component.UIViewRoot.broadcastEvents(
> UIViewRoot.java:365)
> >> > at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1660)
> >> > at javax.faces.component.UIViewRoot.processApplication(
> >> UIViewRoot.java:864)
> >> > at
> >> > org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(
> >> InvokeApplicationExecutor.java:42)
> >> > at
> >> > org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(
> >> LifecycleImpl.java:196)
> >> > at
> >> > org.apache.myfaces.lifecycle.LifecycleImpl.execute(
> >> LifecycleImpl.java:143)
> >> > at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
> >> > at
> >> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> >> ApplicationFilterChain.java:231)
> >> > at
> >> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> >> ApplicationFilterChain.java:166)
> >> > at
> >> > org.omnifaces.filter.CacheControlFilter.doFilter(
> >> CacheControlFilter.java:239)
> >> > at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:108)
> >> > at
> >> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> >> ApplicationFilterChain.java:193)
> >> > at
> >> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> >> ApplicationFilterChain.java:166)
> >> > at org.apache.tomcat.websocket.server.WsFilter.doFilter(
> >> WsFilter.java:52)
> >> > at
> >> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> >> ApplicationFilterChain.java:193)
> >> > at
> >> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> >> ApplicationFilterChain.java:166)
> >> > at org.apache.openejb.server.httpd.EEFilter.doFilter(
> EEFilter.java:65)
> >> > at
> >> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> >> ApplicationFilterChain.java:193)
> >> > at
> >> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> >> ApplicationFilterChain.java:166)
> >> > at br.com.pacsweb.filter.LoginFilter.doFilter(LoginFilter.java:85)
> >> > at
> >> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> >> ApplicationFilterChain.java:193)
> >> > at
> >> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> >> ApplicationFilterChain.java:166)
> >> > at
> >> > org.omnifaces.filter.CharacterEncodingFilter.doFilter(
> >> CharacterEncodingFilter.java:124)
> >> > at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:108)
> >> > at
> >> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> >> ApplicationFilterChain.java:193)
> >> > at
> >> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> >> ApplicationFilterChain.java:166)
> >> > at
> >> > org.apache.catalina.core.StandardWrapperValve.invoke(
> >> StandardWrapperValve.java:198)
> >> > at
> >> > org.apache.catalina.core.StandardContextValve.invoke(
> >> StandardContextValve.java:96)
> >> > at org.apache.tomee.catalina.OpenEJBValve.invoke(
> OpenEJBValve.java:44)
> >> > at
> >> > org.apache.catalina.authenticator.AuthenticatorBase.invoke(
> >> AuthenticatorBase.java:478)
> >> > at
> >> > org.apache.catalina.core.StandardHostValve.invoke(
> >> StandardHostValve.java:140)
> >> > at
> >> > org.apache.catalina.valves.ErrorReportValve.invoke(
> >> ErrorReportValve.java:80)
> >> > at
> >> > org.apache.tomee.catalina.OpenEJBSecurityListener$
> >> RequestCapturer.invoke(OpenEJBSecurityListener.java:97)
> >> > at
> >> > org.apache.catalina.valves.AbstractAccessLogValve.invoke(
> >> AbstractAccessLogValve.java:650)
> >> > at
> >> > org.apache.catalina.core.StandardEngineValve.invoke(
> >> StandardEngineValve.java:87)
> >> > at
> >> > org.apache.catalina.connector.CoyoteAdapter.service(
> >> CoyoteAdapter.java:342)
> >> > at
> >> > org.apache.coyote.http11.Http11Processor.service(
> >> Http11Processor.java:799)
> >> > at
> >> > org.apache.coyote.AbstractProcessorLight.process(
> >> AbstractProcessorLight.java:66)
> >> > at
> >> > org.apache.coyote.AbstractProtocol$ConnectionHandler.process(
> >> AbstractProtocol.java:868)
> >> > at
> >> > org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.
> >> doRun(NioEndpoint.java:1457)
> >> > at
> >> > org.apache.tomcat.util.net.SocketProcessorBase.run(
> >> SocketProcessorBase.java:49)
> >> > at
> >> > java.util.concurrent.ThreadPoolExecutor.runWorker(
> >> ThreadPoolExecutor.java:1149)
> >> > at
> >> > java.util.concurrent.ThreadPoolExecutor$Worker.run(
> >> ThreadPoolExecutor.java:624)
> >> > at
> >> > org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(
> >> TaskThread.java:61)
> >> > at java.lang.Thread.run(Thread.java:748)
> >> > Caused by: java.security.UnrecoverableKeyException: failed to decrypt
> >> safe
> >> > contents entry: javax.crypto.BadPaddingException: pad block corrupted
> >> > ... 85 more
> >> >
> >> >
> >> > 2017-10-26 11:04 GMT-02:00 Romain Manni-Bucau <rmannibucau@gmail.com
> >:
> >> >
> >> >> Hi Felipe,
> >> >>
> >> >> did you do a diff between tomee/lib and your WEB-INF/lib? we have
> some
> >> >> impacting changes in last release. Also what is the stack you get and
> >> >> the calling code if you can share it.
> >> >>
> >> >> Romain Manni-Bucau
> >> >> @rmannibucau |  Blog | Old Blog | Github | LinkedIn
> >> >>
> >> >>
> >> >> 2017-10-26 14:57 GMT+02:00 Felipe Jaekel <fk...@gmail.com>:
> >> >> > Hi,
> >> >> >
> >> >> > I have a webapp where the user can upload a PFX file to digitally
> sign
> >> >> PDF
> >> >> > files. After upgrading from 7.0.2 to 7.0.4 I'm getting this
> exception:
> >> >> >
> >> >> > java.security.UnrecoverableKeyException: failed to decrypt safe
> >> contents
> >> >> > entry: javax.crypto.BadPaddingException: pad block corrupted
> >> >> >
> >> >> > First I tough it was something related to the upload process, but
> even
> >> >> > after pointing to a local PFX file and hardcoding the password I
> still
> >> >> get
> >> >> > this exception on 7.0.4.
> >> >> >
> >> >> > ks = KeyStore.getInstance(KeyStore.getDefaultType());
> >> >> > ks.load(new FileInputStream("/home/fjaekel/Desktop/anima.pfx"),
> >> >> > "anima".toCharArray());
> >> >> >
> >> >> > Debugging on both servers the KeyStore provider is *SUN version
> 1.8*
> >> and
> >> >> > the type is *jks*. Tested with OpenJDK 64-Bit Server VM (build
> >> >> 25.111-b15,
> >> >> > mixed mode)  and Java HotSpot(TM) 64-Bit Server VM (build
> 25.151-b12,
> >> >> mixed
> >> >> > mode).
> >> >> >
> >> >> > Any ideias?
> >> >> >
> >> >> > Thanks
> >> >>
> >>
>

Re: Problem with KeyStore.load() after upgrading from 7.0.2 to 7.0.4

Posted by Romain Manni-Bucau <rm...@gmail.com>.
jconsole will give you

1. the system properties of the jvm
2. the tomcat server.xml configuration - to ensure it is the file one
which is loaded

Romain Manni-Bucau
@rmannibucau |  Blog | Old Blog | Github | LinkedIn


2017-10-26 19:57 GMT+02:00 Felipe Jaekel <fk...@gmail.com>:
> Same result with 7.0.5-SNAPSHOT, but 7.0.3 works.
>
> I tried to run sudo jinfo -sysprops, but I'm getting
> sun.jvm.hotspot.debugger.DebuggerException:
> sun.jvm.hotspot.runtime.VMVersionMismatchException: Supported versions are
> 25.151-b12. Target VM is 25.131-b11
>
> Anything in particular I can check using jconsole?
>
> Thanks
>
> 2017-10-26 11:59 GMT-02:00 Romain Manni-Bucau <rm...@gmail.com>:
>
>> hmm
>>
>> maybe check the JVM environment through JMX (systems props in particular)
>>
>> Romain Manni-Bucau
>> @rmannibucau |  Blog | Old Blog | Github | LinkedIn
>>
>>
>> 2017-10-26 15:56 GMT+02:00 Felipe Jaekel <fk...@gmail.com>:
>> > I'm suspecting of Tomcat 8.5.20, but I'd like check first if is there
>> > something I can do on TomEE config
>> >
>> > *Stacktrace:*
>> > java.io.IOException: keystore password was incorrect
>> > at sun.security.pkcs12.PKCS12KeyStore.engineLoad(
>> PKCS12KeyStore.java:2015)
>> > at
>> > sun.security.provider.KeyStoreDelegator.engineLoad(
>> KeyStoreDelegator.java:238)
>> > at
>> > sun.security.provider.JavaKeyStore$DualFormatJKS.
>> engineLoad(JavaKeyStore.java:70)
>> > at java.security.KeyStore.load(KeyStore.java:1445)
>> > at br.com.pacsweb.util.SignatureInterop.<init>(SignatureInterop.java:38)
>> > at
>> > br.com.pacsweb.service.AssinaturaLaudoService.persist(
>> AssinaturaLaudoService.java:40)
>> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> > at
>> > sun.reflect.NativeMethodAccessorImpl.invoke(
>> NativeMethodAccessorImpl.java:62)
>> > at
>> > sun.reflect.DelegatingMethodAccessorImpl.invoke(
>> DelegatingMethodAccessorImpl.java:43)
>> > at java.lang.reflect.Method.invoke(Method.java:498)
>> > at
>> > org.apache.openejb.core.interceptor.ReflectionInvocationContext$
>> Invocation.invoke(ReflectionInvocationContext.java:205)
>> > at
>> > org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(
>> ReflectionInvocationContext.java:186)
>> > at
>> > org.apache.openejb.monitoring.StatsInterceptor.record(
>> StatsInterceptor.java:181)
>> > at
>> > org.apache.openejb.monitoring.StatsInterceptor.invoke(
>> StatsInterceptor.java:100)
>> > at sun.reflect.GeneratedMethodAccessor245.invoke(Unknown Source)
>> > at
>> > sun.reflect.DelegatingMethodAccessorImpl.invoke(
>> DelegatingMethodAccessorImpl.java:43)
>> > at java.lang.reflect.Method.invoke(Method.java:498)
>> > at
>> > org.apache.openejb.core.interceptor.ReflectionInvocationContext$
>> Invocation.invoke(ReflectionInvocationContext.java:205)
>> > at
>> > org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(
>> ReflectionInvocationContext.java:186)
>> > at
>> > org.apache.openejb.core.interceptor.InterceptorStack.
>> invoke(InterceptorStack.java:85)
>> > at
>> > org.apache.openejb.core.stateless.StatelessContainer._
>> invoke(StatelessContainer.java:252)
>> > at
>> > org.apache.openejb.core.stateless.StatelessContainer.
>> invoke(StatelessContainer.java:212)
>> > at
>> > org.apache.openejb.core.ivm.EjbObjectProxyHandler.
>> synchronizedBusinessMethod(EjbObjectProxyHandler.java:265)
>> > at
>> > org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(
>> EjbObjectProxyHandler.java:260)
>> > at
>> > org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(
>> EjbObjectProxyHandler.java:89)
>> > at
>> > org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(
>> BaseEjbProxyHandler.java:347)
>> > at
>> > br.com.pacsweb.service.AssinaturaLaudoService$$
>> LocalBeanProxy.persist(br/com/spdata/pacsweb/service/
>> AssinaturaLaudoService.java)
>> > at
>> > br.com.pacsweb.page.ImpressaoLaudoController.assinar(
>> ImpressaoLaudoController.java:156)
>> > at
>> > br.com.pacsweb.page.ImpressaoLaudoController$$
>> OwbNormalScopeProxy0.assinar(br/com/spdata/pacsweb/page/
>> ImpressaoLaudoController.java)
>> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> > at
>> > sun.reflect.NativeMethodAccessorImpl.invoke(
>> NativeMethodAccessorImpl.java:62)
>> > at
>> > sun.reflect.DelegatingMethodAccessorImpl.invoke(
>> DelegatingMethodAccessorImpl.java:43)
>> > at java.lang.reflect.Method.invoke(Method.java:498)
>> > at org.apache.el.parser.AstValue.invoke(AstValue.java:247)
>> > at org.apache.el.MethodExpressionImpl.invoke(
>> MethodExpressionImpl.java:267)
>> > at
>> > org.apache.webbeans.el22.WrappedMethodExpression.invoke(
>> WrappedMethodExpression.java:52)
>> > at
>> > org.apache.myfaces.view.facelets.el.ContextAwareTagMethodExpressio
>> n.invoke(ContextAwareTagMethodExpression.java:96)
>> > at
>> > org.apache.myfaces.application.ActionListenerImpl.processAction(
>> ActionListenerImpl.java:74)
>> > at javax.faces.component.UICommand.broadcast(UICommand.java:120)
>> > at javax.faces.component.UIViewRoot._broadcastAll(UIViewRoot.java:1174)
>> > at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:365)
>> > at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1660)
>> > at javax.faces.component.UIViewRoot.processApplication(
>> UIViewRoot.java:864)
>> > at
>> > org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(
>> InvokeApplicationExecutor.java:42)
>> > at
>> > org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(
>> LifecycleImpl.java:196)
>> > at
>> > org.apache.myfaces.lifecycle.LifecycleImpl.execute(
>> LifecycleImpl.java:143)
>> > at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
>> > at
>> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
>> ApplicationFilterChain.java:231)
>> > at
>> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
>> ApplicationFilterChain.java:166)
>> > at
>> > org.omnifaces.filter.CacheControlFilter.doFilter(
>> CacheControlFilter.java:239)
>> > at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:108)
>> > at
>> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
>> ApplicationFilterChain.java:193)
>> > at
>> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
>> ApplicationFilterChain.java:166)
>> > at org.apache.tomcat.websocket.server.WsFilter.doFilter(
>> WsFilter.java:52)
>> > at
>> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
>> ApplicationFilterChain.java:193)
>> > at
>> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
>> ApplicationFilterChain.java:166)
>> > at org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:65)
>> > at
>> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
>> ApplicationFilterChain.java:193)
>> > at
>> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
>> ApplicationFilterChain.java:166)
>> > at br.com.pacsweb.filter.LoginFilter.doFilter(LoginFilter.java:85)
>> > at
>> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
>> ApplicationFilterChain.java:193)
>> > at
>> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
>> ApplicationFilterChain.java:166)
>> > at
>> > org.omnifaces.filter.CharacterEncodingFilter.doFilter(
>> CharacterEncodingFilter.java:124)
>> > at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:108)
>> > at
>> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
>> ApplicationFilterChain.java:193)
>> > at
>> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
>> ApplicationFilterChain.java:166)
>> > at
>> > org.apache.catalina.core.StandardWrapperValve.invoke(
>> StandardWrapperValve.java:198)
>> > at
>> > org.apache.catalina.core.StandardContextValve.invoke(
>> StandardContextValve.java:96)
>> > at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
>> > at
>> > org.apache.catalina.authenticator.AuthenticatorBase.invoke(
>> AuthenticatorBase.java:478)
>> > at
>> > org.apache.catalina.core.StandardHostValve.invoke(
>> StandardHostValve.java:140)
>> > at
>> > org.apache.catalina.valves.ErrorReportValve.invoke(
>> ErrorReportValve.java:80)
>> > at
>> > org.apache.tomee.catalina.OpenEJBSecurityListener$
>> RequestCapturer.invoke(OpenEJBSecurityListener.java:97)
>> > at
>> > org.apache.catalina.valves.AbstractAccessLogValve.invoke(
>> AbstractAccessLogValve.java:650)
>> > at
>> > org.apache.catalina.core.StandardEngineValve.invoke(
>> StandardEngineValve.java:87)
>> > at
>> > org.apache.catalina.connector.CoyoteAdapter.service(
>> CoyoteAdapter.java:342)
>> > at
>> > org.apache.coyote.http11.Http11Processor.service(
>> Http11Processor.java:799)
>> > at
>> > org.apache.coyote.AbstractProcessorLight.process(
>> AbstractProcessorLight.java:66)
>> > at
>> > org.apache.coyote.AbstractProtocol$ConnectionHandler.process(
>> AbstractProtocol.java:868)
>> > at
>> > org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.
>> doRun(NioEndpoint.java:1457)
>> > at
>> > org.apache.tomcat.util.net.SocketProcessorBase.run(
>> SocketProcessorBase.java:49)
>> > at
>> > java.util.concurrent.ThreadPoolExecutor.runWorker(
>> ThreadPoolExecutor.java:1149)
>> > at
>> > java.util.concurrent.ThreadPoolExecutor$Worker.run(
>> ThreadPoolExecutor.java:624)
>> > at
>> > org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(
>> TaskThread.java:61)
>> > at java.lang.Thread.run(Thread.java:748)
>> > Caused by: java.security.UnrecoverableKeyException: failed to decrypt
>> safe
>> > contents entry: javax.crypto.BadPaddingException: pad block corrupted
>> > ... 85 more
>> >
>> >
>> > 2017-10-26 11:04 GMT-02:00 Romain Manni-Bucau <rm...@gmail.com>:
>> >
>> >> Hi Felipe,
>> >>
>> >> did you do a diff between tomee/lib and your WEB-INF/lib? we have some
>> >> impacting changes in last release. Also what is the stack you get and
>> >> the calling code if you can share it.
>> >>
>> >> Romain Manni-Bucau
>> >> @rmannibucau |  Blog | Old Blog | Github | LinkedIn
>> >>
>> >>
>> >> 2017-10-26 14:57 GMT+02:00 Felipe Jaekel <fk...@gmail.com>:
>> >> > Hi,
>> >> >
>> >> > I have a webapp where the user can upload a PFX file to digitally sign
>> >> PDF
>> >> > files. After upgrading from 7.0.2 to 7.0.4 I'm getting this exception:
>> >> >
>> >> > java.security.UnrecoverableKeyException: failed to decrypt safe
>> contents
>> >> > entry: javax.crypto.BadPaddingException: pad block corrupted
>> >> >
>> >> > First I tough it was something related to the upload process, but even
>> >> > after pointing to a local PFX file and hardcoding the password I still
>> >> get
>> >> > this exception on 7.0.4.
>> >> >
>> >> > ks = KeyStore.getInstance(KeyStore.getDefaultType());
>> >> > ks.load(new FileInputStream("/home/fjaekel/Desktop/anima.pfx"),
>> >> > "anima".toCharArray());
>> >> >
>> >> > Debugging on both servers the KeyStore provider is *SUN version 1.8*
>> and
>> >> > the type is *jks*. Tested with OpenJDK 64-Bit Server VM (build
>> >> 25.111-b15,
>> >> > mixed mode)  and Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12,
>> >> mixed
>> >> > mode).
>> >> >
>> >> > Any ideias?
>> >> >
>> >> > Thanks
>> >>
>>

Re: Problem with KeyStore.load() after upgrading from 7.0.2 to 7.0.4

Posted by Felipe Jaekel <fk...@gmail.com>.
Same result with 7.0.5-SNAPSHOT, but 7.0.3 works.

I tried to run sudo jinfo -sysprops, but I'm getting
sun.jvm.hotspot.debugger.DebuggerException:
sun.jvm.hotspot.runtime.VMVersionMismatchException: Supported versions are
25.151-b12. Target VM is 25.131-b11

Anything in particular I can check using jconsole?

Thanks

2017-10-26 11:59 GMT-02:00 Romain Manni-Bucau <rm...@gmail.com>:

> hmm
>
> maybe check the JVM environment through JMX (systems props in particular)
>
> Romain Manni-Bucau
> @rmannibucau |  Blog | Old Blog | Github | LinkedIn
>
>
> 2017-10-26 15:56 GMT+02:00 Felipe Jaekel <fk...@gmail.com>:
> > I'm suspecting of Tomcat 8.5.20, but I'd like check first if is there
> > something I can do on TomEE config
> >
> > *Stacktrace:*
> > java.io.IOException: keystore password was incorrect
> > at sun.security.pkcs12.PKCS12KeyStore.engineLoad(
> PKCS12KeyStore.java:2015)
> > at
> > sun.security.provider.KeyStoreDelegator.engineLoad(
> KeyStoreDelegator.java:238)
> > at
> > sun.security.provider.JavaKeyStore$DualFormatJKS.
> engineLoad(JavaKeyStore.java:70)
> > at java.security.KeyStore.load(KeyStore.java:1445)
> > at br.com.pacsweb.util.SignatureInterop.<init>(SignatureInterop.java:38)
> > at
> > br.com.pacsweb.service.AssinaturaLaudoService.persist(
> AssinaturaLaudoService.java:40)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> > sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:62)
> > at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
> > at java.lang.reflect.Method.invoke(Method.java:498)
> > at
> > org.apache.openejb.core.interceptor.ReflectionInvocationContext$
> Invocation.invoke(ReflectionInvocationContext.java:205)
> > at
> > org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(
> ReflectionInvocationContext.java:186)
> > at
> > org.apache.openejb.monitoring.StatsInterceptor.record(
> StatsInterceptor.java:181)
> > at
> > org.apache.openejb.monitoring.StatsInterceptor.invoke(
> StatsInterceptor.java:100)
> > at sun.reflect.GeneratedMethodAccessor245.invoke(Unknown Source)
> > at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
> > at java.lang.reflect.Method.invoke(Method.java:498)
> > at
> > org.apache.openejb.core.interceptor.ReflectionInvocationContext$
> Invocation.invoke(ReflectionInvocationContext.java:205)
> > at
> > org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(
> ReflectionInvocationContext.java:186)
> > at
> > org.apache.openejb.core.interceptor.InterceptorStack.
> invoke(InterceptorStack.java:85)
> > at
> > org.apache.openejb.core.stateless.StatelessContainer._
> invoke(StatelessContainer.java:252)
> > at
> > org.apache.openejb.core.stateless.StatelessContainer.
> invoke(StatelessContainer.java:212)
> > at
> > org.apache.openejb.core.ivm.EjbObjectProxyHandler.
> synchronizedBusinessMethod(EjbObjectProxyHandler.java:265)
> > at
> > org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(
> EjbObjectProxyHandler.java:260)
> > at
> > org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(
> EjbObjectProxyHandler.java:89)
> > at
> > org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(
> BaseEjbProxyHandler.java:347)
> > at
> > br.com.pacsweb.service.AssinaturaLaudoService$$
> LocalBeanProxy.persist(br/com/spdata/pacsweb/service/
> AssinaturaLaudoService.java)
> > at
> > br.com.pacsweb.page.ImpressaoLaudoController.assinar(
> ImpressaoLaudoController.java:156)
> > at
> > br.com.pacsweb.page.ImpressaoLaudoController$$
> OwbNormalScopeProxy0.assinar(br/com/spdata/pacsweb/page/
> ImpressaoLaudoController.java)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> > sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:62)
> > at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
> > at java.lang.reflect.Method.invoke(Method.java:498)
> > at org.apache.el.parser.AstValue.invoke(AstValue.java:247)
> > at org.apache.el.MethodExpressionImpl.invoke(
> MethodExpressionImpl.java:267)
> > at
> > org.apache.webbeans.el22.WrappedMethodExpression.invoke(
> WrappedMethodExpression.java:52)
> > at
> > org.apache.myfaces.view.facelets.el.ContextAwareTagMethodExpressio
> n.invoke(ContextAwareTagMethodExpression.java:96)
> > at
> > org.apache.myfaces.application.ActionListenerImpl.processAction(
> ActionListenerImpl.java:74)
> > at javax.faces.component.UICommand.broadcast(UICommand.java:120)
> > at javax.faces.component.UIViewRoot._broadcastAll(UIViewRoot.java:1174)
> > at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:365)
> > at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1660)
> > at javax.faces.component.UIViewRoot.processApplication(
> UIViewRoot.java:864)
> > at
> > org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(
> InvokeApplicationExecutor.java:42)
> > at
> > org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(
> LifecycleImpl.java:196)
> > at
> > org.apache.myfaces.lifecycle.LifecycleImpl.execute(
> LifecycleImpl.java:143)
> > at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:231)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:166)
> > at
> > org.omnifaces.filter.CacheControlFilter.doFilter(
> CacheControlFilter.java:239)
> > at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:108)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:193)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:166)
> > at org.apache.tomcat.websocket.server.WsFilter.doFilter(
> WsFilter.java:52)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:193)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:166)
> > at org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:65)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:193)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:166)
> > at br.com.pacsweb.filter.LoginFilter.doFilter(LoginFilter.java:85)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:193)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:166)
> > at
> > org.omnifaces.filter.CharacterEncodingFilter.doFilter(
> CharacterEncodingFilter.java:124)
> > at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:108)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:193)
> > at
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:166)
> > at
> > org.apache.catalina.core.StandardWrapperValve.invoke(
> StandardWrapperValve.java:198)
> > at
> > org.apache.catalina.core.StandardContextValve.invoke(
> StandardContextValve.java:96)
> > at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
> > at
> > org.apache.catalina.authenticator.AuthenticatorBase.invoke(
> AuthenticatorBase.java:478)
> > at
> > org.apache.catalina.core.StandardHostValve.invoke(
> StandardHostValve.java:140)
> > at
> > org.apache.catalina.valves.ErrorReportValve.invoke(
> ErrorReportValve.java:80)
> > at
> > org.apache.tomee.catalina.OpenEJBSecurityListener$
> RequestCapturer.invoke(OpenEJBSecurityListener.java:97)
> > at
> > org.apache.catalina.valves.AbstractAccessLogValve.invoke(
> AbstractAccessLogValve.java:650)
> > at
> > org.apache.catalina.core.StandardEngineValve.invoke(
> StandardEngineValve.java:87)
> > at
> > org.apache.catalina.connector.CoyoteAdapter.service(
> CoyoteAdapter.java:342)
> > at
> > org.apache.coyote.http11.Http11Processor.service(
> Http11Processor.java:799)
> > at
> > org.apache.coyote.AbstractProcessorLight.process(
> AbstractProcessorLight.java:66)
> > at
> > org.apache.coyote.AbstractProtocol$ConnectionHandler.process(
> AbstractProtocol.java:868)
> > at
> > org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.
> doRun(NioEndpoint.java:1457)
> > at
> > org.apache.tomcat.util.net.SocketProcessorBase.run(
> SocketProcessorBase.java:49)
> > at
> > java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1149)
> > at
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:624)
> > at
> > org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(
> TaskThread.java:61)
> > at java.lang.Thread.run(Thread.java:748)
> > Caused by: java.security.UnrecoverableKeyException: failed to decrypt
> safe
> > contents entry: javax.crypto.BadPaddingException: pad block corrupted
> > ... 85 more
> >
> >
> > 2017-10-26 11:04 GMT-02:00 Romain Manni-Bucau <rm...@gmail.com>:
> >
> >> Hi Felipe,
> >>
> >> did you do a diff between tomee/lib and your WEB-INF/lib? we have some
> >> impacting changes in last release. Also what is the stack you get and
> >> the calling code if you can share it.
> >>
> >> Romain Manni-Bucau
> >> @rmannibucau |  Blog | Old Blog | Github | LinkedIn
> >>
> >>
> >> 2017-10-26 14:57 GMT+02:00 Felipe Jaekel <fk...@gmail.com>:
> >> > Hi,
> >> >
> >> > I have a webapp where the user can upload a PFX file to digitally sign
> >> PDF
> >> > files. After upgrading from 7.0.2 to 7.0.4 I'm getting this exception:
> >> >
> >> > java.security.UnrecoverableKeyException: failed to decrypt safe
> contents
> >> > entry: javax.crypto.BadPaddingException: pad block corrupted
> >> >
> >> > First I tough it was something related to the upload process, but even
> >> > after pointing to a local PFX file and hardcoding the password I still
> >> get
> >> > this exception on 7.0.4.
> >> >
> >> > ks = KeyStore.getInstance(KeyStore.getDefaultType());
> >> > ks.load(new FileInputStream("/home/fjaekel/Desktop/anima.pfx"),
> >> > "anima".toCharArray());
> >> >
> >> > Debugging on both servers the KeyStore provider is *SUN version 1.8*
> and
> >> > the type is *jks*. Tested with OpenJDK 64-Bit Server VM (build
> >> 25.111-b15,
> >> > mixed mode)  and Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12,
> >> mixed
> >> > mode).
> >> >
> >> > Any ideias?
> >> >
> >> > Thanks
> >>
>

Re: Problem with KeyStore.load() after upgrading from 7.0.2 to 7.0.4

Posted by Romain Manni-Bucau <rm...@gmail.com>.
hmm

maybe check the JVM environment through JMX (systems props in particular)

Romain Manni-Bucau
@rmannibucau |  Blog | Old Blog | Github | LinkedIn


2017-10-26 15:56 GMT+02:00 Felipe Jaekel <fk...@gmail.com>:
> I'm suspecting of Tomcat 8.5.20, but I'd like check first if is there
> something I can do on TomEE config
>
> *Stacktrace:*
> java.io.IOException: keystore password was incorrect
> at sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:2015)
> at
> sun.security.provider.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:238)
> at
> sun.security.provider.JavaKeyStore$DualFormatJKS.engineLoad(JavaKeyStore.java:70)
> at java.security.KeyStore.load(KeyStore.java:1445)
> at br.com.pacsweb.util.SignatureInterop.<init>(SignatureInterop.java:38)
> at
> br.com.pacsweb.service.AssinaturaLaudoService.persist(AssinaturaLaudoService.java:40)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205)
> at
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186)
> at
> org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181)
> at
> org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:100)
> at sun.reflect.GeneratedMethodAccessor245.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205)
> at
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186)
> at
> org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
> at
> org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:252)
> at
> org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:212)
> at
> org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:265)
> at
> org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:260)
> at
> org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:89)
> at
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:347)
> at
> br.com.pacsweb.service.AssinaturaLaudoService$$LocalBeanProxy.persist(br/com/spdata/pacsweb/service/AssinaturaLaudoService.java)
> at
> br.com.pacsweb.page.ImpressaoLaudoController.assinar(ImpressaoLaudoController.java:156)
> at
> br.com.pacsweb.page.ImpressaoLaudoController$$OwbNormalScopeProxy0.assinar(br/com/spdata/pacsweb/page/ImpressaoLaudoController.java)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.apache.el.parser.AstValue.invoke(AstValue.java:247)
> at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:267)
> at
> org.apache.webbeans.el22.WrappedMethodExpression.invoke(WrappedMethodExpression.java:52)
> at
> org.apache.myfaces.view.facelets.el.ContextAwareTagMethodExpression.invoke(ContextAwareTagMethodExpression.java:96)
> at
> org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
> at javax.faces.component.UICommand.broadcast(UICommand.java:120)
> at javax.faces.component.UIViewRoot._broadcastAll(UIViewRoot.java:1174)
> at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:365)
> at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1660)
> at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:864)
> at
> org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:42)
> at
> org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:196)
> at
> org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:143)
> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> at
> org.omnifaces.filter.CacheControlFilter.doFilter(CacheControlFilter.java:239)
> at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:108)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> at org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:65)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> at br.com.pacsweb.filter.LoginFilter.doFilter(LoginFilter.java:85)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> at
> org.omnifaces.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:124)
> at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:108)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
> at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
> at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
> at
> org.apache.tomee.catalina.OpenEJBSecurityListener$RequestCapturer.invoke(OpenEJBSecurityListener.java:97)
> at
> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
> at
> org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
> at
> org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
> at
> org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
> at
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1457)
> at
> org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> at java.lang.Thread.run(Thread.java:748)
> Caused by: java.security.UnrecoverableKeyException: failed to decrypt safe
> contents entry: javax.crypto.BadPaddingException: pad block corrupted
> ... 85 more
>
>
> 2017-10-26 11:04 GMT-02:00 Romain Manni-Bucau <rm...@gmail.com>:
>
>> Hi Felipe,
>>
>> did you do a diff between tomee/lib and your WEB-INF/lib? we have some
>> impacting changes in last release. Also what is the stack you get and
>> the calling code if you can share it.
>>
>> Romain Manni-Bucau
>> @rmannibucau |  Blog | Old Blog | Github | LinkedIn
>>
>>
>> 2017-10-26 14:57 GMT+02:00 Felipe Jaekel <fk...@gmail.com>:
>> > Hi,
>> >
>> > I have a webapp where the user can upload a PFX file to digitally sign
>> PDF
>> > files. After upgrading from 7.0.2 to 7.0.4 I'm getting this exception:
>> >
>> > java.security.UnrecoverableKeyException: failed to decrypt safe contents
>> > entry: javax.crypto.BadPaddingException: pad block corrupted
>> >
>> > First I tough it was something related to the upload process, but even
>> > after pointing to a local PFX file and hardcoding the password I still
>> get
>> > this exception on 7.0.4.
>> >
>> > ks = KeyStore.getInstance(KeyStore.getDefaultType());
>> > ks.load(new FileInputStream("/home/fjaekel/Desktop/anima.pfx"),
>> > "anima".toCharArray());
>> >
>> > Debugging on both servers the KeyStore provider is *SUN version 1.8* and
>> > the type is *jks*. Tested with OpenJDK 64-Bit Server VM (build
>> 25.111-b15,
>> > mixed mode)  and Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12,
>> mixed
>> > mode).
>> >
>> > Any ideias?
>> >
>> > Thanks
>>

Re: Problem with KeyStore.load() after upgrading from 7.0.2 to 7.0.4

Posted by Felipe Jaekel <fk...@gmail.com>.
I'm suspecting of Tomcat 8.5.20, but I'd like check first if is there
something I can do on TomEE config

*Stacktrace:*
java.io.IOException: keystore password was incorrect
at sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:2015)
at
sun.security.provider.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:238)
at
sun.security.provider.JavaKeyStore$DualFormatJKS.engineLoad(JavaKeyStore.java:70)
at java.security.KeyStore.load(KeyStore.java:1445)
at br.com.pacsweb.util.SignatureInterop.<init>(SignatureInterop.java:38)
at
br.com.pacsweb.service.AssinaturaLaudoService.persist(AssinaturaLaudoService.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186)
at
org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181)
at
org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:100)
at sun.reflect.GeneratedMethodAccessor245.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186)
at
org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
at
org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:252)
at
org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:212)
at
org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:265)
at
org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:260)
at
org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:89)
at
org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:347)
at
br.com.pacsweb.service.AssinaturaLaudoService$$LocalBeanProxy.persist(br/com/spdata/pacsweb/service/AssinaturaLaudoService.java)
at
br.com.pacsweb.page.ImpressaoLaudoController.assinar(ImpressaoLaudoController.java:156)
at
br.com.pacsweb.page.ImpressaoLaudoController$$OwbNormalScopeProxy0.assinar(br/com/spdata/pacsweb/page/ImpressaoLaudoController.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.el.parser.AstValue.invoke(AstValue.java:247)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:267)
at
org.apache.webbeans.el22.WrappedMethodExpression.invoke(WrappedMethodExpression.java:52)
at
org.apache.myfaces.view.facelets.el.ContextAwareTagMethodExpression.invoke(ContextAwareTagMethodExpression.java:96)
at
org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
at javax.faces.component.UICommand.broadcast(UICommand.java:120)
at javax.faces.component.UIViewRoot._broadcastAll(UIViewRoot.java:1174)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:365)
at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1660)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:864)
at
org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:42)
at
org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:196)
at
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:143)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at
org.omnifaces.filter.CacheControlFilter.doFilter(CacheControlFilter.java:239)
at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:108)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:65)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at br.com.pacsweb.filter.LoginFilter.doFilter(LoginFilter.java:85)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at
org.omnifaces.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:124)
at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:108)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
at
org.apache.tomee.catalina.OpenEJBSecurityListener$RequestCapturer.invoke(OpenEJBSecurityListener.java:97)
at
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
at
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1457)
at
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.security.UnrecoverableKeyException: failed to decrypt safe
contents entry: javax.crypto.BadPaddingException: pad block corrupted
... 85 more


2017-10-26 11:04 GMT-02:00 Romain Manni-Bucau <rm...@gmail.com>:

> Hi Felipe,
>
> did you do a diff between tomee/lib and your WEB-INF/lib? we have some
> impacting changes in last release. Also what is the stack you get and
> the calling code if you can share it.
>
> Romain Manni-Bucau
> @rmannibucau |  Blog | Old Blog | Github | LinkedIn
>
>
> 2017-10-26 14:57 GMT+02:00 Felipe Jaekel <fk...@gmail.com>:
> > Hi,
> >
> > I have a webapp where the user can upload a PFX file to digitally sign
> PDF
> > files. After upgrading from 7.0.2 to 7.0.4 I'm getting this exception:
> >
> > java.security.UnrecoverableKeyException: failed to decrypt safe contents
> > entry: javax.crypto.BadPaddingException: pad block corrupted
> >
> > First I tough it was something related to the upload process, but even
> > after pointing to a local PFX file and hardcoding the password I still
> get
> > this exception on 7.0.4.
> >
> > ks = KeyStore.getInstance(KeyStore.getDefaultType());
> > ks.load(new FileInputStream("/home/fjaekel/Desktop/anima.pfx"),
> > "anima".toCharArray());
> >
> > Debugging on both servers the KeyStore provider is *SUN version 1.8* and
> > the type is *jks*. Tested with OpenJDK 64-Bit Server VM (build
> 25.111-b15,
> > mixed mode)  and Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12,
> mixed
> > mode).
> >
> > Any ideias?
> >
> > Thanks
>

Re: Problem with KeyStore.load() after upgrading from 7.0.2 to 7.0.4

Posted by Felipe Jaekel <fk...@gmail.com>.
I'll try 7.0.5-SNAPSHOT and post the result

Thanks

2017-10-26 11:55 GMT-02:00 Adam Cornett <ad...@gmail.com>:

> I also had some issues with SSL cert loading when testing out 7.0.4.  It
> looked to be an issue with Tomcat, 7.0.5-SNAPSHOT (using a newer Tomcat
> version) doesn't have this issue.
>
> On Thu, Oct 26, 2017 at 9:04 AM, Romain Manni-Bucau <rmannibucau@gmail.com
> >
> wrote:
>
> > Hi Felipe,
> >
> > did you do a diff between tomee/lib and your WEB-INF/lib? we have some
> > impacting changes in last release. Also what is the stack you get and
> > the calling code if you can share it.
> >
> > Romain Manni-Bucau
> > @rmannibucau |  Blog | Old Blog | Github | LinkedIn
> >
> >
> > 2017-10-26 14:57 GMT+02:00 Felipe Jaekel <fk...@gmail.com>:
> > > Hi,
> > >
> > > I have a webapp where the user can upload a PFX file to digitally sign
> > PDF
> > > files. After upgrading from 7.0.2 to 7.0.4 I'm getting this exception:
> > >
> > > java.security.UnrecoverableKeyException: failed to decrypt safe
> contents
> > > entry: javax.crypto.BadPaddingException: pad block corrupted
> > >
> > > First I tough it was something related to the upload process, but even
> > > after pointing to a local PFX file and hardcoding the password I still
> > get
> > > this exception on 7.0.4.
> > >
> > > ks = KeyStore.getInstance(KeyStore.getDefaultType());
> > > ks.load(new FileInputStream("/home/fjaekel/Desktop/anima.pfx"),
> > > "anima".toCharArray());
> > >
> > > Debugging on both servers the KeyStore provider is *SUN version 1.8*
> and
> > > the type is *jks*. Tested with OpenJDK 64-Bit Server VM (build
> > 25.111-b15,
> > > mixed mode)  and Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12,
> > mixed
> > > mode).
> > >
> > > Any ideias?
> > >
> > > Thanks
> >
>
>
>
> --
> Adam Cornett
> adam.cornett@gmail.com
> (678) 296-1150
>

Re: Problem with KeyStore.load() after upgrading from 7.0.2 to 7.0.4

Posted by Adam Cornett <ad...@gmail.com>.
I also had some issues with SSL cert loading when testing out 7.0.4.  It
looked to be an issue with Tomcat, 7.0.5-SNAPSHOT (using a newer Tomcat
version) doesn't have this issue.

On Thu, Oct 26, 2017 at 9:04 AM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> Hi Felipe,
>
> did you do a diff between tomee/lib and your WEB-INF/lib? we have some
> impacting changes in last release. Also what is the stack you get and
> the calling code if you can share it.
>
> Romain Manni-Bucau
> @rmannibucau |  Blog | Old Blog | Github | LinkedIn
>
>
> 2017-10-26 14:57 GMT+02:00 Felipe Jaekel <fk...@gmail.com>:
> > Hi,
> >
> > I have a webapp where the user can upload a PFX file to digitally sign
> PDF
> > files. After upgrading from 7.0.2 to 7.0.4 I'm getting this exception:
> >
> > java.security.UnrecoverableKeyException: failed to decrypt safe contents
> > entry: javax.crypto.BadPaddingException: pad block corrupted
> >
> > First I tough it was something related to the upload process, but even
> > after pointing to a local PFX file and hardcoding the password I still
> get
> > this exception on 7.0.4.
> >
> > ks = KeyStore.getInstance(KeyStore.getDefaultType());
> > ks.load(new FileInputStream("/home/fjaekel/Desktop/anima.pfx"),
> > "anima".toCharArray());
> >
> > Debugging on both servers the KeyStore provider is *SUN version 1.8* and
> > the type is *jks*. Tested with OpenJDK 64-Bit Server VM (build
> 25.111-b15,
> > mixed mode)  and Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12,
> mixed
> > mode).
> >
> > Any ideias?
> >
> > Thanks
>



-- 
Adam Cornett
adam.cornett@gmail.com
(678) 296-1150

Re: Problem with KeyStore.load() after upgrading from 7.0.2 to 7.0.4

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi Felipe,

did you do a diff between tomee/lib and your WEB-INF/lib? we have some
impacting changes in last release. Also what is the stack you get and
the calling code if you can share it.

Romain Manni-Bucau
@rmannibucau |  Blog | Old Blog | Github | LinkedIn


2017-10-26 14:57 GMT+02:00 Felipe Jaekel <fk...@gmail.com>:
> Hi,
>
> I have a webapp where the user can upload a PFX file to digitally sign PDF
> files. After upgrading from 7.0.2 to 7.0.4 I'm getting this exception:
>
> java.security.UnrecoverableKeyException: failed to decrypt safe contents
> entry: javax.crypto.BadPaddingException: pad block corrupted
>
> First I tough it was something related to the upload process, but even
> after pointing to a local PFX file and hardcoding the password I still get
> this exception on 7.0.4.
>
> ks = KeyStore.getInstance(KeyStore.getDefaultType());
> ks.load(new FileInputStream("/home/fjaekel/Desktop/anima.pfx"),
> "anima".toCharArray());
>
> Debugging on both servers the KeyStore provider is *SUN version 1.8* and
> the type is *jks*. Tested with OpenJDK 64-Bit Server VM (build 25.111-b15,
> mixed mode)  and Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed
> mode).
>
> Any ideias?
>
> Thanks