Как настроить хранилище ключей в java ploicy
Я настроил хранилище ключей в файле java.plocy следующим образом
keystore "file:/C:/Users/spin/Desktop/publickey.jks", "jks", "SUN";
grant signedBy "publick", codeBase "file:/C:/Users/spin/Desktop/sJavaservice-0.0.1-SNAPSHOT.jar" {
permission java.security.AllPermission;
permission java.lang.RuntimePermission "getProtectionDomain";
permission java.lang.RuntimePermission "accessClassInPackage.org.apache.*";
permission java.lang.RuntimePermission "accessClassInPackage.sun.*";
permission java.lang.RuntimePermission "loadLibrary.libtcnative-1";
permission java.lang.RuntimePermission "loadLibrary.management";
permission java.lang.RuntimePermission "loadLibrary.net";
permission java.lang.RuntimePermission "loadLibrary.tcnative-1";
permission java.lang.RuntimePermission "modifyThread";
permission java.lang.RuntimePermission "modifyThreadGroup";
permission java.lang.RuntimePermission "createSecurityManager";
permission java.lang.RuntimePermission "setIO";
permission java.lang.RuntimePermission "shutdownHooks";
permission java.net.SocketPermission "*", "listen, resolve, connect, accept";
permission java.security.SecurityPermission "createAccessControlContext";
permission java.security.SecurityPermission "getDomainCombiner";
permission java.security.SecurityPermission "getPolicy";
permission java.security.SecurityPermission "getProperty.*";
permission java.security.SecurityPermission "insertProvider.SUN";
permission java.security.SecurityPermission "putProviderProperty.SUN";
permission java.security.SecurityPermission "setPolicy";
permission java.security.SecurityPermission "setProperty.package.access";
permission java.security.SecurityPermission "setProperty.package.definition";
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
permission java.util.PropertyPermission "spring.profiles.active", "read";
permission java.util.PropertyPermission "environmentType", "write";
permission java.util.PropertyPermission "java.protocol.handler.pkgs", "read,write";
permission java.lang.RuntimePermission "setFactory";
permission java.net.NetPermission "specifyStreamHandler";
permission java.lang.RuntimePermission "createClassLoader";
permission java.lang.RuntimePermission "getClassLoader";
permission java.lang.RuntimePermission "setContextClassLoader";
permission java.lang.RuntimePermission "accessDeclaredMembers";
permission java.util.logging.LoggingPermission "control";
permission javax.security.auth.AuthPermission "refreshLoginConfiguration";
permission javax.security.auth.AuthPermission "setLoginConfiguration";
permission javax.management.MBeanServerPermission "createMBeanServer";
permission javax.management.MBeanServerPermission "findMBeanServer";
permission javax.management.MBeanServerPermission "newMBeanServer";
permission javax.management.MBeanTrustPermission "register";
permission javax.management.MBeanPermission "*", "*";
permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
permission javax.security.auth.AuthPermission "doAsPrivileged";
permission java.lang.RuntimePermission "getenv.*";
};
Инструмент политики выдает следующее исключение: предупреждение, что открытый ключ для псевдонима не существует, убедитесь, что хранилище ключей настроено правильно
когда я запускаю java-приложение, выдает следующую команду исключения для запуска java-приложения
java -Djava.security.manager -Djava.security.policy=java.policy -jar sJavaservice-0.0.1-SNAPSHOT.jar
Следующее исключение:
Exception in thread "main" java.lang.IllegalStateException: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "getProtectionDomain")
at org.springframework.boot.loader.ExecutableArchiveLauncher.<init>(ExecutableArchiveLauncher.java:42)
at org.springframework.boot.loader.JarLauncher.<init>(JarLauncher.java:36)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "getProtectionDomain")
at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.base/java.security.AccessController.checkPermission(AccessController.java:897)
at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:322)
at java.base/java.lang.Class.getProtectionDomain(Class.java:2797)
at org.springframework.boot.loader.Launcher.createArchive(Launcher.java:116)
at org.springframework.boot.loader.ExecutableArchiveLauncher.<init>(ExecutableArchiveLauncher.java:39)
... 2 more