Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
82a84d63
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看板
提交
82a84d63
编写于
2月 03, 2010
作者:
W
weijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6922482: keytool's help on -file always shows 'output file'
Reviewed-by: wetmore
上级
7c3e3144
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
171 addition
and
115 deletion
+171
-115
src/share/classes/sun/security/tools/KeyTool.java
src/share/classes/sun/security/tools/KeyTool.java
+118
-115
test/sun/security/tools/keytool/file-in-help.sh
test/sun/security/tools/keytool/file-in-help.sh
+53
-0
未找到文件。
src/share/classes/sun/security/tools/KeyTool.java
浏览文件 @
82a84d63
/*
* Copyright 1997-20
09
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-20
10
Sun Microsystems, Inc. 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
...
...
@@ -77,6 +77,7 @@ import sun.security.x509.*;
import
static
java
.
security
.
KeyStore
.*;
import
static
sun
.
security
.
tools
.
KeyTool
.
Command
.*;
import
static
sun
.
security
.
tools
.
KeyTool
.
Option
.*;
/**
* This tool manages keystores.
...
...
@@ -150,77 +151,77 @@ public final class KeyTool {
enum
Command
{
CERTREQ
(
"Generates a certificate request"
,
"-alias"
,
"-sigalg"
,
"-file"
,
"-keypass"
,
"-keystore"
,
"-storepass"
,
"-storetype"
,
"-providername"
,
"-providerclass"
,
"-providerarg"
,
"-providerpath"
,
"-v"
,
"-protected"
),
ALIAS
,
SIGALG
,
FILEOUT
,
KEYPASS
,
KEYSTORE
,
STOREPASS
,
STORETYPE
,
PROVIDERNAME
,
PROVIDERCLASS
,
PROVIDERARG
,
PROVIDERPATH
,
V
,
PROTECTED
),
CHANGEALIAS
(
"Changes an entry's alias"
,
"-alias"
,
"-destalias"
,
"-keypass"
,
"-keystore"
,
"-storepass"
,
"-storetype"
,
"-providername"
,
"-providerclass"
,
"-providerarg"
,
"-providerpath"
,
"-v"
,
"-protected"
),
ALIAS
,
DESTALIAS
,
KEYPASS
,
KEYSTORE
,
STOREPASS
,
STORETYPE
,
PROVIDERNAME
,
PROVIDERCLASS
,
PROVIDERARG
,
PROVIDERPATH
,
V
,
PROTECTED
),
DELETE
(
"Deletes an entry"
,
"-alias"
,
"-keystore"
,
"-storepass"
,
"-storetype"
,
"-providername"
,
"-providerclass"
,
"-providerarg"
,
"-providerpath"
,
"-v"
,
"-protected"
),
ALIAS
,
KEYSTORE
,
STOREPASS
,
STORETYPE
,
PROVIDERNAME
,
PROVIDERCLASS
,
PROVIDERARG
,
PROVIDERPATH
,
V
,
PROTECTED
),
EXPORTCERT
(
"Exports certificate"
,
"-rfc"
,
"-alias"
,
"-file"
,
"-keystore"
,
"-storepass"
,
"-storetype"
,
"-providername"
,
"-providerclass"
,
"-providerarg"
,
"-providerpath"
,
"-v"
,
"-protected"
),
RFC
,
ALIAS
,
FILEOUT
,
KEYSTORE
,
STOREPASS
,
STORETYPE
,
PROVIDERNAME
,
PROVIDERCLASS
,
PROVIDERARG
,
PROVIDERPATH
,
V
,
PROTECTED
),
GENKEYPAIR
(
"Generates a key pair"
,
"-alias"
,
"-keyalg"
,
"-keysize"
,
"-sigalg"
,
"-destalias"
,
"-startdate"
,
"-ext"
,
"-validity"
,
"-keypass"
,
"-keystore"
,
"-storepass"
,
"-storetype"
,
"-providername"
,
"-providerclass"
,
"-providerarg"
,
"-providerpath"
,
"-v"
,
"-protected"
),
ALIAS
,
KEYALG
,
KEYSIZE
,
SIGALG
,
DESTALIAS
,
STARTDATE
,
EXT
,
VALIDITY
,
KEYPASS
,
KEYSTORE
,
STOREPASS
,
STORETYPE
,
PROVIDERNAME
,
PROVIDERCLASS
,
PROVIDERARG
,
PROVIDERPATH
,
V
,
PROTECTED
),
GENSECKEY
(
"Generates a secret key"
,
"-alias"
,
"-keypass"
,
"-keyalg"
,
"-keysize"
,
"-keystore"
,
"-storepass"
,
"-storetype"
,
"-providername"
,
"-providerclass"
,
"-providerarg"
,
"-providerpath"
,
"-v"
,
"-protected"
),
ALIAS
,
KEYPASS
,
KEYALG
,
KEYSIZE
,
KEYSTORE
,
STOREPASS
,
STORETYPE
,
PROVIDERNAME
,
PROVIDERCLASS
,
PROVIDERARG
,
PROVIDERPATH
,
V
,
PROTECTED
),
GENCERT
(
"Generates certificate from a certificate request"
,
"-rfc"
,
"-infile"
,
"-outfile"
,
"-alias"
,
"-sigalg"
,
"-startdate"
,
"-ext"
,
"-validity"
,
"-keypass"
,
"-keystore"
,
"-storepass"
,
"-storetype"
,
"-providername"
,
"-providerclass"
,
"-providerarg"
,
"-providerpath"
,
"-v"
,
"-protected"
),
RFC
,
INFILE
,
OUTFILE
,
ALIAS
,
SIGALG
,
STARTDATE
,
EXT
,
VALIDITY
,
KEYPASS
,
KEYSTORE
,
STOREPASS
,
STORETYPE
,
PROVIDERNAME
,
PROVIDERCLASS
,
PROVIDERARG
,
PROVIDERPATH
,
V
,
PROTECTED
),
IDENTITYDB
(
"Imports entries from a JDK 1.1.x-style identity database"
,
"-file"
,
"-storetype"
,
"-keystore"
,
"-storepass"
,
"-providername"
,
"-providerclass"
,
"-providerarg"
,
"-providerpath"
,
"-v"
),
FILEIN
,
STORETYPE
,
KEYSTORE
,
STOREPASS
,
PROVIDERNAME
,
PROVIDERCLASS
,
PROVIDERARG
,
PROVIDERPATH
,
V
),
IMPORTCERT
(
"Imports a certificate or a certificate chain"
,
"-noprompt"
,
"-trustcacerts"
,
"-protected"
,
"-alias"
,
"-file"
,
"-keypass"
,
"-keystore"
,
"-storepass"
,
"-storetype"
,
"-providername"
,
"-providerclass"
,
"-providerarg"
,
"-providerpath"
,
"-v"
),
NOPROMPT
,
TRUSTCACERTS
,
PROTECTED
,
ALIAS
,
FILEIN
,
KEYPASS
,
KEYSTORE
,
STOREPASS
,
STORETYPE
,
PROVIDERNAME
,
PROVIDERCLASS
,
PROVIDERARG
,
PROVIDERPATH
,
V
),
IMPORTKEYSTORE
(
"Imports one or all entries from another keystore"
,
"-srckeystore"
,
"-destkeystore"
,
"-srcstoretype"
,
"-deststoretype"
,
"-srcstorepass"
,
"-deststorepass"
,
"-srcprotected"
,
"-srcprovidername"
,
"-destprovidername"
,
"-srcalias"
,
"-destalias"
,
"-srckeypass"
,
"-destkeypass"
,
"-noprompt"
,
"-providerclass"
,
"-providerarg"
,
"-providerpath"
,
"-v"
),
SRCKEYSTORE
,
DESTKEYSTORE
,
SRCSTORETYPE
,
DESTSTORETYPE
,
SRCSTOREPASS
,
DESTSTOREPASS
,
SRCPROTECTED
,
SRCPROVIDERNAME
,
DESTPROVIDERNAME
,
SRCALIAS
,
DESTALIAS
,
SRCKEYPASS
,
DESTKEYPASS
,
NOPROMPT
,
PROVIDERCLASS
,
PROVIDERARG
,
PROVIDERPATH
,
V
),
KEYCLONE
(
"Clones a key entry"
,
"-alias"
,
"-destalias"
,
"-keypass"
,
"-new"
,
"-storetype"
,
"-keystore"
,
"-storepass"
,
"-providername"
,
"-providerclass"
,
"-providerarg"
,
"-providerpath"
,
"-v"
),
ALIAS
,
DESTALIAS
,
KEYPASS
,
NEW
,
STORETYPE
,
KEYSTORE
,
STOREPASS
,
PROVIDERNAME
,
PROVIDERCLASS
,
PROVIDERARG
,
PROVIDERPATH
,
V
),
KEYPASSWD
(
"Changes the key password of an entry"
,
"-alias"
,
"-keypass"
,
"-new"
,
"-keystore"
,
"-storepass"
,
"-storetype"
,
"-providername"
,
"-providerclass"
,
"-providerarg"
,
"-providerpath"
,
"-v"
),
ALIAS
,
KEYPASS
,
NEW
,
KEYSTORE
,
STOREPASS
,
STORETYPE
,
PROVIDERNAME
,
PROVIDERCLASS
,
PROVIDERARG
,
PROVIDERPATH
,
V
),
LIST
(
"Lists entries in a keystore"
,
"-rfc"
,
"-alias"
,
"-keystore"
,
"-storepass"
,
"-storetype"
,
"-providername"
,
"-providerclass"
,
"-providerarg"
,
"-providerpath"
,
"-v"
,
"-protected"
),
RFC
,
ALIAS
,
KEYSTORE
,
STOREPASS
,
STORETYPE
,
PROVIDERNAME
,
PROVIDERCLASS
,
PROVIDERARG
,
PROVIDERPATH
,
V
,
PROTECTED
),
PRINTCERT
(
"Prints the content of a certificate"
,
"-rfc"
,
"-file"
,
"-sslserver"
,
"-jarfile"
,
"-v"
),
RFC
,
FILEIN
,
SSLSERVER
,
JARFILE
,
V
),
PRINTCERTREQ
(
"Prints the content of a certificate request"
,
"-file"
,
"-v"
),
FILEIN
,
V
),
SELFCERT
(
"Generates a self-signed certificate"
,
"-alias"
,
"-sigalg"
,
"-dname"
,
"-startdate"
,
"-validity"
,
"-keypass"
,
"-storetype"
,
"-keystore"
,
"-storepass"
,
"-providername"
,
"-providerclass"
,
"-providerarg"
,
"-providerpath"
,
"-v"
),
ALIAS
,
SIGALG
,
DNAME
,
STARTDATE
,
VALIDITY
,
KEYPASS
,
STORETYPE
,
KEYSTORE
,
STOREPASS
,
PROVIDERNAME
,
PROVIDERCLASS
,
PROVIDERARG
,
PROVIDERPATH
,
V
),
STOREPASSWD
(
"Changes the store password of a keystore"
,
"-new"
,
"-keystore"
,
"-storepass"
,
"-storetype"
,
"-providername"
,
"-providerclass"
,
"-providerarg"
,
"-providerpath"
,
"-v"
);
NEW
,
KEYSTORE
,
STOREPASS
,
STORETYPE
,
PROVIDERNAME
,
PROVIDERCLASS
,
PROVIDERARG
,
PROVIDERPATH
,
V
);
final
String
description
;
final
String
[]
options
;
Command
(
String
d
,
String
...
o
)
{
final
Option
[]
options
;
Command
(
String
d
,
Option
...
o
)
{
description
=
d
;
options
=
o
;
}
...
...
@@ -230,50 +231,60 @@ public final class KeyTool {
}
};
private
static
String
[][]
options
=
{
// name, arg, description
{
"-alias"
,
"<alias>"
,
"alias name of the entry to process"
},
{
"-destalias"
,
"<destalias>"
,
"destination alias"
},
{
"-destkeypass"
,
"<arg>"
,
"destination key password"
},
{
"-destkeystore"
,
"<destkeystore>"
,
"destination keystore name"
},
{
"-destprotected"
,
null
,
"destination keystore password protected"
},
{
"-destprovidername"
,
"<destprovidername>"
,
"destination keystore provider name"
},
{
"-deststorepass"
,
"<arg>"
,
"destination keystore password"
},
{
"-deststoretype"
,
"<deststoretype>"
,
"destination keystore type"
},
{
"-dname"
,
"<dname>"
,
"distinguished name"
},
{
"-ext"
,
"<value>"
,
"X.509 extension"
},
{
"-file"
,
"<filename>"
,
"output file name"
},
{
"-file"
,
"<filename>"
,
"input file name"
},
{
"-infile"
,
"<filename>"
,
"input file name"
},
{
"-keyalg"
,
"<keyalg>"
,
"key algorithm name"
},
{
"-keypass"
,
"<arg>"
,
"key password"
},
{
"-keysize"
,
"<keysize>"
,
"key bit size"
},
{
"-keystore"
,
"<keystore>"
,
"keystore name"
},
{
"-new"
,
"<arg>"
,
"new password"
},
{
"-noprompt"
,
null
,
"do not prompt"
},
{
"-outfile"
,
"<filename>"
,
"output file name"
},
{
"-protected"
,
null
,
"password through protected mechanism"
},
{
"-providerarg"
,
"<arg>"
,
"provider argument"
},
{
"-providerclass"
,
"<providerclass>"
,
"provider class name"
},
{
"-providername"
,
"<providername>"
,
"provider name"
},
{
"-providerpath"
,
"<pathlist>"
,
"provider classpath"
},
{
"-rfc"
,
null
,
"output in RFC style"
},
{
"-sigalg"
,
"<sigalg>"
,
"signature algorithm name"
},
{
"-srcalias"
,
"<srcalias>"
,
"source alias"
},
{
"-srckeypass"
,
"<arg>"
,
"source keystore password"
},
{
"-srckeystore"
,
"<srckeystore>"
,
"source keystore name"
},
{
"-srcprotected"
,
null
,
"source keystore password protected"
},
{
"-srcprovidername"
,
"<srcprovidername>"
,
"source keystore provider name"
},
{
"-srcstorepass"
,
"<arg>"
,
"source keystore password"
},
{
"-srcstoretype"
,
"<srcstoretype>"
,
"source keystore type"
},
{
"-sslserver"
,
"<server[:port]>"
,
"SSL server host and port"
},
{
"-jarfile"
,
"<filename>"
,
"signed jar file"
},
{
"-startdate"
,
"<startdate>"
,
"certificate validity start date/time"
},
{
"-storepass"
,
"<arg>"
,
"keystore password"
},
{
"-storetype"
,
"<storetype>"
,
"keystore type"
},
{
"-trustcacerts"
,
null
,
"trust certificates from cacerts"
},
{
"-v"
,
null
,
"verbose output"
},
{
"-validity"
,
"<valDays>"
,
"validity number of days"
},
enum
Option
{
ALIAS
(
"alias"
,
"<alias>"
,
"alias name of the entry to process"
),
DESTALIAS
(
"destalias"
,
"<destalias>"
,
"destination alias"
),
DESTKEYPASS
(
"destkeypass"
,
"<arg>"
,
"destination key password"
),
DESTKEYSTORE
(
"destkeystore"
,
"<destkeystore>"
,
"destination keystore name"
),
DESTPROTECTED
(
"destprotected"
,
null
,
"destination keystore password protected"
),
DESTPROVIDERNAME
(
"destprovidername"
,
"<destprovidername>"
,
"destination keystore provider name"
),
DESTSTOREPASS
(
"deststorepass"
,
"<arg>"
,
"destination keystore password"
),
DESTSTORETYPE
(
"deststoretype"
,
"<deststoretype>"
,
"destination keystore type"
),
DNAME
(
"dname"
,
"<dname>"
,
"distinguished name"
),
EXT
(
"ext"
,
"<value>"
,
"X.509 extension"
),
FILEOUT
(
"file"
,
"<filename>"
,
"output file name"
),
FILEIN
(
"file"
,
"<filename>"
,
"input file name"
),
INFILE
(
"infile"
,
"<filename>"
,
"input file name"
),
KEYALG
(
"keyalg"
,
"<keyalg>"
,
"key algorithm name"
),
KEYPASS
(
"keypass"
,
"<arg>"
,
"key password"
),
KEYSIZE
(
"keysize"
,
"<keysize>"
,
"key bit size"
),
KEYSTORE
(
"keystore"
,
"<keystore>"
,
"keystore name"
),
NEW
(
"new"
,
"<arg>"
,
"new password"
),
NOPROMPT
(
"noprompt"
,
null
,
"do not prompt"
),
OUTFILE
(
"outfile"
,
"<filename>"
,
"output file name"
),
PROTECTED
(
"protected"
,
null
,
"password through protected mechanism"
),
PROVIDERARG
(
"providerarg"
,
"<arg>"
,
"provider argument"
),
PROVIDERCLASS
(
"providerclass"
,
"<providerclass>"
,
"provider class name"
),
PROVIDERNAME
(
"providername"
,
"<providername>"
,
"provider name"
),
PROVIDERPATH
(
"providerpath"
,
"<pathlist>"
,
"provider classpath"
),
RFC
(
"rfc"
,
null
,
"output in RFC style"
),
SIGALG
(
"sigalg"
,
"<sigalg>"
,
"signature algorithm name"
),
SRCALIAS
(
"srcalias"
,
"<srcalias>"
,
"source alias"
),
SRCKEYPASS
(
"srckeypass"
,
"<arg>"
,
"source keystore password"
),
SRCKEYSTORE
(
"srckeystore"
,
"<srckeystore>"
,
"source keystore name"
),
SRCPROTECTED
(
"srcprotected"
,
null
,
"source keystore password protected"
),
SRCPROVIDERNAME
(
"srcprovidername"
,
"<srcprovidername>"
,
"source keystore provider name"
),
SRCSTOREPASS
(
"srcstorepass"
,
"<arg>"
,
"source keystore password"
),
SRCSTORETYPE
(
"srcstoretype"
,
"<srcstoretype>"
,
"source keystore type"
),
SSLSERVER
(
"sslserver"
,
"<server[:port]>"
,
"SSL server host and port"
),
JARFILE
(
"jarfile"
,
"<filename>"
,
"signed jar file"
),
STARTDATE
(
"startdate"
,
"<startdate>"
,
"certificate validity start date/time"
),
STOREPASS
(
"storepass"
,
"<arg>"
,
"keystore password"
),
STORETYPE
(
"storetype"
,
"<storetype>"
,
"keystore type"
),
TRUSTCACERTS
(
"trustcacerts"
,
null
,
"trust certificates from cacerts"
),
V
(
"v"
,
null
,
"verbose output"
),
VALIDITY
(
"validity"
,
"<valDays>"
,
"validity number of days"
);
final
String
name
,
arg
,
description
;
Option
(
String
name
,
String
arg
,
String
description
)
{
this
.
name
=
name
;
this
.
arg
=
arg
;
this
.
description
=
description
;
}
@Override
public
String
toString
()
{
return
"-"
+
name
;
}
};
private
static
final
Class
[]
PARAM_STRING
=
{
String
.
class
};
...
...
@@ -344,10 +355,10 @@ public final class KeyTool {
// Check if the last option needs an arg
if
(
i
==
args
.
length
-
1
)
{
for
(
String
[]
option:
options
)
{
for
(
Option
option:
Option
.
values
()
)
{
// Only options with an arg need to be checked
if
(
collator
.
compare
(
flags
,
option
[
0
]
)
==
0
)
{
if
(
option
[
1
]
!=
null
)
errorNeedArgument
(
flags
);
if
(
collator
.
compare
(
flags
,
option
.
toString
()
)
==
0
)
{
if
(
option
.
arg
!=
null
)
errorNeedArgument
(
flags
);
break
;
}
}
...
...
@@ -3792,21 +3803,13 @@ public final class KeyTool {
// Length of left side of options list
int
lenLeft
=
0
;
for
(
int
j
=
0
;
j
<
left
.
length
;
j
++)
{
for
(
String
[]
opt:
options
)
{
if
(
collator
.
compare
(
opt
[
0
],
command
.
options
[
j
])
==
0
)
{
left
[
j
]
=
opt
[
0
];
if
(
opt
[
1
]
!=
null
)
left
[
j
]
+=
" "
+
opt
[
1
];
Option
opt
=
command
.
options
[
j
];
left
[
j
]
=
opt
.
toString
();
if
(
opt
.
arg
!=
null
)
left
[
j
]
+=
" "
+
opt
.
arg
;
if
(
left
[
j
].
length
()
>
lenLeft
)
{
lenLeft
=
left
[
j
].
length
();
}
right
[
j
]
=
rb
.
getString
(
opt
[
2
]);
found
=
true
;
break
;
}
}
if
(!
found
)
{
throw
new
RuntimeException
(
"ERROR: CANNOT FIND "
+
command
.
options
[
j
]);
}
right
[
j
]
=
rb
.
getString
(
opt
.
description
);
}
for
(
int
j
=
0
;
j
<
left
.
length
;
j
++)
{
System
.
err
.
printf
(
" %-"
+
lenLeft
+
"s %s\n"
,
...
...
test/sun/security/tools/keytool/file-in-help.sh
0 → 100644
浏览文件 @
82a84d63
#
# Copyright 2010 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
# @test
# @bug 6922482
# @summary keytool's help on -file always shows 'output 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
LANG
=
C
$TESTJAVA
${
FS
}
bin
${
FS
}
keytool
-printcertreq
-help
2> h1
||
exit
1
$TESTJAVA
${
FS
}
bin
${
FS
}
keytool
-exportcert
-help
2> h2
||
exit
2
grep
"input file"
h1
||
exit
3
grep
"output file"
h2
||
exit
4
exit
0
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录