Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
fe83109e
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看板
提交
fe83109e
编写于
9月 09, 2011
作者:
M
michaelm
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
393c00fe
06a9a5a6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
75 addition
and
13 deletion
+75
-13
src/share/classes/sun/security/tools/KeyTool.java
src/share/classes/sun/security/tools/KeyTool.java
+10
-13
test/sun/security/tools/keytool/trystore.sh
test/sun/security/tools/keytool/trystore.sh
+65
-0
未找到文件。
src/share/classes/sun/security/tools/KeyTool.java
浏览文件 @
fe83109e
...
...
@@ -1141,17 +1141,14 @@ public final class KeyTool {
if
(
token
)
{
keyStore
.
store
(
null
,
null
);
}
else
{
FileOutputStream
fout
=
null
;
try
{
fout
=
(
nullStream
?
(
FileOutputStream
)
null
:
new
FileOutputStream
(
ksfname
));
keyStore
.
store
(
fout
,
(
storePassNew
!=
null
)
?
storePassNew
:
storePass
);
}
finally
{
if
(
fout
!=
null
)
{
fout
.
close
();
char
[]
pass
=
(
storePassNew
!=
null
)
?
storePassNew
:
storePass
;
if
(
nullStream
)
{
keyStore
.
store
(
null
,
pass
);
}
else
{
ByteArrayOutputStream
bout
=
new
ByteArrayOutputStream
();
keyStore
.
store
(
bout
,
pass
);
try
(
FileOutputStream
fout
=
new
FileOutputStream
(
ksfname
))
{
fout
.
write
(
bout
.
toByteArray
());
}
}
}
...
...
@@ -1399,7 +1396,7 @@ public final class KeyTool {
private
char
[]
promptForKeyPass
(
String
alias
,
String
orig
,
char
[]
origPass
)
throws
Exception
{
if
(
P12KEYSTORE
.
equalsIgnoreCase
(
storetype
))
{
return
origPass
;
}
else
if
(!
token
)
{
}
else
if
(!
token
&&
!
protectedPath
)
{
// Prompt for key password
int
count
;
for
(
count
=
0
;
count
<
3
;
count
++)
{
...
...
@@ -1446,7 +1443,7 @@ public final class KeyTool {
}
}
}
return
null
;
// PKCS11
return
null
;
// PKCS11
, MSCAPI, or -protected
}
/**
* Creates a new secret key.
...
...
test/sun/security/tools/keytool/trystore.sh
0 → 100644
浏览文件 @
fe83109e
#
# Copyright (c) 2011, 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.
#
# 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 7047200
# @summary keytool can try save to a byte array before overwrite the file
if
[
"
${
TESTJAVA
}
"
=
""
]
;
then
JAVAC_CMD
=
`
which javac
`
TESTJAVA
=
`
dirname
$JAVAC_CMD
`
/..
fi
# set platform-dependent variables
OS
=
`
uname
-s
`
case
"
$OS
"
in
Windows_
*
)
FS
=
"
\\
"
;;
*
)
FS
=
"/"
;;
esac
rm
trystore.jks 2> /dev/null
KEYTOOL
=
"
${
TESTJAVA
}${
FS
}
bin
${
FS
}
keytool -storetype jks -keystore trystore.jks"
$KEYTOOL
-genkeypair
-alias
a
-dname
CN
=
A
-storepass
changeit
-keypass
changeit
$KEYTOOL
-genkeypair
-alias
b
-dname
CN
=
B
-storepass
changeit
-keypass
changeit
# We use -protected for JKS keystore. This is illegal so the command should
# fail. Then we can check if the keystore is damaged.
$KEYTOOL
-genkeypair
-protected
-alias
b
-delete
-debug
if
[
$?
=
0
]
;
then
echo
"What? -protected works for JKS?"
exit
1
fi
$KEYTOOL
-list
-storepass
changeit
if
[
$?
!=
0
]
;
then
echo
"Keystore file damaged"
exit
2
fi
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录