Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell11
提交
f459de54
D
dragonwell11
项目概览
openanolis
/
dragonwell11
通知
7
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f459de54
编写于
13年前
作者:
W
weijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7081783: jarsigner error when no $HOME/.keystore
Reviewed-by: xuelei
上级
742da97b
无相关合并请求
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
52 addition
and
43 deletion
+52
-43
jdk/src/share/classes/sun/security/tools/JarSigner.java
jdk/src/share/classes/sun/security/tools/JarSigner.java
+52
-43
未找到文件。
jdk/src/share/classes/sun/security/tools/JarSigner.java
浏览文件 @
f459de54
...
...
@@ -1506,6 +1506,9 @@ public class JarSigner {
CertPath
cp
=
certificateFactory
.
generateCertPath
(
certs
);
validator
.
validate
(
cp
,
pkixParameters
);
}
catch
(
Exception
e
)
{
if
(
debug
)
{
e
.
printStackTrace
();
}
chainNotValidated
=
true
;
s
.
append
(
tab
+
rb
.
getString
(
".CertPath.not.validated."
)
+
e
.
getLocalizedMessage
()
+
"]\n"
);
// TODO
...
...
@@ -1562,6 +1565,27 @@ public class JarSigner {
}
try
{
certificateFactory
=
CertificateFactory
.
getInstance
(
"X.509"
);
validator
=
CertPathValidator
.
getInstance
(
"PKIX"
);
Set
<
TrustAnchor
>
tas
=
new
HashSet
<>();
try
{
KeyStore
caks
=
KeyTool
.
getCacertsKeyStore
();
if
(
caks
!=
null
)
{
Enumeration
<
String
>
aliases
=
caks
.
aliases
();
while
(
aliases
.
hasMoreElements
())
{
String
a
=
aliases
.
nextElement
();
try
{
tas
.
add
(
new
TrustAnchor
((
X509Certificate
)
caks
.
getCertificate
(
a
),
null
));
}
catch
(
Exception
e2
)
{
// ignore, when a SecretkeyEntry does not include a cert
}
}
}
}
catch
(
Exception
e
)
{
// Ignore, if cacerts cannot be loaded
}
if
(
providerName
==
null
)
{
store
=
KeyStore
.
getInstance
(
storetype
);
}
else
{
...
...
@@ -1580,45 +1604,28 @@ public class JarSigner {
(
rb
.
getString
(
"Enter.Passphrase.for.keystore."
));
}
if
(
nullStream
)
{
store
.
load
(
null
,
storepass
);
}
else
{
keyStoreName
=
keyStoreName
.
replace
(
File
.
separatorChar
,
'/'
);
URL
url
=
null
;
try
{
url
=
new
URL
(
keyStoreName
);
}
catch
(
java
.
net
.
MalformedURLException
e
)
{
// try as file
url
=
new
File
(
keyStoreName
).
toURI
().
toURL
();
}
InputStream
is
=
null
;
try
{
is
=
url
.
openStream
();
store
.
load
(
is
,
storepass
);
}
finally
{
if
(
is
!=
null
)
{
is
.
close
();
}
}
}
Set
<
TrustAnchor
>
tas
=
new
HashSet
<>();
try
{
KeyStore
caks
=
KeyTool
.
getCacertsKeyStore
();
if
(
caks
!=
null
)
{
Enumeration
<
String
>
aliases
=
caks
.
aliases
();
while
(
aliases
.
hasMoreElements
())
{
String
a
=
aliases
.
nextElement
();
try
{
tas
.
add
(
new
TrustAnchor
((
X509Certificate
)
caks
.
getCertificate
(
a
),
null
));
}
catch
(
Exception
e2
)
{
// ignore, when a SecretkeyEntry does not include a cert
if
(
nullStream
)
{
store
.
load
(
null
,
storepass
);
}
else
{
keyStoreName
=
keyStoreName
.
replace
(
File
.
separatorChar
,
'/'
);
URL
url
=
null
;
try
{
url
=
new
URL
(
keyStoreName
);
}
catch
(
java
.
net
.
MalformedURLException
e
)
{
// try as file
url
=
new
File
(
keyStoreName
).
toURI
().
toURL
();
}
InputStream
is
=
null
;
try
{
is
=
url
.
openStream
();
store
.
load
(
is
,
storepass
);
}
finally
{
if
(
is
!=
null
)
{
is
.
close
();
}
}
}
}
catch
(
Exception
e
)
{
// Ignore, if cacerts cannot be loaded
}
if
(
store
!=
null
)
{
Enumeration
<
String
>
aliases
=
store
.
aliases
();
while
(
aliases
.
hasMoreElements
())
{
String
a
=
aliases
.
nextElement
();
...
...
@@ -1634,14 +1641,13 @@ public class JarSigner {
// ignore, when a SecretkeyEntry does not include a cert
}
}
}
certificateFactory
=
CertificateFactory
.
getInstance
(
"X.509"
);
validator
=
CertPathValidator
.
getInstance
(
"PKIX"
);
try
{
pkixParameters
=
new
PKIXParameters
(
tas
);
pkixParameters
.
setRevocationEnabled
(
false
);
}
catch
(
InvalidAlgorithmParameterException
ex
)
{
// Only if tas is empty
}
finally
{
try
{
pkixParameters
=
new
PKIXParameters
(
tas
);
pkixParameters
.
setRevocationEnabled
(
false
);
}
catch
(
InvalidAlgorithmParameterException
ex
)
{
// Only if tas is empty
}
}
}
catch
(
IOException
ioe
)
{
throw
new
RuntimeException
(
rb
.
getString
(
"keystore.load."
)
+
...
...
@@ -1805,6 +1811,9 @@ public class JarSigner {
CertPath
cp
=
certificateFactory
.
generateCertPath
(
Arrays
.
asList
(
certChain
));
validator
.
validate
(
cp
,
pkixParameters
);
}
catch
(
Exception
e
)
{
if
(
debug
)
{
e
.
printStackTrace
();
}
chainNotValidated
=
true
;
}
...
...
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
反馈
建议
客服
返回
顶部