Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
b1916456
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b1916456
编写于
11月 09, 2016
作者:
C
coffeys
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8157561: Ship the unlimited policy files in JDK Updates
Reviewed-by: wetmore, erikj
上级
8cc231ae
变更
13
显示空白变更内容
内联
并排
Showing
13 changed file
with
627 addition
and
45 deletion
+627
-45
make/CopyFiles.gmk
make/CopyFiles.gmk
+12
-9
make/CreateSecurityJars.gmk
make/CreateSecurityJars.gmk
+25
-20
make/Tools.gmk
make/Tools.gmk
+5
-2
make/profile-includes.txt
make/profile-includes.txt
+9
-5
make/src/classes/build/tools/customizesecurityfile/AddToRestrictedPkgs.java
...uild/tools/customizesecurityfile/AddToRestrictedPkgs.java
+2
-2
make/src/classes/build/tools/customizesecurityfile/CryptoLevel.java
...lasses/build/tools/customizesecurityfile/CryptoLevel.java
+85
-0
src/share/classes/javax/crypto/JceSecurity.java
src/share/classes/javax/crypto/JceSecurity.java
+68
-7
src/share/lib/security/java.security-aix
src/share/lib/security/java.security-aix
+65
-0
src/share/lib/security/java.security-linux
src/share/lib/security/java.security-linux
+65
-0
src/share/lib/security/java.security-macosx
src/share/lib/security/java.security-macosx
+65
-0
src/share/lib/security/java.security-solaris
src/share/lib/security/java.security-solaris
+65
-0
src/share/lib/security/java.security-windows
src/share/lib/security/java.security-windows
+65
-0
test/javax/crypto/CryptoPermission/TestUnlimited.java
test/javax/crypto/CryptoPermission/TestUnlimited.java
+96
-0
未找到文件。
make/CopyFiles.gmk
浏览文件 @
b1916456
#
# Copyright (c) 2011, 201
5
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 201
6
, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
...
...
@@ -357,18 +357,21 @@ ifndef OPENJDK
RESTRICTED_PKGS_SRC := $(JDK_TOPDIR)/src/closed/share/lib/security/restricted.pkgs
RESTRICTED_PKGS := $(shell $(CAT) $(RESTRICTED_PKGS_SRC) | $(TR) "\n" " ")
endif
$(PROPS_DST): $(PROPS_SRC)
$(MKDIR) -p $(@D)
ifndef OPENJDK
$(TOOL_ADDTORESTRICTEDPKGS) $^ $@.tmp $(RESTRICTED_PKGS)
else
$(CP) $^ $@.tmp
endif
ifeq ($(UNLIMITED_CRYPTO), true)
$(TOOL_CRYPTOLEVEL) $@.tmp $@.tmp2 unlimited
$(MV) $@.tmp2 $@.tmp
endif
$(MV) $@.tmp $@
else
$(PROPS_DST): $(PROPS_SRC)
$(call install-file)
endif
COPY_FILES += $(PROPS_DST)
##########################################################################################
...
...
make/CreateSecurityJars.gmk
浏览文件 @
b1916456
#
# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013,
2016,
Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
...
...
@@ -178,7 +178,10 @@ TARGETS += $(JCE_JAR_DST)
##########################################################################################
US_EXPORT_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar
US_EXPORT_POLICY_JAR_UNLIMITED_DST := \
$(JDK_OUTPUTDIR)/lib/security/policy/unlimited/US_export_policy.jar
US_EXPORT_POLICY_JAR_LIMITED_DST := \
$(JDK_OUTPUTDIR)/lib/security/policy/limited/US_export_policy.jar
ifneq ($(BUILD_CRYPTO), no)
...
...
@@ -220,27 +223,29 @@ ifneq ($(BUILD_CRYPTO), no)
endif
ifndef OPENJDK
ifeq ($(UNLIMITED_CRYPTO), true)
$(error No prebuilt unlimited crypto jars available)
endif
$(US_EXPORT_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/US_export_policy.jar
$(US_EXPORT_POLICY_JAR_UNLIMITED_DST): \
$(JDK_TOPDIR)/make/closed/tools/crypto/jce/unlimited/US_export_policy.jar
$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
$(install-file)
$(US_EXPORT_POLICY_JAR_LIMITED_DST): \
$(JDK_TOPDIR)/make/closed/tools/crypto/jce/limited/US_export_policy.jar
$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
$(install-file)
else
ifeq ($(UNLIMITED_CRYPTO), true)
$(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
$(US_EXPORT_POLICY_JAR_UNLIMITED_DST): $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
$(install-file)
else
$(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED)
$(US_EXPORT_POLICY_JAR_LIMITED_DST): $(US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED)
$(install-file)
endif
endif
TARGETS += $(US_EXPORT_POLICY_JAR_DST)
TARGETS += $(US_EXPORT_POLICY_JAR_
UNLIMITED_DST) $(US_EXPORT_POLICY_JAR_LIMITED_
DST)
##########################################################################################
LOCAL_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/local_policy.jar
LOCAL_POLICY_JAR_LIMITED_DST := \
$(JDK_OUTPUTDIR)/lib/security/policy/limited/local_policy.jar
LOCAL_POLICY_JAR_UNLIMITED_DST := \
$(JDK_OUTPUTDIR)/lib/security/policy/unlimited/local_policy.jar
ifneq ($(BUILD_CRYPTO), no)
...
...
@@ -293,20 +298,20 @@ ifneq ($(BUILD_CRYPTO), no)
endif
ifndef OPENJDK
$(LOCAL_POLICY_JAR_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/local_policy.jar
$(LOCAL_POLICY_JAR_UNLIMITED_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/unlimited/local_policy.jar
$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
$(install-file)
$(LOCAL_POLICY_JAR_LIMITED_DST): $(JDK_TOPDIR)/make/closed/tools/crypto/jce/limited/local_policy.jar
$(ECHO) $(LOG_INFO) Copying prebuilt $(@F)
$(install-file)
else
ifeq ($(UNLIMITED_CRYPTO), true)
$(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED)
$(LOCAL_POLICY_JAR_UNLIMITED_DST): $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED)
$(install-file)
else
$(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_LIMITED_UNSIGNED)
$(LOCAL_POLICY_JAR_LIMITED_DST): $(LOCAL_POLICY_JAR_LIMITED_UNSIGNED)
$(install-file)
endif
endif
TARGETS += $(LOCAL_POLICY_JAR_DST)
TARGETS += $(LOCAL_POLICY_JAR_
UNLIMITED_DST) $(LOCAL_POLICY_JAR_LIMITED_
DST)
##########################################################################################
...
...
make/Tools.gmk
浏览文件 @
b1916456
#
# Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 201
6
, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
...
...
@@ -132,7 +132,10 @@ TOOL_CHECKDEPS = $(JAVA_SMALL) -Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/boo
build.tools.deps.CheckDeps
TOOL_ADDTORESTRICTEDPKGS=$(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.addtorestrictedpkgs.AddToRestrictedPkgs
build.tools.customizesecurityfile.AddToRestrictedPkgs
TOOL_CRYPTOLEVEL=$(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.customizesecurityfile.CryptoLevel
##########################################################################################
...
...
make/profile-includes.txt
浏览文件 @
b1916456
#
# Copyright (c) 2012, 201
4
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, 201
6
, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
...
...
@@ -183,13 +183,15 @@ PROFILE_1_JRE_LIB_FILES += \
net.properties \
resources.jar \
rt.jar \
security/US_export_policy.jar \
security/policy/limited/US_export_policy.jar \
security/policy/unlimited/US_export_policy.jar \
security/blacklist \
security/blacklisted.certs \
security/cacerts \
security/java.policy \
security/java.security \
security/local_policy.jar \
security/policy/limited/local_policy.jar \
security/policy/unlimited/local_policy.jar \
security/trusted.libraries \
tzdb.dat
...
...
@@ -218,8 +220,10 @@ PROFILE_1_JRE_JAR_FILES := \
jsse.jar \
resources.jar \
rt.jar \
security/US_export_policy.jar \
security/local_policy.jar
security/policy/limited/US_export_policy.jar \
security/policy/unlimited/US_export_policy.jar \
security/policy/limited/local_policy.jar \
security/policy/unlimited/local_policy.jar
PROFILE_2_JRE_BIN_FILES := \
...
...
make/src/classes/build/tools/
addtorestrictedpkgs
/AddToRestrictedPkgs.java
→
make/src/classes/build/tools/
customizesecurityfile
/AddToRestrictedPkgs.java
浏览文件 @
b1916456
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013,
2016,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -23,7 +23,7 @@
* questions.
*/
package
build.tools.
addtorestrictedpkgs
;
package
build.tools.
customizesecurityfile
;
import
java.io.*
;
...
...
make/src/classes/build/tools/customizesecurityfile/CryptoLevel.java
0 → 100644
浏览文件 @
b1916456
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package
build.tools.customizesecurityfile
;
import
java.io.*
;
/**
* Alters the crypto.policy security property
* if --enable-unlimited-crypto is enabled.
*/
public
class
CryptoLevel
{
private
static
final
String
PROP_NAME
=
"crypto.policy"
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
boolean
fileModified
=
false
;
if
(
args
.
length
<
3
)
{
System
.
err
.
println
(
"Usage: java CryptoLevel"
+
"[input java.security file name] "
+
"[output java.security file name] "
+
"[unlimited|limited]"
);
System
.
exit
(
1
);
}
if
(!
args
[
2
].
equals
(
"unlimited"
)
&&
!
args
[
2
].
equals
(
"limited"
))
{
System
.
err
.
println
(
"CryptoLevel error: Unexpected "
+
"input: "
+
args
[
2
]);
System
.
exit
(
1
);
}
try
(
FileReader
fr
=
new
FileReader
(
args
[
0
]);
BufferedReader
br
=
new
BufferedReader
(
fr
);
FileWriter
fw
=
new
FileWriter
(
args
[
1
]);
BufferedWriter
bw
=
new
BufferedWriter
(
fw
))
{
// parse the file line-by-line, looking for crypto.policy
String
line
=
br
.
readLine
();
while
(
line
!=
null
)
{
if
(
line
.
startsWith
(
'#'
+
PROP_NAME
)
||
line
.
startsWith
(
PROP_NAME
))
{
writeLine
(
bw
,
PROP_NAME
+
"="
+
args
[
2
]);
fileModified
=
true
;
}
else
{
writeLine
(
bw
,
line
);
}
line
=
br
.
readLine
();
}
if
(!
fileModified
)
{
//no previous setting seen. Insert at end
writeLine
(
bw
,
PROP_NAME
+
"="
+
args
[
2
]);
}
bw
.
flush
();
}
}
private
static
void
writeLine
(
BufferedWriter
bw
,
String
line
)
throws
IOException
{
bw
.
write
(
line
);
bw
.
newLine
();
}
}
src/share/classes/javax/crypto/JceSecurity.java
浏览文件 @
b1916456
...
...
@@ -29,12 +29,14 @@ import java.util.*;
import
java.util.jar.*
;
import
java.io.*
;
import
java.net.URL
;
import
java.nio.file.*
;
import
java.security.*
;
import
java.security.Provider.Service
;
import
sun.security.jca.*
;
import
sun.security.jca.GetInstance.Instance
;
import
sun.security.util.Debug
;
/**
* This class instantiates implementations of JCE engine classes from
...
...
@@ -66,6 +68,9 @@ final class JceSecurity {
private
static
final
boolean
isRestricted
;
private
static
final
Debug
debug
=
Debug
.
getInstance
(
"jca"
,
"Cipher"
);
/*
* Don't let anyone instantiate this.
*/
...
...
@@ -204,7 +209,7 @@ final class JceSecurity {
static
{
try
{
NULL_URL
=
new
URL
(
"http://null.
sun
.com/"
);
NULL_URL
=
new
URL
(
"http://null.
oracle
.com/"
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
...
...
@@ -239,14 +244,70 @@ final class JceSecurity {
}
}
/*
* This is called from within an doPrivileged block.
*
* Following logic is used to decide what policy files are selected.
*
* If the new Security property (crypto.policy) is set in the
* java.security file, or has been set dynamically using the
* Security.setProperty() call before the JCE framework has
* been initialized, that setting will be used.
* Remember - this property is not defined by default. A conscious
* user edit or an application call is required.
*
* Otherwise, if user has policy jar files installed in the legacy
* jre/lib/security/ directory, the JDK will honor whatever
* setting is set by those policy files. (legacy/current behavior)
*
* If none of the above 2 conditions are met, the JDK will default
* to using the limited crypto policy files found in the
* jre/lib/security/policy/limited/ directory
*/
private
static
void
setupJurisdictionPolicies
()
throws
Exception
{
String
javaHomeDir
=
System
.
getProperty
(
"java.home"
);
String
sep
=
File
.
separator
;
String
pathToPolicyJar
=
javaHomeDir
+
sep
+
"lib"
+
sep
+
"security"
+
sep
;
// Sanity check the crypto.policy Security property. Single
// directory entry, no pseudo-directories (".", "..", leading/trailing
// path separators). normalize()/getParent() will help later.
String
javaHomeProperty
=
System
.
getProperty
(
"java.home"
);
String
cryptoPolicyProperty
=
Security
.
getProperty
(
"crypto.policy"
);
Path
cpPath
=
(
cryptoPolicyProperty
==
null
)
?
null
:
Paths
.
get
(
cryptoPolicyProperty
);
if
((
cpPath
!=
null
)
&&
((
cpPath
.
getNameCount
()
!=
1
)
||
(
cpPath
.
compareTo
(
cpPath
.
getFileName
()))
!=
0
))
{
throw
new
SecurityException
(
"Invalid policy directory name format: "
+
cryptoPolicyProperty
);
}
if
(
cpPath
==
null
)
{
// Security property is not set, use default path
cpPath
=
Paths
.
get
(
javaHomeProperty
,
"lib"
,
"security"
);
}
else
{
// populate with java.home
cpPath
=
Paths
.
get
(
javaHomeProperty
,
"lib"
,
"security"
,
"policy"
,
cryptoPolicyProperty
);
}
if
(
debug
!=
null
)
{
debug
.
println
(
"crypto policy directory: "
+
cpPath
);
}
File
exportJar
=
new
File
(
cpPath
.
toFile
(),
"US_export_policy.jar"
);
File
importJar
=
new
File
(
cpPath
.
toFile
(),
"local_policy.jar"
);
if
(
cryptoPolicyProperty
==
null
&&
(!
exportJar
.
exists
()
||
!
importJar
.
exists
()))
{
// Compatibility set up. If crypto.policy is not defined.
// check to see if legacy jars exist in lib directory. If
// they don't exist, we default to limited policy mode.
cpPath
=
Paths
.
get
(
javaHomeProperty
,
"lib"
,
"security"
,
"policy"
,
"limited"
);
// point to the new jar files in limited directory
exportJar
=
new
File
(
cpPath
.
toFile
(),
"US_export_policy.jar"
);
importJar
=
new
File
(
cpPath
.
toFile
(),
"local_policy.jar"
);
}
File
exportJar
=
new
File
(
pathToPolicyJar
,
"US_export_policy.jar"
);
File
importJar
=
new
File
(
pathToPolicyJar
,
"local_policy.jar"
);
URL
jceCipherURL
=
ClassLoader
.
getSystemResource
(
"javax/crypto/Cipher.class"
);
...
...
src/share/lib/security/java.security-aix
浏览文件 @
b1916456
...
...
@@ -661,3 +661,68 @@ jdk.tls.legacyAlgorithms= \
# E485B576 625E7EC6 F44C42E9 A637ED6B 0BFF5CB6 F406B7ED \
# EE386BFB 5A899FA5 AE9F2411 7C4B1FE6 49286651 ECE65381 \
# FFFFFFFF FFFFFFFF, 2}
# Cryptographic Jurisdiction Policy defaults
#
# Due to the import control restrictions of some countries, the default
# JCE policy files allow for strong but "limited" cryptographic key
# lengths to be used. If your country's cryptographic regulations allow,
# the "unlimited" strength policy files can be used instead, which contain
# no restrictions on cryptographic strengths.
#
# YOU ARE ADVISED TO CONSULT YOUR EXPORT/IMPORT CONTROL COUNSEL OR ATTORNEY
# TO DETERMINE THE EXACT REQUIREMENTS.
#
# <java-home> (below) refers to the directory where the JRE was
# installed. It is determined based on whether you are running JCE
# on a JRE or a JRE contained within the Java Development Kit, or
# JDK(TM). The JDK contains the JRE, but at a different level in the
# file hierarchy. For example, if the JDK is installed in
# /home/user1/jdk1.8.0 on Unix or in C:\jdk1.8.0 on Windows, then
# <java-home> is:
#
# /home/user1/jdk1.8.0/jre [Unix]
# C:\jdk1.8.0\jre [Windows]
#
# If on the other hand the JRE is installed in /home/user1/jre1.8.0
# on Unix or in C:\jre1.8.0 on Windows, and the JDK is not
# installed, then <java-home> is:
#
# /home/user1/jre1.8.0 [Unix]
# C:\jre1.8.0 [Windows]
#
# On Windows, for each JDK installation, there may be additional
# JREs installed under the "Program Files" directory. Please make
# sure that you install the unlimited strength policy JAR files
# for all JREs that you plan to use.
#
# The policy files are jar files organized into subdirectories of
# <java-home>/lib/security/policy. Each directory contains a complete
# set of policy files.
#
# The "crypto.policy" Security property controls the directory selection,
# and thus the effective cryptographic policy.
#
# The default set of directories is:
#
# limited | unlimited
#
# however other directories can be created and configured.
#
# To support older JDK Update releases, the crypto.policy property
# is not defined by default. When the property is not defined, an
# update release binary aware of the new property will use the following
# logic to decide what crypto policy files get used :
#
# * If the US_export_policy.jar and local_policy.jar files are located
# in the (legacy) <java-home>/lib/security directory, then the rules
# embedded in those jar files will be used. This helps preserve compatibility
# for users upgrading from an older installation.
#
# * If crypto.policy is not defined and no such jar files are present in
# the legacy locations, then the JDK will use the limited settings
# (equivalent to crypto.policy=limited)
#
# Please see the JCA documentation for additional information on these
# files and formats.
#crypto.policy=unlimited
src/share/lib/security/java.security-linux
浏览文件 @
b1916456
...
...
@@ -661,3 +661,68 @@ jdk.tls.legacyAlgorithms= \
# E485B576 625E7EC6 F44C42E9 A637ED6B 0BFF5CB6 F406B7ED \
# EE386BFB 5A899FA5 AE9F2411 7C4B1FE6 49286651 ECE65381 \
# FFFFFFFF FFFFFFFF, 2}
# Cryptographic Jurisdiction Policy defaults
#
# Due to the import control restrictions of some countries, the default
# JCE policy files allow for strong but "limited" cryptographic key
# lengths to be used. If your country's cryptographic regulations allow,
# the "unlimited" strength policy files can be used instead, which contain
# no restrictions on cryptographic strengths.
#
# YOU ARE ADVISED TO CONSULT YOUR EXPORT/IMPORT CONTROL COUNSEL OR ATTORNEY
# TO DETERMINE THE EXACT REQUIREMENTS.
#
# <java-home> (below) refers to the directory where the JRE was
# installed. It is determined based on whether you are running JCE
# on a JRE or a JRE contained within the Java Development Kit, or
# JDK(TM). The JDK contains the JRE, but at a different level in the
# file hierarchy. For example, if the JDK is installed in
# /home/user1/jdk1.8.0 on Unix or in C:\jdk1.8.0 on Windows, then
# <java-home> is:
#
# /home/user1/jdk1.8.0/jre [Unix]
# C:\jdk1.8.0\jre [Windows]
#
# If on the other hand the JRE is installed in /home/user1/jre1.8.0
# on Unix or in C:\jre1.8.0 on Windows, and the JDK is not
# installed, then <java-home> is:
#
# /home/user1/jre1.8.0 [Unix]
# C:\jre1.8.0 [Windows]
#
# On Windows, for each JDK installation, there may be additional
# JREs installed under the "Program Files" directory. Please make
# sure that you install the unlimited strength policy JAR files
# for all JREs that you plan to use.
#
# The policy files are jar files organized into subdirectories of
# <java-home>/lib/security/policy. Each directory contains a complete
# set of policy files.
#
# The "crypto.policy" Security property controls the directory selection,
# and thus the effective cryptographic policy.
#
# The default set of directories is:
#
# limited | unlimited
#
# however other directories can be created and configured.
#
# To support older JDK Update releases, the crypto.policy property
# is not defined by default. When the property is not defined, an
# update release binary aware of the new property will use the following
# logic to decide what crypto policy files get used :
#
# * If the US_export_policy.jar and local_policy.jar files are located
# in the (legacy) <java-home>/lib/security directory, then the rules
# embedded in those jar files will be used. This helps preserve compatibility
# for users upgrading from an older installation.
#
# * If crypto.policy is not defined and no such jar files are present in
# the legacy locations, then the JDK will use the limited settings
# (equivalent to crypto.policy=limited)
#
# Please see the JCA documentation for additional information on these
# files and formats.
#crypto.policy=unlimited
src/share/lib/security/java.security-macosx
浏览文件 @
b1916456
...
...
@@ -664,3 +664,68 @@ jdk.tls.legacyAlgorithms= \
# E485B576 625E7EC6 F44C42E9 A637ED6B 0BFF5CB6 F406B7ED \
# EE386BFB 5A899FA5 AE9F2411 7C4B1FE6 49286651 ECE65381 \
# FFFFFFFF FFFFFFFF, 2}
# Cryptographic Jurisdiction Policy defaults
#
# Due to the import control restrictions of some countries, the default
# JCE policy files allow for strong but "limited" cryptographic key
# lengths to be used. If your country's cryptographic regulations allow,
# the "unlimited" strength policy files can be used instead, which contain
# no restrictions on cryptographic strengths.
#
# YOU ARE ADVISED TO CONSULT YOUR EXPORT/IMPORT CONTROL COUNSEL OR ATTORNEY
# TO DETERMINE THE EXACT REQUIREMENTS.
#
# <java-home> (below) refers to the directory where the JRE was
# installed. It is determined based on whether you are running JCE
# on a JRE or a JRE contained within the Java Development Kit, or
# JDK(TM). The JDK contains the JRE, but at a different level in the
# file hierarchy. For example, if the JDK is installed in
# /home/user1/jdk1.8.0 on Unix or in C:\jdk1.8.0 on Windows, then
# <java-home> is:
#
# /home/user1/jdk1.8.0/jre [Unix]
# C:\jdk1.8.0\jre [Windows]
#
# If on the other hand the JRE is installed in /home/user1/jre1.8.0
# on Unix or in C:\jre1.8.0 on Windows, and the JDK is not
# installed, then <java-home> is:
#
# /home/user1/jre1.8.0 [Unix]
# C:\jre1.8.0 [Windows]
#
# On Windows, for each JDK installation, there may be additional
# JREs installed under the "Program Files" directory. Please make
# sure that you install the unlimited strength policy JAR files
# for all JREs that you plan to use.
#
# The policy files are jar files organized into subdirectories of
# <java-home>/lib/security/policy. Each directory contains a complete
# set of policy files.
#
# The "crypto.policy" Security property controls the directory selection,
# and thus the effective cryptographic policy.
#
# The default set of directories is:
#
# limited | unlimited
#
# however other directories can be created and configured.
#
# To support older JDK Update releases, the crypto.policy property
# is not defined by default. When the property is not defined, an
# update release binary aware of the new property will use the following
# logic to decide what crypto policy files get used :
#
# * If the US_export_policy.jar and local_policy.jar files are located
# in the (legacy) <java-home>/lib/security directory, then the rules
# embedded in those jar files will be used. This helps preserve compatibility
# for users upgrading from an older installation.
#
# * If crypto.policy is not defined and no such jar files are present in
# the legacy locations, then the JDK will use the limited settings
# (equivalent to crypto.policy=limited)
#
# Please see the JCA documentation for additional information on these
# files and formats.
#crypto.policy=unlimited
src/share/lib/security/java.security-solaris
浏览文件 @
b1916456
...
...
@@ -663,3 +663,68 @@ jdk.tls.legacyAlgorithms= \
# E485B576 625E7EC6 F44C42E9 A637ED6B 0BFF5CB6 F406B7ED \
# EE386BFB 5A899FA5 AE9F2411 7C4B1FE6 49286651 ECE65381 \
# FFFFFFFF FFFFFFFF, 2}
# Cryptographic Jurisdiction Policy defaults
#
# Due to the import control restrictions of some countries, the default
# JCE policy files allow for strong but "limited" cryptographic key
# lengths to be used. If your country's cryptographic regulations allow,
# the "unlimited" strength policy files can be used instead, which contain
# no restrictions on cryptographic strengths.
#
# YOU ARE ADVISED TO CONSULT YOUR EXPORT/IMPORT CONTROL COUNSEL OR ATTORNEY
# TO DETERMINE THE EXACT REQUIREMENTS.
#
# <java-home> (below) refers to the directory where the JRE was
# installed. It is determined based on whether you are running JCE
# on a JRE or a JRE contained within the Java Development Kit, or
# JDK(TM). The JDK contains the JRE, but at a different level in the
# file hierarchy. For example, if the JDK is installed in
# /home/user1/jdk1.8.0 on Unix or in C:\jdk1.8.0 on Windows, then
# <java-home> is:
#
# /home/user1/jdk1.8.0/jre [Unix]
# C:\jdk1.8.0\jre [Windows]
#
# If on the other hand the JRE is installed in /home/user1/jre1.8.0
# on Unix or in C:\jre1.8.0 on Windows, and the JDK is not
# installed, then <java-home> is:
#
# /home/user1/jre1.8.0 [Unix]
# C:\jre1.8.0 [Windows]
#
# On Windows, for each JDK installation, there may be additional
# JREs installed under the "Program Files" directory. Please make
# sure that you install the unlimited strength policy JAR files
# for all JREs that you plan to use.
#
# The policy files are jar files organized into subdirectories of
# <java-home>/lib/security/policy. Each directory contains a complete
# set of policy files.
#
# The "crypto.policy" Security property controls the directory selection,
# and thus the effective cryptographic policy.
#
# The default set of directories is:
#
# limited | unlimited
#
# however other directories can be created and configured.
#
# To support older JDK Update releases, the crypto.policy property
# is not defined by default. When the property is not defined, an
# update release binary aware of the new property will use the following
# logic to decide what crypto policy files get used :
#
# * If the US_export_policy.jar and local_policy.jar files are located
# in the (legacy) <java-home>/lib/security directory, then the rules
# embedded in those jar files will be used. This helps preserve compatibility
# for users upgrading from an older installation.
#
# * If crypto.policy is not defined and no such jar files are present in
# the legacy locations, then the JDK will use the limited settings
# (equivalent to crypto.policy=limited)
#
# Please see the JCA documentation for additional information on these
# files and formats.
#crypto.policy=unlimited
src/share/lib/security/java.security-windows
浏览文件 @
b1916456
...
...
@@ -664,3 +664,68 @@ jdk.tls.legacyAlgorithms= \
# E485B576 625E7EC6 F44C42E9 A637ED6B 0BFF5CB6 F406B7ED \
# EE386BFB 5A899FA5 AE9F2411 7C4B1FE6 49286651 ECE65381 \
# FFFFFFFF FFFFFFFF, 2}
# Cryptographic Jurisdiction Policy defaults
#
# Due to the import control restrictions of some countries, the default
# JCE policy files allow for strong but "limited" cryptographic key
# lengths to be used. If your country's cryptographic regulations allow,
# the "unlimited" strength policy files can be used instead, which contain
# no restrictions on cryptographic strengths.
#
# YOU ARE ADVISED TO CONSULT YOUR EXPORT/IMPORT CONTROL COUNSEL OR ATTORNEY
# TO DETERMINE THE EXACT REQUIREMENTS.
#
# <java-home> (below) refers to the directory where the JRE was
# installed. It is determined based on whether you are running JCE
# on a JRE or a JRE contained within the Java Development Kit, or
# JDK(TM). The JDK contains the JRE, but at a different level in the
# file hierarchy. For example, if the JDK is installed in
# /home/user1/jdk1.8.0 on Unix or in C:\jdk1.8.0 on Windows, then
# <java-home> is:
#
# /home/user1/jdk1.8.0/jre [Unix]
# C:\jdk1.8.0\jre [Windows]
#
# If on the other hand the JRE is installed in /home/user1/jre1.8.0
# on Unix or in C:\jre1.8.0 on Windows, and the JDK is not
# installed, then <java-home> is:
#
# /home/user1/jre1.8.0 [Unix]
# C:\jre1.8.0 [Windows]
#
# On Windows, for each JDK installation, there may be additional
# JREs installed under the "Program Files" directory. Please make
# sure that you install the unlimited strength policy JAR files
# for all JREs that you plan to use.
#
# The policy files are jar files organized into subdirectories of
# <java-home>/lib/security/policy. Each directory contains a complete
# set of policy files.
#
# The "crypto.policy" Security property controls the directory selection,
# and thus the effective cryptographic policy.
#
# The default set of directories is:
#
# limited | unlimited
#
# however other directories can be created and configured.
#
# To support older JDK Update releases, the crypto.policy property
# is not defined by default. When the property is not defined, an
# update release binary aware of the new property will use the following
# logic to decide what crypto policy files get used :
#
# * If the US_export_policy.jar and local_policy.jar files are located
# in the (legacy) <java-home>/lib/security directory, then the rules
# embedded in those jar files will be used. This helps preserve compatibility
# for users upgrading from an older installation.
#
# * If crypto.policy is not defined and no such jar files are present in
# the legacy locations, then the JDK will use the limited settings
# (equivalent to crypto.policy=limited)
#
# Please see the JCA documentation for additional information on these
# files and formats.
#crypto.policy=unlimited
test/javax/crypto/CryptoPermission/TestUnlimited.java
0 → 100644
浏览文件 @
b1916456
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8157561
* @summary Ship the unlimited policy files in JDK Updates
* @run main/othervm TestUnlimited "" exception
* @run main/othervm TestUnlimited limited fail
* @run main/othervm TestUnlimited unlimited pass
* @run main/othervm TestUnlimited unlimited/ pass
* @run main/othervm TestUnlimited NosuchDir exception
* @run main/othervm TestUnlimited . exception
* @run main/othervm TestUnlimited /tmp/unlimited exception
* @run main/othervm TestUnlimited ../policy/unlimited exception
* @run main/othervm TestUnlimited ./unlimited exception
* @run main/othervm TestUnlimited /unlimited exception
*/
import
javax.crypto.*
;
import
java.security.Security
;
public
class
TestUnlimited
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
/*
* Override the Security property to allow for unlimited policy.
* Would need appropriate permissions if Security Manager were
* active.
*/
if
(
args
.
length
!=
2
)
{
throw
new
Exception
(
"Two args required"
);
}
boolean
expected
=
args
[
1
].
equals
(
"pass"
);
boolean
exception
=
args
[
1
].
equals
(
"exception"
);
boolean
result
=
false
;
System
.
out
.
println
(
"Testing: "
+
args
[
0
]);
if
(
args
[
0
].
equals
(
"\"\""
))
{
Security
.
setProperty
(
"crypto.policy"
,
""
);
}
else
{
Security
.
setProperty
(
"crypto.policy"
,
args
[
0
]);
}
/*
* Use the AES as the test Cipher
* If there is an error initializing, we will never get past here.
*/
try
{
int
maxKeyLen
=
Cipher
.
getMaxAllowedKeyLength
(
"AES"
);
System
.
out
.
println
(
"max AES key len:"
+
maxKeyLen
);
if
(
maxKeyLen
>
128
)
{
System
.
out
.
println
(
"Unlimited policy is active"
);
result
=
true
;
}
else
{
System
.
out
.
println
(
"Unlimited policy is NOT active"
);
result
=
false
;
}
}
catch
(
Throwable
e
)
{
if
(!
exception
)
{
throw
new
Exception
();
}
}
System
.
out
.
println
(
"Expected:\t"
+
expected
+
"\nResult:\t\t"
+
result
);
if
(
expected
!=
result
)
{
throw
new
Exception
();
}
System
.
out
.
println
(
"DONE!"
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录