Discussion:
Problem with KeyStore.load() after upgrading from 7.0.2 to 7.0.4
Felipe Jaekel
2017-10-26 12:57:35 UTC
Permalink
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
Romain Manni-Bucau
2017-10-26 13:04:19 UTC
Permalink
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
Post by Felipe Jaekel
Hi,
I have a webapp where the user can upload a PFX file to digitally sign PDF
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
2017-10-26 13:55:39 UTC
Permalink
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.
Post by Romain Manni-Bucau
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
Post by Felipe Jaekel
Hi,
I have a webapp where the user can upload a PFX file to digitally sign
PDF
Post by Felipe Jaekel
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
Post by Felipe Jaekel
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,
Post by Felipe Jaekel
mixed mode) and Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12,
mixed
Post by Felipe Jaekel
mode).
Any ideias?
Thanks
--
Adam Cornett
***@gmail.com
(678) 296-1150
Felipe Jaekel
2017-10-26 13:58:37 UTC
Permalink
I'll try 7.0.5-SNAPSHOT and post the result

Thanks
Post by Adam Cornett
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.
Post by Romain Manni-Bucau
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
Post by Felipe Jaekel
Hi,
I have a webapp where the user can upload a PFX file to digitally sign
PDF
Post by Felipe Jaekel
java.security.UnrecoverableKeyException: failed to decrypt safe
contents
Post by Romain Manni-Bucau
Post by Felipe Jaekel
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
Post by Felipe Jaekel
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
Post by Romain Manni-Bucau
Post by Felipe Jaekel
the type is *jks*. Tested with OpenJDK 64-Bit Server VM (build
25.111-b15,
Post by Felipe Jaekel
mixed mode) and Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12,
mixed
Post by Felipe Jaekel
mode).
Any ideias?
Thanks
--
Adam Cornett
(678) 296-1150
Felipe Jaekel
2017-10-26 13:56:20 UTC
Permalink
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
Post by Romain Manni-Bucau
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
Post by Felipe Jaekel
Hi,
I have a webapp where the user can upload a PFX file to digitally sign
PDF
Post by Felipe Jaekel
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
Post by Felipe Jaekel
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,
Post by Felipe Jaekel
mixed mode) and Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12,
mixed
Post by Felipe Jaekel
mode).
Any ideias?
Thanks
Romain Manni-Bucau
2017-10-26 13:59:36 UTC
Permalink
hmm

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

Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by Felipe Jaekel
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
Post by Romain Manni-Bucau
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
Post by Felipe Jaekel
Hi,
I have a webapp where the user can upload a PFX file to digitally sign
PDF
Post by Felipe Jaekel
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
Post by Felipe Jaekel
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,
Post by Felipe Jaekel
mixed mode) and Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12,
mixed
Post by Felipe Jaekel
mode).
Any ideias?
Thanks
Felipe Jaekel
2017-10-26 17:57:59 UTC
Permalink
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
Post by Romain Manni-Bucau
hmm
maybe check the JVM environment through JMX (systems props in particular)
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by Felipe Jaekel
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)
Post by Felipe Jaekel
at
sun.security.provider.KeyStoreDelegator.engineLoad(
KeyStoreDelegator.java:238)
Post by Felipe Jaekel
at
sun.security.provider.JavaKeyStore$DualFormatJKS.
engineLoad(JavaKeyStore.java:70)
Post by Felipe Jaekel
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)
Post by Felipe Jaekel
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:62)
Post by Felipe Jaekel
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
Post by Felipe Jaekel
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$
Invocation.invoke(ReflectionInvocationContext.java:205)
Post by Felipe Jaekel
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(
ReflectionInvocationContext.java:186)
Post by Felipe Jaekel
at
org.apache.openejb.monitoring.StatsInterceptor.record(
StatsInterceptor.java:181)
Post by Felipe Jaekel
at
org.apache.openejb.monitoring.StatsInterceptor.invoke(
StatsInterceptor.java:100)
Post by Felipe Jaekel
at sun.reflect.GeneratedMethodAccessor245.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
Post by Felipe Jaekel
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$
Invocation.invoke(ReflectionInvocationContext.java:205)
Post by Felipe Jaekel
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(
ReflectionInvocationContext.java:186)
Post by Felipe Jaekel
at
org.apache.openejb.core.interceptor.InterceptorStack.
invoke(InterceptorStack.java:85)
Post by Felipe Jaekel
at
org.apache.openejb.core.stateless.StatelessContainer._
invoke(StatelessContainer.java:252)
Post by Felipe Jaekel
at
org.apache.openejb.core.stateless.StatelessContainer.
invoke(StatelessContainer.java:212)
Post by Felipe Jaekel
at
org.apache.openejb.core.ivm.EjbObjectProxyHandler.
synchronizedBusinessMethod(EjbObjectProxyHandler.java:265)
Post by Felipe Jaekel
at
org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(
EjbObjectProxyHandler.java:260)
Post by Felipe Jaekel
at
org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(
EjbObjectProxyHandler.java:89)
Post by Felipe Jaekel
at
org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(
BaseEjbProxyHandler.java:347)
Post by Felipe Jaekel
at
br.com.pacsweb.service.AssinaturaLaudoService$$
LocalBeanProxy.persist(br/com/spdata/pacsweb/service/
AssinaturaLaudoService.java)
Post by Felipe Jaekel
at
br.com.pacsweb.page.ImpressaoLaudoController.assinar(
ImpressaoLaudoController.java:156)
Post by Felipe Jaekel
at
br.com.pacsweb.page.ImpressaoLaudoController$$
OwbNormalScopeProxy0.assinar(br/com/spdata/pacsweb/page/
ImpressaoLaudoController.java)
Post by Felipe Jaekel
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:62)
Post by Felipe Jaekel
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
Post by Felipe Jaekel
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)
Post by Felipe Jaekel
at
org.apache.webbeans.el22.WrappedMethodExpression.invoke(
WrappedMethodExpression.java:52)
Post by Felipe Jaekel
at
org.apache.myfaces.view.facelets.el.ContextAwareTagMethodExpressio
n.invoke(ContextAwareTagMethodExpression.java:96)
Post by Felipe Jaekel
at
org.apache.myfaces.application.ActionListenerImpl.processAction(
ActionListenerImpl.java:74)
Post by Felipe Jaekel
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)
Post by Felipe Jaekel
at
org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(
InvokeApplicationExecutor.java:42)
Post by Felipe Jaekel
at
org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(
LifecycleImpl.java:196)
Post by Felipe Jaekel
at
org.apache.myfaces.lifecycle.LifecycleImpl.execute(
LifecycleImpl.java:143)
Post by Felipe Jaekel
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:231)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:166)
Post by Felipe Jaekel
at
org.omnifaces.filter.CacheControlFilter.doFilter(
CacheControlFilter.java:239)
Post by Felipe Jaekel
at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:108)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:193)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:166)
Post by Felipe Jaekel
at org.apache.tomcat.websocket.server.WsFilter.doFilter(
WsFilter.java:52)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:193)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:166)
Post by Felipe Jaekel
at org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:65)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:193)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:166)
Post by Felipe Jaekel
at br.com.pacsweb.filter.LoginFilter.doFilter(LoginFilter.java:85)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:193)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:166)
Post by Felipe Jaekel
at
org.omnifaces.filter.CharacterEncodingFilter.doFilter(
CharacterEncodingFilter.java:124)
Post by Felipe Jaekel
at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:108)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:193)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:166)
Post by Felipe Jaekel
at
org.apache.catalina.core.StandardWrapperValve.invoke(
StandardWrapperValve.java:198)
Post by Felipe Jaekel
at
org.apache.catalina.core.StandardContextValve.invoke(
StandardContextValve.java:96)
Post by Felipe Jaekel
at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(
AuthenticatorBase.java:478)
Post by Felipe Jaekel
at
org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.java:140)
Post by Felipe Jaekel
at
org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.java:80)
Post by Felipe Jaekel
at
org.apache.tomee.catalina.OpenEJBSecurityListener$
RequestCapturer.invoke(OpenEJBSecurityListener.java:97)
Post by Felipe Jaekel
at
org.apache.catalina.valves.AbstractAccessLogValve.invoke(
AbstractAccessLogValve.java:650)
Post by Felipe Jaekel
at
org.apache.catalina.core.StandardEngineValve.invoke(
StandardEngineValve.java:87)
Post by Felipe Jaekel
at
org.apache.catalina.connector.CoyoteAdapter.service(
CoyoteAdapter.java:342)
Post by Felipe Jaekel
at
org.apache.coyote.http11.Http11Processor.service(
Http11Processor.java:799)
Post by Felipe Jaekel
at
org.apache.coyote.AbstractProcessorLight.process(
AbstractProcessorLight.java:66)
Post by Felipe Jaekel
at
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(
AbstractProtocol.java:868)
Post by Felipe Jaekel
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.
doRun(NioEndpoint.java:1457)
Post by Felipe Jaekel
at
org.apache.tomcat.util.net.SocketProcessorBase.run(
SocketProcessorBase.java:49)
Post by Felipe Jaekel
at
java.util.concurrent.ThreadPoolExecutor.runWorker(
ThreadPoolExecutor.java:1149)
Post by Felipe Jaekel
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(
ThreadPoolExecutor.java:624)
Post by Felipe Jaekel
at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(
TaskThread.java:61)
Post by Felipe Jaekel
at java.lang.Thread.run(Thread.java:748)
Caused by: java.security.UnrecoverableKeyException: failed to decrypt
safe
Post by Felipe Jaekel
contents entry: javax.crypto.BadPaddingException: pad block corrupted
... 85 more
Post by Romain Manni-Bucau
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
Post by Felipe Jaekel
Hi,
I have a webapp where the user can upload a PFX file to digitally sign
PDF
Post by Felipe Jaekel
java.security.UnrecoverableKeyException: failed to decrypt safe
contents
Post by Felipe Jaekel
Post by Romain Manni-Bucau
Post by Felipe Jaekel
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
Post by Felipe Jaekel
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
Post by Felipe Jaekel
Post by Romain Manni-Bucau
Post by Felipe Jaekel
the type is *jks*. Tested with OpenJDK 64-Bit Server VM (build
25.111-b15,
Post by Felipe Jaekel
mixed mode) and Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12,
mixed
Post by Felipe Jaekel
mode).
Any ideias?
Thanks
Romain Manni-Bucau
2017-10-26 19:18:37 UTC
Permalink
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
Post by Felipe Jaekel
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.runtime.VMVersionMismatchException: Supported versions are
25.151-b12. Target VM is 25.131-b11
Anything in particular I can check using jconsole?
Thanks
Post by Romain Manni-Bucau
hmm
maybe check the JVM environment through JMX (systems props in particular)
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by Felipe Jaekel
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)
Post by Felipe Jaekel
at
sun.security.provider.KeyStoreDelegator.engineLoad(
KeyStoreDelegator.java:238)
Post by Felipe Jaekel
at
sun.security.provider.JavaKeyStore$DualFormatJKS.
engineLoad(JavaKeyStore.java:70)
Post by Felipe Jaekel
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)
Post by Felipe Jaekel
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:62)
Post by Felipe Jaekel
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
Post by Felipe Jaekel
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$
Invocation.invoke(ReflectionInvocationContext.java:205)
Post by Felipe Jaekel
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(
ReflectionInvocationContext.java:186)
Post by Felipe Jaekel
at
org.apache.openejb.monitoring.StatsInterceptor.record(
StatsInterceptor.java:181)
Post by Felipe Jaekel
at
org.apache.openejb.monitoring.StatsInterceptor.invoke(
StatsInterceptor.java:100)
Post by Felipe Jaekel
at sun.reflect.GeneratedMethodAccessor245.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
Post by Felipe Jaekel
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$
Invocation.invoke(ReflectionInvocationContext.java:205)
Post by Felipe Jaekel
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(
ReflectionInvocationContext.java:186)
Post by Felipe Jaekel
at
org.apache.openejb.core.interceptor.InterceptorStack.
invoke(InterceptorStack.java:85)
Post by Felipe Jaekel
at
org.apache.openejb.core.stateless.StatelessContainer._
invoke(StatelessContainer.java:252)
Post by Felipe Jaekel
at
org.apache.openejb.core.stateless.StatelessContainer.
invoke(StatelessContainer.java:212)
Post by Felipe Jaekel
at
org.apache.openejb.core.ivm.EjbObjectProxyHandler.
synchronizedBusinessMethod(EjbObjectProxyHandler.java:265)
Post by Felipe Jaekel
at
org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(
EjbObjectProxyHandler.java:260)
Post by Felipe Jaekel
at
org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(
EjbObjectProxyHandler.java:89)
Post by Felipe Jaekel
at
org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(
BaseEjbProxyHandler.java:347)
Post by Felipe Jaekel
at
br.com.pacsweb.service.AssinaturaLaudoService$$
LocalBeanProxy.persist(br/com/spdata/pacsweb/service/
AssinaturaLaudoService.java)
Post by Felipe Jaekel
at
br.com.pacsweb.page.ImpressaoLaudoController.assinar(
ImpressaoLaudoController.java:156)
Post by Felipe Jaekel
at
br.com.pacsweb.page.ImpressaoLaudoController$$
OwbNormalScopeProxy0.assinar(br/com/spdata/pacsweb/page/
ImpressaoLaudoController.java)
Post by Felipe Jaekel
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:62)
Post by Felipe Jaekel
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
Post by Felipe Jaekel
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)
Post by Felipe Jaekel
at
org.apache.webbeans.el22.WrappedMethodExpression.invoke(
WrappedMethodExpression.java:52)
Post by Felipe Jaekel
at
org.apache.myfaces.view.facelets.el.ContextAwareTagMethodExpressio
n.invoke(ContextAwareTagMethodExpression.java:96)
Post by Felipe Jaekel
at
org.apache.myfaces.application.ActionListenerImpl.processAction(
ActionListenerImpl.java:74)
Post by Felipe Jaekel
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)
Post by Felipe Jaekel
at
org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(
InvokeApplicationExecutor.java:42)
Post by Felipe Jaekel
at
org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(
LifecycleImpl.java:196)
Post by Felipe Jaekel
at
org.apache.myfaces.lifecycle.LifecycleImpl.execute(
LifecycleImpl.java:143)
Post by Felipe Jaekel
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:231)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:166)
Post by Felipe Jaekel
at
org.omnifaces.filter.CacheControlFilter.doFilter(
CacheControlFilter.java:239)
Post by Felipe Jaekel
at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:108)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:193)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:166)
Post by Felipe Jaekel
at org.apache.tomcat.websocket.server.WsFilter.doFilter(
WsFilter.java:52)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:193)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:166)
Post by Felipe Jaekel
at org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:65)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:193)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:166)
Post by Felipe Jaekel
at br.com.pacsweb.filter.LoginFilter.doFilter(LoginFilter.java:85)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:193)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:166)
Post by Felipe Jaekel
at
org.omnifaces.filter.CharacterEncodingFilter.doFilter(
CharacterEncodingFilter.java:124)
Post by Felipe Jaekel
at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:108)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:193)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:166)
Post by Felipe Jaekel
at
org.apache.catalina.core.StandardWrapperValve.invoke(
StandardWrapperValve.java:198)
Post by Felipe Jaekel
at
org.apache.catalina.core.StandardContextValve.invoke(
StandardContextValve.java:96)
Post by Felipe Jaekel
at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:44)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(
AuthenticatorBase.java:478)
Post by Felipe Jaekel
at
org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.java:140)
Post by Felipe Jaekel
at
org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.java:80)
Post by Felipe Jaekel
at
org.apache.tomee.catalina.OpenEJBSecurityListener$
RequestCapturer.invoke(OpenEJBSecurityListener.java:97)
Post by Felipe Jaekel
at
org.apache.catalina.valves.AbstractAccessLogValve.invoke(
AbstractAccessLogValve.java:650)
Post by Felipe Jaekel
at
org.apache.catalina.core.StandardEngineValve.invoke(
StandardEngineValve.java:87)
Post by Felipe Jaekel
at
org.apache.catalina.connector.CoyoteAdapter.service(
CoyoteAdapter.java:342)
Post by Felipe Jaekel
at
org.apache.coyote.http11.Http11Processor.service(
Http11Processor.java:799)
Post by Felipe Jaekel
at
org.apache.coyote.AbstractProcessorLight.process(
AbstractProcessorLight.java:66)
Post by Felipe Jaekel
at
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(
AbstractProtocol.java:868)
Post by Felipe Jaekel
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.
doRun(NioEndpoint.java:1457)
Post by Felipe Jaekel
at
org.apache.tomcat.util.net.SocketProcessorBase.run(
SocketProcessorBase.java:49)
Post by Felipe Jaekel
at
java.util.concurrent.ThreadPoolExecutor.runWorker(
ThreadPoolExecutor.java:1149)
Post by Felipe Jaekel
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(
ThreadPoolExecutor.java:624)
Post by Felipe Jaekel
at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(
TaskThread.java:61)
Post by Felipe Jaekel
at java.lang.Thread.run(Thread.java:748)
Caused by: java.security.UnrecoverableKeyException: failed to decrypt
safe
Post by Felipe Jaekel
contents entry: javax.crypto.BadPaddingException: pad block corrupted
... 85 more
Post by Romain Manni-Bucau
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
Post by Felipe Jaekel
Hi,
I have a webapp where the user can upload a PFX file to digitally sign
PDF
Post by Felipe Jaekel
java.security.UnrecoverableKeyException: failed to decrypt safe
contents
Post by Felipe Jaekel
Post by Romain Manni-Bucau
Post by Felipe Jaekel
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
Post by Felipe Jaekel
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
Post by Felipe Jaekel
Post by Romain Manni-Bucau
Post by Felipe Jaekel
the type is *jks*. Tested with OpenJDK 64-Bit Server VM (build
25.111-b15,
Post by Felipe Jaekel
mixed mode) and Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12,
mixed
Post by Felipe Jaekel
mode).
Any ideias?
Thanks
Felipe Jaekel
2017-10-31 11:02:25 UTC
Permalink
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?
Post by Romain Manni-Bucau
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
Post by Felipe Jaekel
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.runtime.VMVersionMismatchException: Supported versions
are
Post by Felipe Jaekel
25.151-b12. Target VM is 25.131-b11
Anything in particular I can check using jconsole?
Thanks
Post by Romain Manni-Bucau
hmm
maybe check the JVM environment through JMX (systems props in
particular)
Post by Felipe Jaekel
Post by Romain Manni-Bucau
Romain Manni-Bucau
@rmannibucau | Blog | Old Blog | Github | LinkedIn
Post by Felipe Jaekel
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)
Post by Felipe Jaekel
at
sun.security.provider.KeyStoreDelegator.engineLoad(
KeyStoreDelegator.java:238)
Post by Felipe Jaekel
at
sun.security.provider.JavaKeyStore$DualFormatJKS.
engineLoad(JavaKeyStore.java:70)
Post by Felipe Jaekel
at java.security.KeyStore.load(KeyStore.java:1445)
at br.com.pacsweb.util.SignatureInterop.<init>(
SignatureInterop.java:38)
Post by Felipe Jaekel
Post by Romain Manni-Bucau
Post by Felipe Jaekel
at
br.com.pacsweb.service.AssinaturaLaudoService.persist(
AssinaturaLaudoService.java:40)
Post by Felipe Jaekel
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:62)
Post by Felipe Jaekel
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
Post by Felipe Jaekel
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$
Invocation.invoke(ReflectionInvocationContext.java:205)
Post by Felipe Jaekel
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.
proceed(
Post by Felipe Jaekel
Post by Romain Manni-Bucau
ReflectionInvocationContext.java:186)
Post by Felipe Jaekel
at
org.apache.openejb.monitoring.StatsInterceptor.record(
StatsInterceptor.java:181)
Post by Felipe Jaekel
at
org.apache.openejb.monitoring.StatsInterceptor.invoke(
StatsInterceptor.java:100)
Post by Felipe Jaekel
at sun.reflect.GeneratedMethodAccessor245.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
Post by Felipe Jaekel
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$
Invocation.invoke(ReflectionInvocationContext.java:205)
Post by Felipe Jaekel
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.
proceed(
Post by Felipe Jaekel
Post by Romain Manni-Bucau
ReflectionInvocationContext.java:186)
Post by Felipe Jaekel
at
org.apache.openejb.core.interceptor.InterceptorStack.
invoke(InterceptorStack.java:85)
Post by Felipe Jaekel
at
org.apache.openejb.core.stateless.StatelessContainer._
invoke(StatelessContainer.java:252)
Post by Felipe Jaekel
at
org.apache.openejb.core.stateless.StatelessContainer.
invoke(StatelessContainer.java:212)
Post by Felipe Jaekel
at
org.apache.openejb.core.ivm.EjbObjectProxyHandler.
synchronizedBusinessMethod(EjbObjectProxyHandler.java:265)
Post by Felipe Jaekel
at
org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(
EjbObjectProxyHandler.java:260)
Post by Felipe Jaekel
at
org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(
EjbObjectProxyHandler.java:89)
Post by Felipe Jaekel
at
org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(
BaseEjbProxyHandler.java:347)
Post by Felipe Jaekel
at
br.com.pacsweb.service.AssinaturaLaudoService$$
LocalBeanProxy.persist(br/com/spdata/pacsweb/service/
AssinaturaLaudoService.java)
Post by Felipe Jaekel
at
br.com.pacsweb.page.ImpressaoLaudoController.assinar(
ImpressaoLaudoController.java:156)
Post by Felipe Jaekel
at
br.com.pacsweb.page.ImpressaoLaudoController$$
OwbNormalScopeProxy0.assinar(br/com/spdata/pacsweb/page/
ImpressaoLaudoController.java)
Post by Felipe Jaekel
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:62)
Post by Felipe Jaekel
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
Post by Felipe Jaekel
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)
Post by Felipe Jaekel
at
org.apache.webbeans.el22.WrappedMethodExpression.invoke(
WrappedMethodExpression.java:52)
Post by Felipe Jaekel
at
org.apache.myfaces.view.facelets.el.ContextAwareTagMethodExpressio
n.invoke(ContextAwareTagMethodExpression.java:96)
Post by Felipe Jaekel
at
org.apache.myfaces.application.ActionListenerImpl.processAction(
ActionListenerImpl.java:74)
Post by Felipe Jaekel
at javax.faces.component.UICommand.broadcast(UICommand.java:120)
at javax.faces.component.UIViewRoot._broadcastAll(
UIViewRoot.java:1174)
Post by Felipe Jaekel
Post by Romain Manni-Bucau
Post by Felipe Jaekel
at javax.faces.component.UIViewRoot.broadcastEvents(
UIViewRoot.java:365)
Post by Felipe Jaekel
Post by Romain Manni-Bucau
Post by Felipe Jaekel
at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1660)
at javax.faces.component.UIViewRoot.processApplication(
UIViewRoot.java:864)
Post by Felipe Jaekel
at
org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(
InvokeApplicationExecutor.java:42)
Post by Felipe Jaekel
at
org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(
LifecycleImpl.java:196)
Post by Felipe Jaekel
at
org.apache.myfaces.lifecycle.LifecycleImpl.execute(
LifecycleImpl.java:143)
Post by Felipe Jaekel
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:231)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:166)
Post by Felipe Jaekel
at
org.omnifaces.filter.CacheControlFilter.doFilter(
CacheControlFilter.java:239)
Post by Felipe Jaekel
at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:108)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:193)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:166)
Post by Felipe Jaekel
at org.apache.tomcat.websocket.server.WsFilter.doFilter(
WsFilter.java:52)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:193)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:166)
Post by Felipe Jaekel
at org.apache.openejb.server.httpd.EEFilter.doFilter(
EEFilter.java:65)
Post by Felipe Jaekel
Post by Romain Manni-Bucau
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:193)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:166)
Post by Felipe Jaekel
at br.com.pacsweb.filter.LoginFilter.doFilter(LoginFilter.java:85)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:193)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:166)
Post by Felipe Jaekel
at
org.omnifaces.filter.CharacterEncodingFilter.doFilter(
CharacterEncodingFilter.java:124)
Post by Felipe Jaekel
at org.omnifaces.filter.HttpFilter.doFilter(HttpFilter.java:108)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
ApplicationFilterChain.java:193)
Post by Felipe Jaekel
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(
ApplicationFilterChain.java:166)
Post by Felipe Jaekel
at
org.apache.catalina.core.StandardWrapperValve.invoke(
StandardWrapperValve.java:198)
Post by Felipe Jaekel
at
org.apache.catalina.core.StandardContextValve.invoke(
StandardContextValve.java:96)
Post by Felipe Jaekel
at org.apache.tomee.catalina.OpenEJBValve.invoke(
OpenEJBValve.java:44)
Post by Felipe Jaekel
Post by Romain Manni-Bucau
Post by Felipe Jaekel
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(
AuthenticatorBase.java:478)
Post by Felipe Jaekel
at
org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.java:140)
Post by Felipe Jaekel
at
org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.java:80)
Post by Felipe Jaekel
at
org.apache.tomee.catalina.OpenEJBSecurityListener$
RequestCapturer.invoke(OpenEJBSecurityListener.java:97)
Post by Felipe Jaekel
at
org.apache.catalina.valves.AbstractAccessLogValve.invoke(
AbstractAccessLogValve.java:650)
Post by Felipe Jaekel
at
org.apache.catalina.core.StandardEngineValve.invoke(
StandardEngineValve.java:87)
Post by Felipe Jaekel
at
org.apache.catalina.connector.CoyoteAdapter.service(
CoyoteAdapter.java:342)
Post by Felipe Jaekel
at
org.apache.coyote.http11.Http11Processor.service(
Http11Processor.java:799)
Post by Felipe Jaekel
at
org.apache.coyote.AbstractProcessorLight.process(
AbstractProcessorLight.java:66)
Post by Felipe Jaekel
at
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(
AbstractProtocol.java:868)
Post by Felipe Jaekel
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.
doRun(NioEndpoint.java:1457)
Post by Felipe Jaekel
at
org.apache.tomcat.util.net.SocketProcessorBase.run(
SocketProcessorBase.java:49)
Post by Felipe Jaekel
at
java.util.concurrent.ThreadPoolExecutor.runWorker(
ThreadPoolExecutor.java:1149)
Post by Felipe Jaekel
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(
ThreadPoolExecutor.java:624)
Post by Felipe Jaekel
at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(
TaskThread.java:61)
Post by Felipe Jaekel
at java.lang.Thread.run(Thread.java:748)
Caused by: java.security.UnrecoverableKeyException: failed to decrypt
safe
Post by Felipe Jaekel
contents entry: javax.crypto.BadPaddingException: pad block corrupted
... 85 more
Post by Romain Manni-Bucau
Hi Felipe,
did you do a diff between tomee/lib and your WEB-INF/lib? we have
some
Post by Felipe Jaekel
Post by Romain Manni-Bucau
Post by Felipe Jaekel
Post by Romain Manni-Bucau
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
Post by Felipe Jaekel
Hi,
I have a webapp where the user can upload a PFX file to digitally
sign
Post by Felipe Jaekel
Post by Romain Manni-Bucau
Post by Felipe Jaekel
Post by Romain Manni-Bucau
PDF
Post by Felipe Jaekel
files. After upgrading from 7.0.2 to 7.0.4 I'm getting this
java.security.UnrecoverableKeyException: failed to decrypt safe
contents
Post by Felipe Jaekel
Post by Romain Manni-Bucau
Post by Felipe Jaekel
entry: javax.crypto.BadPaddingException: pad block corrupted
First I tough it was something related to the upload process, but
even
Post by Felipe Jaekel
Post by Romain Manni-Bucau
Post by Felipe Jaekel
Post by Romain Manni-Bucau
Post by Felipe Jaekel
after pointing to a local PFX file and hardcoding the password I
still
Post by Felipe Jaekel
Post by Romain Manni-Bucau
Post by Felipe Jaekel
Post by Romain Manni-Bucau
get
Post by Felipe Jaekel
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*
Post by Felipe Jaekel
Post by Romain Manni-Bucau
and
Post by Felipe Jaekel
Post by Romain Manni-Bucau
Post by Felipe Jaekel
the type is *jks*. Tested with OpenJDK 64-Bit Server VM (build
25.111-b15,
Post by Felipe Jaekel
mixed mode) and Java HotSpot(TM) 64-Bit Server VM (build
25.151-b12,
Post by Felipe Jaekel
Post by Romain Manni-Bucau
Post by Felipe Jaekel
Post by Romain Manni-Bucau
mixed
Post by Felipe Jaekel
mode).
Any ideias?
Thanks
Loading...