0
我有一個問題,我嘗試使用帶生成的.p12鍵的ouath2與谷歌API進行身份驗證。PBE AlgorithmParameters not available
問題是,當谷歌證書API嘗試設置.p12鍵時拋出 java.io.IOException:parseAlgParameters失敗:PBE AlgorithmParameters不可用。
我的機器運行Windows 10 Home 64位創作者更新,我安裝了jdk 1.6。 我試圖從netbeans和intellij想法啓動項目兩個issuse是相同的。我的同事從linux啓動項目,一切正常。我也嘗試將jce策略設置爲無限制。
這裏是一個堆棧跟蹤轉儲
Error during init Google Play API
java.io.IOException: parseAlgParameters failed: PBE AlgorithmParameters not available
at com.sun.net.ssl.internal.pkcs12.PKCS12KeyStore.parseAlgParameters(PKCS12KeyStore.java:527)
at com.sun.net.ssl.internal.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1267)
at java.security.KeyStore.load(KeyStore.java:1185)
at com.google.api.client.util.SecurityUtils.loadKeyStore(SecurityUtils.java:77)
at com.google.api.client.util.SecurityUtils.loadPrivateKeyFromKeyStore(SecurityUtils.java:110)
at com.google.api.client.googleapis.auth.oauth2.GoogleCredential$Builder.setServiceAccountPrivateKeyFromP12File(GoogleCredential.java:670)
at com.iapps.pdf_platform.payment.AndroidPublisherHelper.authorizeWithServiceAccount(AndroidPublisherHelper.java:70)
at com.iapps.pdf_platform.payment.AndroidPublisherHelper.init(AndroidPublisherHelper.java:91)
at com.iapps.pdf_platform.payment.GooglePlayPaymentVerification.checkGooglePurchase(GooglePlayPaymentVerification.java:110)
at com.iapps.pdf_platform.payment.GooglePlayPaymentVerification.veriifyForService(GooglePlayPaymentVerification.java:96)
at com.iapps.pdf_platform.service.GooglePlayPaymentVerificationService.verifyPurchase(GooglePlayPaymentVerificationService.java:102)
at com.iapps.pdf_platform.service.GooglePlayPaymentVerificationService.verfifyGooglePlayPayments(GooglePlayPaymentVerificationService.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1056)
at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1128)
at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5292)
at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:615)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:567)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:157)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:139)
at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:858)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:367)
at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5264)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5252)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:190)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:84)
at com.sun.proxy.$Proxy311.verfifyGooglePlayPayments(Unknown Source)
at com.iapps.pdf_platform.service.__EJB31_Generated__GooglePlayPaymentVerificationService__Intf____Bean__.verfifyGooglePlayPayments(Unknown Source)
at com.iapps.pdf_platform.servlet.Tests.doGet(Tests.java:53)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.security.NoSuchAlgorithmException: PBE AlgorithmParameters not available
at sun.security.jca.GetInstance.getInstance(GetInstance.java:142)
at java.security.Security.getImpl(Security.java:659)
at java.security.AlgorithmParameters.getInstance(AlgorithmParameters.java:113)
at com.sun.net.ssl.internal.pkcs12.PKCS12KeyStore.parseAlgParameters(PKCS12KeyStore.java:523)
... 62 more
中.P12關鍵是使用BC提供商
Keystore type: PKCS12
Keystore provider: BC
Your keystore contains 1 entry
privatekey, 2017-07-10, PrivateKeyEntry,
May Java 1.6可能是問題嗎?你的同事是否使用相同的版本? – Henry
不,我認爲這是有彈性的城堡供應商問題,因爲供應商是在jdk中配置的,但未在應用程序中加載。 –
Jdk6是非常舊的版本。最新版本的Jdk修復了很多問題。您應該升級並嘗試一次。 – Fairoz