I am trying to read a P12 key on App Engine ( Google ) They key is located in WEB-INF directory.
Currently I have this code :
Credential credential = new GoogleCredential.Builder()
.setTransport(httpTransport)
.setJsonFactory(jsonFactory)
.setServiceAccountId(ACCOUNT_ID_PROPERTY)
.setServiceAccountPrivateKeyFromP12File(
new File("/WEB-INF/key.p12"))
.setServiceAccountScopes(scopes).build();
But it's returning me this error :
java.security.AccessControlException: access denied ("java.io.FilePermission" "\WEB-INF\key.p12" "read")
Any idea's to fix this ?
Thanks !
Please remove the forward slash from the path. Provide new File("WEB-INF/key.p12")
and it should get through.