StorageServiceAccountSample application reports “KeyStore JKS implementation not found”

↘锁芯ラ 提交于 2019-12-17 19:40:05

问题


The very first line of StorageServiceAccountSample

HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();

causes the "KeyStore JKS implementation not found":

W/System.err(20142): java.security.KeyStoreException: java.security.NoSuchAlgorithmException: KeyStore JKS implementation not found
W/System.err(20142):    at java.security.KeyStore.getInstance(KeyStore.java:119)
W/System.err(20142):    at com.google.api.client.util.SecurityUtils.getJavaKeyStore(SecurityUtils.java:48)
W/System.err(20142):    at com.google.api.client.googleapis.GoogleUtils.getCertificateTrustStore(GoogleUtils.java:74)
W/System.err(20142):    at com.google.api.client.googleapis.javanet.GoogleNetHttpTransport.newTrustedTransport(GoogleNetHttpTransport.java:55)

As I read Android doesn't support JKS, how should I modify this method to work around it?


回答1:


Replaced

HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();

with

HTTP_TRANSPORT = AndroidHttp.newCompatibleTransport();

and the problem went away.




回答2:


I've found an answer on google issue tracker.

Replace

HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();

with

HTTP_TRANSPORT = new com.google.api.client.http.javanet.NetHttpTransport()

But don't know, how it's working.



来源:https://stackoverflow.com/questions/18862779/storageserviceaccountsample-application-reports-keystore-jks-implementation-not

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!