1
我为DFA报告开发了一个简单的HTML5-客户端。为此,我使用Google OAuth服务帐户,该帐户在客户端解决方案上运行得非常好。但是当我想在我的Webapplication-Backend中读取.p12-File时,知道我遇到了麻烦。出现以下问题:在Java-Web应用程序中使用oauth2服务帐户
java.io.IOException: DerInputStream.getLength(): lengthTag=111, too big.
at sun.security.util.DerInputStream.getLength(DerInputStream.java:561)
应用程序的嵌入式的Tomcat(春季启动)运行,我用下面的方法读取到文件:
File p12File = new java.io.File(this.getClass().getResource("/test-privatekey.p12").toURI());
this.httpTransport = GoogleNetHttpTransport.newTrustedTransport();
credential = new GoogleCredential.Builder().setTransport(httpTransport)
.setJsonFactory(JSON_FACTORY)
.setServiceAccountId(SERVICE_ACCOUNT_EMAIL)
.setServiceAccountScopes(SCOPES)
.setServiceAccountPrivateKeyFromP12File(p12File)
.build();
的客户的解决方案看P12-像这样的文件:
File p12File = new java.io.File("test-privatekey.p12");
有没有人有解决方案,或解决方案的想法这个问题?
来自柏林的许多感谢和问候