author | tidu |
Wed, 29 Jun 2016 23:29:07 -0700 | |
changeset 39316 | 3042646f9b7b |
parent 27498 | b565dded1ead |
permissions | -rw-r--r-- |
14022
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
1 |
# |
26957
663b14c9b66f
8041740: Test sun/security/tools/keytool/ListKeychainStore.sh fails on Mac
vinnie
parents:
24116
diff
changeset
|
2 |
# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. |
14022
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
4 |
# |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
5 |
# This code is free software; you can redistribute it and/or modify it |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
7 |
# published by the Free Software Foundation. |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
8 |
# |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
9 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
10 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
11 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
12 |
# version 2 for more details (a copy is included in the LICENSE file that |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
13 |
# accompanied this code). |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
14 |
# |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
15 |
# You should have received a copy of the GNU General Public License version |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
16 |
# 2 along with this work; if not, write to the Free Software Foundation, |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
17 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
18 |
# |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
19 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
20 |
# or visit www.oracle.com if you need additional information or have any |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
21 |
# questions. |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
22 |
# |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
23 |
|
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
24 |
# @test |
27498
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
25 |
# @bug 7133495 8041740 8062264 8046777 |
14022
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
26 |
# @summary [macosx] KeyChain KeyStore implementation retrieves only one private key entry |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
27 |
|
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
28 |
if [ "${TESTJAVA}" = "" ] ; then |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
29 |
JAVAC_CMD=`which javac` |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
30 |
TESTJAVA=`dirname $JAVAC_CMD`/.. |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
31 |
fi |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
32 |
|
27291
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
33 |
if [ "${TESTSRC}" = "" ] ; then |
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
34 |
TESTSRC="." |
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
35 |
fi |
14022
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
36 |
if [ "${TESTCLASSES}" = "" ] ; then |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
37 |
TESTCLASSES=`pwd` |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
38 |
fi |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
39 |
|
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
40 |
# Only run on MacOS |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
41 |
OS=`uname -s` |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
42 |
case "$OS" in |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
43 |
Darwin ) |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
44 |
;; |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
45 |
* ) |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
46 |
echo "Will not run test on: ${OS}" |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
47 |
exit 0; |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
48 |
;; |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
49 |
esac |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
50 |
|
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
51 |
PWD="xxxxxx" |
24116
9f9b4ba34aad
8040321: keytool and jarsigner tests doesn't pass though VM tools to tools
weijun
parents:
23010
diff
changeset
|
52 |
KEYTOOL="${TESTJAVA}/bin/keytool ${TESTTOOLVMOPTS} -storetype KeychainStore -keystore NONE -storepass $PWD" |
14022
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
53 |
TEMPORARY_P12="$TESTCLASSES/7133495.p12" |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
54 |
TEMPORARY_KC="$TESTCLASSES/7133495.keychain" |
26957
663b14c9b66f
8041740: Test sun/security/tools/keytool/ListKeychainStore.sh fails on Mac
vinnie
parents:
24116
diff
changeset
|
55 |
TEMPORARY_LIST="$TESTCLASSES/7133495.tmp" |
14022
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
56 |
CLEANUP_P12="rm -f $TEMPORARY_P12" |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
57 |
CLEANUP_KC="security delete-keychain $TEMPORARY_KC" |
26957
663b14c9b66f
8041740: Test sun/security/tools/keytool/ListKeychainStore.sh fails on Mac
vinnie
parents:
24116
diff
changeset
|
58 |
CLEANUP_LIST="rm -f $TEMPORARY_LIST" |
14022
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
59 |
|
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
60 |
# Count the number of private key entries in the Keychain keystores |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
61 |
|
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
62 |
COUNT=`$KEYTOOL -list | grep PrivateKeyEntry | wc -l` |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
63 |
echo "Found $COUNT private key entries in the Keychain keystores" |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
64 |
|
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
65 |
# Create a temporary PKCS12 keystore containing 3 public/private keypairs |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
66 |
|
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
67 |
RESULT=`$CLEANUP_P12` |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
68 |
|
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
69 |
for i in X Y Z |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
70 |
do |
24116
9f9b4ba34aad
8040321: keytool and jarsigner tests doesn't pass though VM tools to tools
weijun
parents:
23010
diff
changeset
|
71 |
${TESTJAVA}/bin/keytool ${TESTTOOLVMOPTS} -genkeypair \ |
14022
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
72 |
-storetype PKCS12 \ |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
73 |
-keystore $TEMPORARY_P12 \ |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
74 |
-storepass $PWD \ |
21342
7bbb056a1c23
8027026: Change keytool -genkeypair to use -keyalg RSA
weijun
parents:
14022
diff
changeset
|
75 |
-keyalg rsa \ |
14022
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
76 |
-dname "CN=$i,OU=$i,O=$i,ST=$i,C=US" \ |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
77 |
-alias 7133495-$i |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
78 |
|
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
79 |
if [ $? -ne 0 ]; then |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
80 |
echo "Error: cannot create keypair $i in the temporary PKCS12 keystore" |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
81 |
RESULT=`$CLEANUP_P12` |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
82 |
exit 1 |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
83 |
fi |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
84 |
done |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
85 |
echo "Created a temporary PKCS12 keystore: $TEMPORARY_P12" |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
86 |
|
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
87 |
# Create a temporary keychain |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
88 |
|
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
89 |
security create-keychain -p $PWD $TEMPORARY_KC |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
90 |
if [ $? -ne 0 ]; then |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
91 |
echo "Error: cannot create the temporary keychain" |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
92 |
RESULT=`$CLEANUP_P12` |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
93 |
exit 2 |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
94 |
fi |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
95 |
echo "Created a temporary keychain: $TEMPORARY_KC" |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
96 |
|
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
97 |
# Unlock the temporary keychain |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
98 |
|
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
99 |
security unlock-keychain -p $PWD $TEMPORARY_KC |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
100 |
if [ $? -ne 0 ]; then |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
101 |
echo "Error: cannot unlock the temporary keychain" |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
102 |
RESULT=`$CLEANUP_P12` |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
103 |
RESULT=`$CLEANUP_KC` |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
104 |
exit 3 |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
105 |
fi |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
106 |
echo "Unlocked the temporary keychain" |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
107 |
|
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
108 |
# Import the keypairs from the PKCS12 keystore into the keychain |
27291
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
109 |
# (The '-A' option is used to lower the temporary keychain's access controls) |
14022
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
110 |
|
27291
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
111 |
security import $TEMPORARY_P12 -k $TEMPORARY_KC -f pkcs12 -P $PWD -A |
14022
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
112 |
if [ $? -ne 0 ]; then |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
113 |
echo "Error: cannot import keypairs from PKCS12 keystore into the keychain" |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
114 |
RESULT=`$CLEANUP_P12` |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
115 |
RESULT=`$CLEANUP_KC` |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
116 |
exit 4 |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
117 |
fi |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
118 |
echo "Imported keypairs from PKCS12 keystore into the keychain" |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
119 |
|
27498
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
120 |
# Generate a 2048-bit RSA keypair and import into the temporary keychain |
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
121 |
# (its private key is configured with non-default key usage settings) |
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
122 |
|
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
123 |
certtool c k=$TEMPORARY_KC <<EOF |
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
124 |
test |
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
125 |
r |
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
126 |
2048 |
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
127 |
y |
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
128 |
b |
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
129 |
s |
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
130 |
y |
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
131 |
A |
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
132 |
US |
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
133 |
A |
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
134 |
A |
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
135 |
|
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
136 |
|
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
137 |
y |
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
138 |
EOF |
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
139 |
|
26957
663b14c9b66f
8041740: Test sun/security/tools/keytool/ListKeychainStore.sh fails on Mac
vinnie
parents:
24116
diff
changeset
|
140 |
# Adjust the keychain search order |
663b14c9b66f
8041740: Test sun/security/tools/keytool/ListKeychainStore.sh fails on Mac
vinnie
parents:
24116
diff
changeset
|
141 |
|
663b14c9b66f
8041740: Test sun/security/tools/keytool/ListKeychainStore.sh fails on Mac
vinnie
parents:
24116
diff
changeset
|
142 |
echo "\"$TEMPORARY_KC\"" > $TEMPORARY_LIST |
663b14c9b66f
8041740: Test sun/security/tools/keytool/ListKeychainStore.sh fails on Mac
vinnie
parents:
24116
diff
changeset
|
143 |
security list-keychains >> $TEMPORARY_LIST |
663b14c9b66f
8041740: Test sun/security/tools/keytool/ListKeychainStore.sh fails on Mac
vinnie
parents:
24116
diff
changeset
|
144 |
security list-keychains -s `xargs < ${TEMPORARY_LIST}` |
663b14c9b66f
8041740: Test sun/security/tools/keytool/ListKeychainStore.sh fails on Mac
vinnie
parents:
24116
diff
changeset
|
145 |
`$CLEANUP_LIST` |
663b14c9b66f
8041740: Test sun/security/tools/keytool/ListKeychainStore.sh fails on Mac
vinnie
parents:
24116
diff
changeset
|
146 |
echo "Temporary keychain search order:" |
663b14c9b66f
8041740: Test sun/security/tools/keytool/ListKeychainStore.sh fails on Mac
vinnie
parents:
24116
diff
changeset
|
147 |
security list-keychains |
663b14c9b66f
8041740: Test sun/security/tools/keytool/ListKeychainStore.sh fails on Mac
vinnie
parents:
24116
diff
changeset
|
148 |
|
14022
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
149 |
# Recount the number of private key entries in the Keychain keystores |
27498
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
150 |
# (3 private keys imported from PKCS12, 1 private key generated by 'certtool') |
14022
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
151 |
|
27291
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
152 |
RECOUNT=`$KEYTOOL -list | grep PrivateKeyEntry | wc -l` |
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
153 |
echo "Found $RECOUNT private key entries in the Keychain keystore" |
27498
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
154 |
if [ $RECOUNT -lt `expr $COUNT + 4` ]; then |
27291
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
155 |
echo "Error: expected >$COUNT private key entries in the Keychain keystores" |
14022
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
156 |
RESULT=`$CLEANUP_P12` |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
157 |
RESULT=`$CLEANUP_KC` |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
158 |
exit 5 |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
159 |
fi |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
160 |
|
27291
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
161 |
# Export a private key from the keychain (without supplying a password) |
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
162 |
# Access controls have already been lowered (see 'security import ... -A' above) |
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
163 |
|
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
164 |
${TESTJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . ${TESTSRC}/ExportPrivateKeyNoPwd.java || exit 6 |
27498
b565dded1ead
8046777: apple.security.KeychainStore has a problem searching for identities
vinnie
parents:
27291
diff
changeset
|
165 |
${TESTJAVA}/bin/java ${TESTVMOPTS} ExportPrivateKeyNoPwd x |
27291
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
166 |
if [ $? -ne 0 ]; then |
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
167 |
echo "Error exporting private key from the temporary keychain" |
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
168 |
RESULT=`$CLEANUP_P12` |
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
169 |
RESULT=`$CLEANUP_KC` |
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
170 |
exit 6 |
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
171 |
fi |
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
172 |
echo "Exported a private key from the temporary keychain" |
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
173 |
|
14022
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
174 |
RESULT=`$CLEANUP_P12` |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
175 |
if [ $? -ne 0 ]; then |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
176 |
echo "Error: cannot remove the temporary PKCS12 keystore" |
27291
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
177 |
exit 7 |
14022
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
178 |
fi |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
179 |
echo "Removed the temporary PKCS12 keystore" |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
180 |
|
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
181 |
RESULT=`$CLEANUP_KC` |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
182 |
if [ $? -ne 0 ]; then |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
183 |
echo "Error: cannot remove the temporary keychain" |
27291
42769f9ca831
8062264: KeychainStore requires non-null password to be supplied when retrieving a private key
vinnie
parents:
26957
diff
changeset
|
184 |
exit 8 |
14022
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
185 |
fi |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
186 |
echo "Removed the temporary keychain" |
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
187 |
|
43384f14d41b
7133495: [macosx] KeyChain KeyStore implementation retrieves only one private key entry
vinnie
parents:
diff
changeset
|
188 |
exit 0 |