test/jdk/sun/security/tools/keytool/importreadall.sh
author vtewari
Wed, 25 Apr 2018 12:29:48 +0530
changeset 49882 a02abc7e5536
parent 47216 71c04702a3d5
permissions -rw-r--r--
8144806: sun/security/tools/keytool/standard.sh fails intermittently at deleting x.jks Reviewed-by: weijun Contributed-by: bhanu.prakash.gopularam@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2289
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
     1
#
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 21342
diff changeset
     2
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
2289
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
     4
#
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
     7
# published by the Free Software Foundation.
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
     8
#
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
     9
# This code is distributed in the hope that it will be useful, but WITHOUT
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    11
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    12
# version 2 for more details (a copy is included in the LICENSE file that
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    13
# accompanied this code).
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    14
#
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    15
# You should have received a copy of the GNU General Public License version
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    16
# 2 along with this work; if not, write to the Free Software Foundation,
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    17
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    18
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2289
diff changeset
    19
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2289
diff changeset
    20
# or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2289
diff changeset
    21
# questions.
2289
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    22
#
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    23
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    24
# @test
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    25
# @bug 6819272
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    26
# @summary keytool -importcert should read the whole input
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    27
#
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    28
# @run shell importreadall.sh
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    29
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    30
# set a few environment variables so that the shell-script can run stand-alone
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    31
# in the source directory
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    32
if [ "${TESTSRC}" = "" ] ; then
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    33
   TESTSRC="."
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    34
fi
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    35
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    36
if [ "${TESTJAVA}" = "" ] ; then
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    37
  JAVA_CMD=`which java`
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    38
  TESTJAVA=`dirname $JAVA_CMD`/..
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    39
fi
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    40
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    41
# set platform-dependent variables
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    42
OS=`uname -s`
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    43
case "$OS" in
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    44
  Windows_* )
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    45
    FS="\\"
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    46
    ;;
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    47
  * )
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    48
    FS="/"
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    49
    ;;
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    50
esac
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    51
24116
9f9b4ba34aad 8040321: keytool and jarsigner tests doesn't pass though VM tools to tools
weijun
parents: 23010
diff changeset
    52
KEYTOOL="${TESTJAVA}${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -keystore importreadall.jks -storepass changeit -keypass changeit -keyalg rsa"
2289
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    53
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    54
# In case the test is run twice in the same directory
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    55
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    56
$KEYTOOL -delete -alias a
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    57
$KEYTOOL -delete -alias ca
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    58
$KEYTOOL -genkeypair -alias a -dname CN=a || exit 1
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    59
$KEYTOOL -genkeypair -alias ca -dname CN=ca || exit 2
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    60
$KEYTOOL -certreq -alias a | $KEYTOOL -gencert -alias ca | $KEYTOOL -importcert -alias a
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    61
99207c64bf80 6819272: keytool -importcert should read the whole input
weijun
parents:
diff changeset
    62
exit $?