Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
7edcaa68
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看板
提交
7edcaa68
编写于
8月 30, 2012
作者:
M
mullan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6995421: Eliminate the static dependency to sun.security.ec.ECKeyFactory
Reviewed-by: mullan, vinnie Contributed-by: stephen.flores@oracle.com
上级
d7fe9623
变更
13
显示空白变更内容
内联
并排
Showing
13 changed file
with
62 addition
and
54 deletion
+62
-54
make/sun/security/ec/Makefile
make/sun/security/ec/Makefile
+0
-1
make/sun/security/other/Makefile
make/sun/security/other/Makefile
+0
-1
src/share/classes/sun/security/ec/ECKeyFactory.java
src/share/classes/sun/security/ec/ECKeyFactory.java
+19
-26
src/share/classes/sun/security/ec/ECParameters.java
src/share/classes/sun/security/ec/ECParameters.java
+3
-3
src/share/classes/sun/security/ec/ECPublicKeyImpl.java
src/share/classes/sun/security/ec/ECPublicKeyImpl.java
+6
-1
src/share/classes/sun/security/ec/SunECEntries.java
src/share/classes/sun/security/ec/SunECEntries.java
+1
-0
src/share/classes/sun/security/pkcs11/P11ECKeyFactory.java
src/share/classes/sun/security/pkcs11/P11ECKeyFactory.java
+2
-2
src/share/classes/sun/security/x509/AlgorithmId.java
src/share/classes/sun/security/x509/AlgorithmId.java
+7
-14
test/sun/security/ec/TestEC.java
test/sun/security/ec/TestEC.java
+8
-2
test/sun/security/pkcs11/ec/ReadCertificates.java
test/sun/security/pkcs11/ec/ReadCertificates.java
+4
-1
test/sun/security/pkcs11/ec/ReadPKCS12.java
test/sun/security/pkcs11/ec/ReadPKCS12.java
+4
-1
test/sun/security/pkcs11/ec/TestECDH.java
test/sun/security/pkcs11/ec/TestECDH.java
+4
-1
test/sun/security/pkcs11/ec/TestECDSA.java
test/sun/security/pkcs11/ec/TestECDSA.java
+4
-1
未找到文件。
make/sun/security/ec/Makefile
浏览文件 @
7edcaa68
...
@@ -128,7 +128,6 @@ AUTO_FILES_JAVA_DIRS = $(PKGDIR)
...
@@ -128,7 +128,6 @@ AUTO_FILES_JAVA_DIRS = $(PKGDIR)
# Exclude the sources that get built by ../other/Makefile
# Exclude the sources that get built by ../other/Makefile
#
#
AUTO_JAVA_PRUNE
=
\
AUTO_JAVA_PRUNE
=
\
ECKeyFactory.java
\
ECParameters.java
\
ECParameters.java
\
ECPrivateKeyImpl.java
\
ECPrivateKeyImpl.java
\
ECPublicKeyImpl.java
\
ECPublicKeyImpl.java
\
...
...
make/sun/security/other/Makefile
浏览文件 @
7edcaa68
...
@@ -53,7 +53,6 @@ AUTO_FILES_JAVA_DIRS = \
...
@@ -53,7 +53,6 @@ AUTO_FILES_JAVA_DIRS = \
# EC classes used by the packages above
# EC classes used by the packages above
#
#
FILES_java
+=
\
FILES_java
+=
\
sun/security/ec/ECKeyFactory.java
\
sun/security/ec/ECParameters.java
\
sun/security/ec/ECParameters.java
\
sun/security/ec/ECPrivateKeyImpl.java
\
sun/security/ec/ECPrivateKeyImpl.java
\
sun/security/ec/ECPublicKeyImpl.java
\
sun/security/ec/ECPublicKeyImpl.java
\
...
...
src/share/classes/sun/security/ec/ECKeyFactory.java
浏览文件 @
7edcaa68
/*
/*
* Copyright (c) 2006, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -51,33 +51,21 @@ import java.security.spec.*;
...
@@ -51,33 +51,21 @@ import java.security.spec.*;
*/
*/
public
final
class
ECKeyFactory
extends
KeyFactorySpi
{
public
final
class
ECKeyFactory
extends
KeyFactorySpi
{
// Used by translateKey()
and the SunPKCS11 provider
// Used by translateKey()
p
ublic
final
static
KeyFactory
INSTANCE
;
p
rivate
static
KeyFactory
instance
;
// Internal provider object we can obtain the KeyFactory and
private
static
KeyFactory
getInstance
()
{
// AlgorithmParameters from. Used by ECParameters and AlgorithmId.
if
(
instance
==
null
)
{
// This can go away once we have EC always available in the SUN provider.
// Used by ECParameters and AlgorithmId.
public
final
static
Provider
ecInternalProvider
;
static
{
final
Provider
p
=
new
Provider
(
"SunEC-Internal"
,
1.0d
,
null
)
{
private
static
final
long
serialVersionUID
=
970685700309471261L
;
};
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Void
>()
{
public
Void
run
()
{
p
.
put
(
"KeyFactory.EC"
,
"sun.security.ec.ECKeyFactory"
);
p
.
put
(
"AlgorithmParameters.EC"
,
"sun.security.ec.ECParameters"
);
p
.
put
(
"Alg.Alias.AlgorithmParameters.1.2.840.10045.2.1"
,
"EC"
);
return
null
;
}
});
try
{
try
{
INSTANCE
=
KeyFactory
.
getInstance
(
"EC"
,
p
);
instance
=
KeyFactory
.
getInstance
(
"EC"
,
"SunEC"
);
}
catch
(
NoSuchProviderException
e
)
{
throw
new
RuntimeException
(
e
);
}
catch
(
NoSuchAlgorithmException
e
)
{
}
catch
(
NoSuchAlgorithmException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
ecInternalProvider
=
p
;
}
return
instance
;
}
}
public
ECKeyFactory
()
{
public
ECKeyFactory
()
{
...
@@ -102,7 +90,12 @@ public final class ECKeyFactory extends KeyFactorySpi {
...
@@ -102,7 +90,12 @@ public final class ECKeyFactory extends KeyFactorySpi {
checkKey
(
ecKey
);
checkKey
(
ecKey
);
return
ecKey
;
return
ecKey
;
}
else
{
}
else
{
return
(
ECKey
)
INSTANCE
.
translateKey
(
key
);
/*
* We don't call the engineTranslateKey method directly
* because KeyFactory.translateKey adds code to loop through
* all key factories.
*/
return
(
ECKey
)
getInstance
().
translateKey
(
key
);
}
}
}
}
...
...
src/share/classes/sun/security/ec/ECParameters.java
浏览文件 @
7edcaa68
/*
/*
* Copyright (c) 2006, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -276,8 +276,8 @@ public final class ECParameters extends AlgorithmParametersSpi {
...
@@ -276,8 +276,8 @@ public final class ECParameters extends AlgorithmParametersSpi {
static
AlgorithmParameters
getAlgorithmParameters
(
ECParameterSpec
spec
)
static
AlgorithmParameters
getAlgorithmParameters
(
ECParameterSpec
spec
)
throws
InvalidKeyException
{
throws
InvalidKeyException
{
try
{
try
{
AlgorithmParameters
params
=
AlgorithmParameters
.
getInstance
AlgorithmParameters
params
=
(
"EC"
,
ECKeyFactory
.
ecInternalProvider
);
AlgorithmParameters
.
getInstance
(
"EC"
,
"SunEC"
);
params
.
init
(
spec
);
params
.
init
(
spec
);
return
params
;
return
params
;
}
catch
(
GeneralSecurityException
e
)
{
}
catch
(
GeneralSecurityException
e
)
{
...
...
src/share/classes/sun/security/ec/ECPublicKeyImpl.java
浏览文件 @
7edcaa68
...
@@ -96,8 +96,13 @@ public final class ECPublicKeyImpl extends X509Key implements ECPublicKey {
...
@@ -96,8 +96,13 @@ public final class ECPublicKeyImpl extends X509Key implements ECPublicKey {
*/
*/
@SuppressWarnings
(
"deprecation"
)
@SuppressWarnings
(
"deprecation"
)
protected
void
parseKeyBits
()
throws
InvalidKeyException
{
protected
void
parseKeyBits
()
throws
InvalidKeyException
{
try
{
AlgorithmParameters
algParams
=
this
.
algid
.
getParameters
();
AlgorithmParameters
algParams
=
this
.
algid
.
getParameters
();
if
(
algParams
==
null
)
{
throw
new
InvalidKeyException
(
"EC domain parameters must be "
+
"encoded in the algorithm identifier"
);
}
try
{
params
=
algParams
.
getParameterSpec
(
ECParameterSpec
.
class
);
params
=
algParams
.
getParameterSpec
(
ECParameterSpec
.
class
);
w
=
ECParameters
.
decodePoint
(
key
,
params
.
getCurve
());
w
=
ECParameters
.
decodePoint
(
key
,
params
.
getCurve
());
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
...
src/share/classes/sun/security/ec/SunECEntries.java
浏览文件 @
7edcaa68
...
@@ -54,6 +54,7 @@ final class SunECEntries {
...
@@ -54,6 +54,7 @@ final class SunECEntries {
*/
*/
map
.
put
(
"AlgorithmParameters.EC"
,
"sun.security.ec.ECParameters"
);
map
.
put
(
"AlgorithmParameters.EC"
,
"sun.security.ec.ECParameters"
);
map
.
put
(
"Alg.Alias.AlgorithmParameters.EllipticCurve"
,
"EC"
);
map
.
put
(
"Alg.Alias.AlgorithmParameters.EllipticCurve"
,
"EC"
);
map
.
put
(
"Alg.Alias.AlgorithmParameters.1.2.840.10045.2.1"
,
"EC"
);
map
.
put
(
"AlgorithmParameters.EC KeySize"
,
"256"
);
map
.
put
(
"AlgorithmParameters.EC KeySize"
,
"256"
);
...
...
src/share/classes/sun/security/pkcs11/P11ECKeyFactory.java
浏览文件 @
7edcaa68
/*
/*
* Copyright (c) 2006, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -304,7 +304,7 @@ final class P11ECKeyFactory extends P11KeyFactory {
...
@@ -304,7 +304,7 @@ final class P11ECKeyFactory extends P11KeyFactory {
}
}
KeyFactory
implGetSoftwareFactory
()
throws
GeneralSecurityException
{
KeyFactory
implGetSoftwareFactory
()
throws
GeneralSecurityException
{
return
sun
.
security
.
ec
.
ECKeyFactory
.
INSTANCE
;
return
KeyFactory
.
getInstance
(
"EC"
,
"SunEC"
)
;
}
}
}
}
src/share/classes/sun/security/x509/AlgorithmId.java
浏览文件 @
7edcaa68
...
@@ -120,13 +120,6 @@ public class AlgorithmId implements Serializable, DerEncoder {
...
@@ -120,13 +120,6 @@ public class AlgorithmId implements Serializable, DerEncoder {
try
{
try
{
algParams
=
AlgorithmParameters
.
getInstance
(
algidString
);
algParams
=
AlgorithmParameters
.
getInstance
(
algidString
);
}
catch
(
NoSuchAlgorithmException
e
)
{
}
catch
(
NoSuchAlgorithmException
e
)
{
try
{
// Try the internal EC code so that we can fully parse EC
// keys even if the provider is not registered.
// This code can go away once we have EC in the SUN provider.
algParams
=
AlgorithmParameters
.
getInstance
(
algidString
,
sun
.
security
.
ec
.
ECKeyFactory
.
ecInternalProvider
);
}
catch
(
NoSuchAlgorithmException
ee
)
{
/*
/*
* This algorithm parameter type is not supported, so we cannot
* This algorithm parameter type is not supported, so we cannot
* parse the parameters.
* parse the parameters.
...
@@ -134,7 +127,7 @@ public class AlgorithmId implements Serializable, DerEncoder {
...
@@ -134,7 +127,7 @@ public class AlgorithmId implements Serializable, DerEncoder {
algParams
=
null
;
algParams
=
null
;
return
;
return
;
}
}
}
// Decode (parse) the parameters
// Decode (parse) the parameters
algParams
.
init
(
params
.
toByteArray
());
algParams
.
init
(
params
.
toByteArray
());
}
}
...
...
test/sun/security/ec/TestEC.java
浏览文件 @
7edcaa68
/*
/*
* Copyright (c) 2009, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 201
2
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
* @run main TestEC
* @run main TestEC
*/
*/
import
java.security.NoSuchProviderException
;
import
java.security.Provider
;
import
java.security.Provider
;
import
java.security.Security
;
import
java.security.Security
;
...
@@ -62,7 +63,12 @@ public class TestEC {
...
@@ -62,7 +63,12 @@ public class TestEC {
}
}
public
static
void
main0
(
String
[]
args
)
throws
Exception
{
public
static
void
main0
(
String
[]
args
)
throws
Exception
{
Provider
p
=
new
sun
.
security
.
ec
.
SunEC
();
Provider
p
=
Security
.
getProvider
(
"SunEC"
);
if
(
p
==
null
)
{
throw
new
NoSuchProviderException
(
"Can't get SunEC provider"
);
}
System
.
out
.
println
(
"Running tests with "
+
p
.
getName
()
+
System
.
out
.
println
(
"Running tests with "
+
p
.
getName
()
+
" provider...\n"
);
" provider...\n"
);
long
start
=
System
.
currentTimeMillis
();
long
start
=
System
.
currentTimeMillis
();
...
...
test/sun/security/pkcs11/ec/ReadCertificates.java
浏览文件 @
7edcaa68
...
@@ -63,6 +63,10 @@ public class ReadCertificates extends PKCS11Test {
...
@@ -63,6 +63,10 @@ public class ReadCertificates extends PKCS11Test {
System
.
out
.
println
(
"Provider does not support ECDSA, skipping..."
);
System
.
out
.
println
(
"Provider does not support ECDSA, skipping..."
);
return
;
return
;
}
}
/*
* PKCS11Test.main will remove this provider if needed
*/
Providers
.
setAt
(
p
,
1
);
Providers
.
setAt
(
p
,
1
);
random
=
new
SecureRandom
();
random
=
new
SecureRandom
();
...
@@ -132,7 +136,6 @@ public class ReadCertificates extends PKCS11Test {
...
@@ -132,7 +136,6 @@ public class ReadCertificates extends PKCS11Test {
}
}
}
}
Security
.
removeProvider
(
p
.
getName
());
System
.
out
.
println
(
"OK"
);
System
.
out
.
println
(
"OK"
);
}
}
...
...
test/sun/security/pkcs11/ec/ReadPKCS12.java
浏览文件 @
7edcaa68
...
@@ -53,6 +53,10 @@ public class ReadPKCS12 extends PKCS11Test {
...
@@ -53,6 +53,10 @@ public class ReadPKCS12 extends PKCS11Test {
System
.
out
.
println
(
"Provider does not support ECDSA, skipping..."
);
System
.
out
.
println
(
"Provider does not support ECDSA, skipping..."
);
return
;
return
;
}
}
/*
* PKCS11Test.main will remove this provider if needed
*/
Providers
.
setAt
(
p
,
1
);
Providers
.
setAt
(
p
,
1
);
CertificateFactory
factory
=
CertificateFactory
.
getInstance
(
"X.509"
);
CertificateFactory
factory
=
CertificateFactory
.
getInstance
(
"X.509"
);
...
@@ -147,7 +151,6 @@ public class ReadPKCS12 extends PKCS11Test {
...
@@ -147,7 +151,6 @@ public class ReadPKCS12 extends PKCS11Test {
out
.
close
();
out
.
close
();
}
}
Security
.
removeProvider
(
p
.
getName
());
System
.
out
.
println
(
"OK"
);
System
.
out
.
println
(
"OK"
);
}
}
...
...
test/sun/security/pkcs11/ec/TestECDH.java
浏览文件 @
7edcaa68
...
@@ -60,6 +60,10 @@ public class TestECDH extends PKCS11Test {
...
@@ -60,6 +60,10 @@ public class TestECDH extends PKCS11Test {
System
.
out
.
println
(
"Provider does not support ECDH, skipping"
);
System
.
out
.
println
(
"Provider does not support ECDH, skipping"
);
return
;
return
;
}
}
/*
* PKCS11Test.main will remove this provider if needed
*/
Providers
.
setAt
(
p
,
1
);
Providers
.
setAt
(
p
,
1
);
if
(
false
)
{
if
(
false
)
{
...
@@ -77,7 +81,6 @@ public class TestECDH extends PKCS11Test {
...
@@ -77,7 +81,6 @@ public class TestECDH extends PKCS11Test {
test
(
p
,
pub192a
,
priv192a
,
pub192b
,
priv192b
,
secret192
);
test
(
p
,
pub192a
,
priv192a
,
pub192b
,
priv192b
,
secret192
);
test
(
p
,
pub163a
,
priv163a
,
pub163b
,
priv163b
,
secret163
);
test
(
p
,
pub163a
,
priv163a
,
pub163b
,
priv163b
,
secret163
);
Security
.
removeProvider
(
p
.
getName
());
System
.
out
.
println
(
"OK"
);
System
.
out
.
println
(
"OK"
);
}
}
...
...
test/sun/security/pkcs11/ec/TestECDSA.java
浏览文件 @
7edcaa68
...
@@ -116,6 +116,10 @@ public class TestECDSA extends PKCS11Test {
...
@@ -116,6 +116,10 @@ public class TestECDSA extends PKCS11Test {
System
.
out
.
println
(
"ECDSA not supported, skipping"
);
System
.
out
.
println
(
"ECDSA not supported, skipping"
);
return
;
return
;
}
}
/*
* PKCS11Test.main will remove this provider if needed
*/
Providers
.
setAt
(
provider
,
1
);
Providers
.
setAt
(
provider
,
1
);
if
(
false
)
{
if
(
false
)
{
...
@@ -137,7 +141,6 @@ public class TestECDSA extends PKCS11Test {
...
@@ -137,7 +141,6 @@ public class TestECDSA extends PKCS11Test {
test
(
provider
,
pub521
,
priv521
,
sig521
);
test
(
provider
,
pub521
,
priv521
,
sig521
);
test
(
provider
,
pub571
,
priv571
,
sig571
);
test
(
provider
,
pub571
,
priv571
,
sig571
);
Security
.
removeProvider
(
provider
.
getName
());
long
stop
=
System
.
currentTimeMillis
();
long
stop
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"All tests passed ("
+
(
stop
-
start
)
+
" ms)."
);
System
.
out
.
println
(
"All tests passed ("
+
(
stop
-
start
)
+
" ms)."
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录