Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
a275ce91
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看板
提交
a275ce91
编写于
8月 26, 2019
作者:
M
mbalao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8227758: More valid PKIX processing
Reviewed-by: andrew
上级
ce00db43
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
28 deletion
+26
-28
src/share/classes/sun/security/validator/PKIXValidator.java
src/share/classes/sun/security/validator/PKIXValidator.java
+23
-21
test/sun/security/tools/jarsigner/concise_jarsigner.sh
test/sun/security/tools/jarsigner/concise_jarsigner.sh
+3
-7
未找到文件。
src/share/classes/sun/security/validator/PKIXValidator.java
浏览文件 @
a275ce91
/*
* Copyright (c) 2002, 201
7
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 201
9
, 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
...
...
@@ -209,6 +209,7 @@ public final class PKIXValidator extends Validator {
(
"null or zero-length certificate chain"
);
}
// Use PKIXExtendedParameters for timestamp and variant additions
PKIXBuilderParameters
pkixParameters
=
null
;
try
{
...
...
@@ -234,29 +235,30 @@ public final class PKIXValidator extends Validator {
for
(
int
i
=
0
;
i
<
chain
.
length
;
i
++)
{
X509Certificate
cert
=
chain
[
i
];
X500Principal
dn
=
cert
.
getSubjectX500Principal
();
if
(
i
!=
0
&&
!
dn
.
equals
(
prevIssuer
))
{
// chain is not ordered correctly, call builder instead
return
doBuild
(
chain
,
otherCerts
,
pkixParameters
);
}
// Check if chain[i] is already trusted. It may be inside
// trustedCerts, or has the same dn and public key as a cert
// inside trustedCerts. The latter happens when a CA has
// updated its cert with a stronger signature algorithm in JRE
// but the weak one is still in circulation.
if
(
trustedCerts
.
contains
(
cert
)
||
// trusted cert
(
trustedSubjects
.
containsKey
(
dn
)
&&
// replacing ...
trustedSubjects
.
get
(
dn
).
contains
(
// ... weak cert
cert
.
getPublicKey
())))
{
if
(
i
==
0
)
{
if
(
i
==
0
)
{
if
(
trustedCerts
.
contains
(
cert
))
{
return
new
X509Certificate
[]
{
chain
[
0
]};
}
// Remove and call validator on partial chain [0 .. i-1]
X509Certificate
[]
newChain
=
new
X509Certificate
[
i
];
System
.
arraycopy
(
chain
,
0
,
newChain
,
0
,
i
);
return
doValidate
(
newChain
,
pkixParameters
);
}
else
{
if
(!
dn
.
equals
(
prevIssuer
))
{
// chain is not ordered correctly, call builder instead
return
doBuild
(
chain
,
otherCerts
,
pkixParameters
);
}
// Check if chain[i] is already trusted. It may be inside
// trustedCerts, or has the same dn and public key as a cert
// inside trustedCerts. The latter happens when a CA has
// updated its cert with a stronger signature algorithm in JRE
// but the weak one is still in circulation.
if
(
trustedCerts
.
contains
(
cert
)
||
// trusted cert
(
trustedSubjects
.
containsKey
(
dn
)
&&
// replacing ...
trustedSubjects
.
get
(
dn
).
contains
(
// ... weak cert
cert
.
getPublicKey
())))
{
// Remove and call validator on partial chain [0 .. i-1]
X509Certificate
[]
newChain
=
new
X509Certificate
[
i
];
System
.
arraycopy
(
chain
,
0
,
newChain
,
0
,
i
);
return
doValidate
(
newChain
,
pkixParameters
);
}
}
prevIssuer
=
cert
.
getIssuerX500Principal
();
}
...
...
test/sun/security/tools/jarsigner/concise_jarsigner.sh
浏览文件 @
a275ce91
...
...
@@ -22,7 +22,7 @@
#
# @test
# @bug 6802846 8172529
# @bug 6802846 8172529
8227758
# @summary jarsigner needs enhanced cert validation(options)
#
# @run shell/timeout=240 concise_jarsigner.sh
...
...
@@ -207,15 +207,11 @@ $JARSIGNER -strict -keystore $KS -storepass changeit a.jar altchain
$JARSIGNER
-strict
-keystore
$KS
-storepass
changeit
-certchain
certchain a.jar altchain
[
$?
=
0
]
||
exit
$LINENO
# if ca2 is removed
, -certchain still work because altchain is a self-signed entry and
#
it is trusted by jarsigner
# if ca2 is removed
and cert is imported, -certchain won't work because this certificate
#
entry is not trusted
# save ca2.cert for easy replay
$KT
-exportcert
-file
ca2.cert
-alias
ca2
$KT
-delete
-alias
ca2
$JARSIGNER
-strict
-keystore
$KS
-storepass
changeit
-certchain
certchain a.jar altchain
[
$?
=
0
]
||
exit
$LINENO
# if cert is imported, -certchain won't work because this certificate entry is not trusted
$KT
-importcert
-file
certchain
-alias
altchain
-noprompt
$JARSIGNER
-strict
-keystore
$KS
-storepass
changeit
-certchain
certchain a.jar altchain
[
$?
=
4
]
||
exit
$LINENO
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录