test/jdk/sun/security/tools/keytool/i18n.html
author weijun
Fri, 15 Nov 2019 09:06:58 +0800
changeset 59104 046e4024e55a
parent 54521 8de62c4af8c7
permissions -rw-r--r--
8214024: Remove the default keytool -keyalg value Reviewed-by: mullan
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
<html>
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
<body>
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
54521
8de62c4af8c7 8180573: Refactor sun/security/tools shell tests to plain java tests
weijun
parents: 47216
diff changeset
     4
This is a multi-stage test.  For each instruction, make sure the output
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
from keytool is correct (you can read everything in english fine).
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
<ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
<li>    rm ~/.keystore
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
        If you are on a Windows platform, delete the .keystore file in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
        your home directory.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
<li>	keytool -help
59104
046e4024e55a 8214024: Remove the default keytool -keyalg value
weijun
parents: 54521
diff changeset
    12
<li>	keytool -genkey -keyalg DSA -v -keysize 512
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
	Enter "a" for the keystore password.  Check error (password too short).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
	Enter "password" for the keystore password.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
        Re-enter "password" to confirm.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
	Hit 'return' for "first and last name", "organizational unit",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
	"organization", "City", "State", and "Country Code".
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
	Type "yes" when they ask you if everything is correct.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
	Type 'return' for new key password.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
<li>	keytool -list -v -storepass password
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
<li>	keytool -list -v
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
	Type "a" for the keystore password.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
	Check error (wrong keystore password).
59104
046e4024e55a 8214024: Remove the default keytool -keyalg value
weijun
parents: 54521
diff changeset
    24
<li>	keytool -genkey -keyalg DSA -v -keysize 512
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
	Enter "password" as the password.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
	Check error (alias 'mykey' already exists).
59104
046e4024e55a 8214024: Remove the default keytool -keyalg value
weijun
parents: 54521
diff changeset
    27
<li>	keytool -genkey -keyalg DSA -v -keysize 512 -alias mykey2 -storepass password
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
	Hit 'return' for "first and last name", "organizational unit",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
	"organization", "City", "State", and "Country Code".
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
	Type "yes" when they ask you if everything is correct.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
	Type 'return' for new key password.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
<li>	keytool -list -v
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
	Type 'password' for the store password.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
<li>	keytool -keypasswd -v -alias mykey2 -storepass password
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
	Type "a" for the new key password.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
	Type "aaaaaa" for the new key password.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
	Type "bbbbbb" when re-entering the new key password.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
	Type "a" for the new key password.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
	Check Error (too many failures).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
<li>	keytool -keypasswd -v -alias mykey2 -storepass password
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
	Type "aaaaaa" for the new key password.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
	Type "aaaaaa" when re-entering the new key password.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
<li>	keytool -selfcert -v -alias mykey -storepass password
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
<li>	keytool -list -v -storepass password
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
<li>	keytool -export -v -alias mykey -file /tmp/cert -storepass password
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
<li>	keytool -import -v -file /tmp/cert -storepass password
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
	Check error (Certificate reply and cert are the same)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
<li>	keytool -printcert -file /tmp/cert
39633
9dc7586be5f0 8130302: jarsigner and keytool -providerClass needs be re-examined for modules
weijun
parents: 2
diff changeset
    49
<li>	keytool -list -storepass password -addprovider SUN
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
</ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
Error tests
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
<ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
<li>	keytool -storepasswd -storepass password -new abc
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
	Check error (password too short)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
<!--li>	keytool -list -storetype PKCS11
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
	Check error (-keystore must be NONE)-->
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
<li>	keytool -storepasswd -storetype PKCS11 -keystore NONE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
	Check error (unsupported operation)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
<li>	keytool -keypasswd -storetype PKCS11 -keystore NONE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
	Check error (unsupported operation)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
<li>	keytool -list -protected -storepass password
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
	Check error (password can not be specified with -protected)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
<li>	keytool -keypasswd -protected -keypass password
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
	Check error (password can not be specified with -protected)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
<li>	keytool -keypasswd -protected -new password
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
	Check error (password can not be specified with -protected)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
</ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
MSCAPI tests (Only run on Windows)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
<ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    <li>keytool -storetype Windows-MY -list
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    should list entries (may be 0) without asking for password
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    should not show ****** WARNING WARNING WARNING ****** lines
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    <li>keytool -storetype Windows-MY -list -keystore NONE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    should list entries without asking for password
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    <li>keytool -storetype Windows-MY -list -keystore other
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    Error: storetype must be NONE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    <li>keytool -storetype Windows-MY -list -storepass changeit
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    Error: storepass cannot be specfied
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    <li>keytool -storetype Windows-MY -list -storepasswd
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    Error: storepasswd not supported
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
</ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
PKCS#11 tests
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
<ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
<li>	sccs edit cert8.db key3.db
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
39633
9dc7586be5f0 8130302: jarsigner and keytool -providerClass needs be re-examined for modules
weijun
parents: 2
diff changeset
    92
<li>	keytool -keystore NONE -storepass test12 -storetype PKCS11 -providerName SunPKCS11-nss -addprovider SunPKCS11 -providerArg p11-nss.txt -genkey -alias genkey -dname cn=genkey -keysize 512 -keyalg rsa
9dc7586be5f0 8130302: jarsigner and keytool -providerClass needs be re-examined for modules
weijun
parents: 2
diff changeset
    93
<li>	keytool -keystore NONE -storepass test12 -storetype PKCS11 -providerName SunPKCS11-nss -addprovider SunPKCS11 -providerArg p11-nss.txt -list
9dc7586be5f0 8130302: jarsigner and keytool -providerClass needs be re-examined for modules
weijun
parents: 2
diff changeset
    94
<li>	keytool -keystore NONE -storepass test12 -storetype PKCS11 -providerName SunPKCS11-nss -addprovider SunPKCS11 -providerArg p11-nss.txt -list -alias genkey
9dc7586be5f0 8130302: jarsigner and keytool -providerClass needs be re-examined for modules
weijun
parents: 2
diff changeset
    95
<li>	keytool -keystore NONE -storepass test12 -storetype PKCS11 -providerName SunPKCS11-nss -addprovider SunPKCS11 -providerArg p11-nss.txt -certreq -alias genkey -file genkey.certreq
9dc7586be5f0 8130302: jarsigner and keytool -providerClass needs be re-examined for modules
weijun
parents: 2
diff changeset
    96
<li>	keytool -keystore NONE -storepass test12 -storetype PKCS11 -providerName SunPKCS11-nss -addprovider SunPKCS11 -providerArg p11-nss.txt -export -alias genkey -file genkey.cert
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
<li>	keytool -printcert -file genkey.cert
39633
9dc7586be5f0 8130302: jarsigner and keytool -providerClass needs be re-examined for modules
weijun
parents: 2
diff changeset
    98
<li>	keytool -keystore NONE -storepass test12 -storetype PKCS11 -providerName SunPKCS11-nss -addprovider SunPKCS11 -providerArg p11-nss.txt -selfcert -alias genkey -dname cn=selfCert
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
39633
9dc7586be5f0 8130302: jarsigner and keytool -providerClass needs be re-examined for modules
weijun
parents: 2
diff changeset
   100
<li>	keytool -keystore NONE -storepass test12 -storetype PKCS11 -providerName SunPKCS11-nss -addprovider SunPKCS11 -providerArg p11-nss.txt -list -alias genkey -v
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
(check that cert subject DN is [cn=selfCert])
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
39633
9dc7586be5f0 8130302: jarsigner and keytool -providerClass needs be re-examined for modules
weijun
parents: 2
diff changeset
   103
<li>	keytool -keystore NONE -storepass test12 -storetype PKCS11 -providerName SunPKCS11-nss -addprovider SunPKCS11 -providerArg p11-nss.txt -delete -alias genkey
9dc7586be5f0 8130302: jarsigner and keytool -providerClass needs be re-examined for modules
weijun
parents: 2
diff changeset
   104
<li>	keytool -keystore NONE -storepass test12 -storetype PKCS11 -providerName SunPKCS11-nss -addprovider SunPKCS11 -providerArg p11-nss.txt -list
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
(check for empty database listing)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
<li>	sccs unedit cert8.db key3.db
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
</ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
If all the output (english) is correct, then the test passed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
Otherwise, the test failed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
</body>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
</html>