Microsft Azure installing Java Cryptography Extension (JCE)

拟墨画扇 提交于 2019-12-25 07:26:25

问题


I have a Java 8 Wep App on Azure.

I am using the default JRE build in application settings for the webapp. I am running on Tomcat.

I am having trouble installing Java Cryptography Extension to handle some encryption. I dont have access to Java Home to install it, I can only upload the WAR files to web app.

Does anyone know how to install JCE on Azure?

Thanks! Fab


回答1:


For people who are still having trouble with this I share my solution by example:

  1. Copy JDK from D:\Program Files (x86)\Java\jdk1.8.0_111 to D:\home\site\jdk1.8.0_111
  2. Download and extract jce policy files from: http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html
  3. copy files local_policy.jar and US_export_policy.jar to D:\home\site\jdk1.8\jre\lib\security (replace existing files)
  4. Set application setting in Azure portal: JRE_HOME = D:/home/site/jdk1.8.0_111/jre
  5. Now the JDK has JCE enabled. The "Java minor version" selected in the Azure portal is no longer used or this App Service.



回答2:


On Azure Webapp, you only have the operation permission for the path D:\home\, but no permission for the others include %JAVA_HOME% and Apache Tomcat at the path D:\Program Files (x86)\.

Generally for using some packages, you can directly import these jar files into the directory WEB-INF\lib of the project or the war file. This way is only effective for the current project, and it's safe for the others to avoid clash.

For the file structure of the path D:\home, you can refer to the wiki page https://github.com/projectkudu/kudu/wiki/File-structure-on-azure to know.

However, according to the doc README.txt in the JCE, it seems to be not possible for installing on Azure Webapp, so I think you can try to use other cryptography packages instead of JCE for your app, such as apache commons codec.



来源:https://stackoverflow.com/questions/37425798/microsft-azure-installing-java-cryptography-extension-jce

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