8164639: Configure PKCS11 tests to use user-supplied NSS libraries

Provide system property "test.nss.lib.paths" for specifying a set of absolute paths to the custom NSS lib directories

Reviewed-by: weijun, rhalade
This commit is contained in:
John Jiang 2018-08-15 18:41:18 +08:00
parent 4248ac828c
commit c70c37db8a
123 changed files with 349 additions and 192 deletions
test/jdk
ProblemList.txt
sun/security/pkcs11
Cipher
Config
KeyAgreement
KeyGenerator
KeyPairGenerator
KeyStore
Mac
MessageDigest
PKCS11Test.java
Provider
READMESampleTest.java
Secmod
SecureRandom
Serialize
Signature
ec
fips
nss/lib

@ -639,7 +639,7 @@ sun/security/pkcs11/KeyAgreement/UnsupportedDHKeys.java 8204203 windows-
sun/security/pkcs11/KeyGenerator/DESParity.java 8204203 windows-all
sun/security/pkcs11/KeyGenerator/TestKeyGenerator.java 8204203 windows-all
sun/security/pkcs11/KeyPairGenerator/TestDH2048.java 8204203 windows-all
sun/security/pkcs11/KeyStore/SecretKeysBasic.sh 8204203 windows-all
sun/security/pkcs11/KeyStore/SecretKeysBasic.sh 8204203,8209398 generic-all
sun/security/pkcs11/Mac/MacKAT.java 8204203 windows-all
sun/security/pkcs11/Mac/MacSameTest.java 8204203 windows-all
sun/security/pkcs11/Mac/ReinitMac.java 8204203 windows-all

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2018, 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
@ -24,6 +24,7 @@
/*
* @test
* @bug 8063700
* @library /test/lib
* @run main/othervm -Xcheck:jni JNICheck
*/

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
@ -26,7 +26,7 @@
* @bug 4856966
* @summary
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm ReinitCipher

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2018, 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
@ -26,7 +26,7 @@
* @bug 6687725
* @summary Test internal PKCS5Padding impl with various error conditions.
* @author Valerie Peng
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm TestPKCS5PaddingError
* @run main/othervm TestPKCS5PaddingError sm

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
@ -26,7 +26,7 @@
* @bug 4898468 6994008
* @summary basic test for RSA cipher
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm TestRSACipher

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2018, 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
@ -26,7 +26,7 @@
* @bug 6572331 6994008
* @summary basic test for RSA cipher key wrapping functionality
* @author Valerie Peng
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm TestRSACipherWrap
* @run main/othervm TestRSACipherWrap sm

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2018, 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
@ -26,7 +26,7 @@
* @bug 6994008
* @summary basic test for RSA/ECB/NoPadding cipher
* @author Valerie Peng
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm TestRawRSACipher

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2018, 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
@ -26,7 +26,7 @@
* @bug 4898461 6604496
* @summary basic test for symmetric ciphers with padding
* @author Valerie Peng
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm TestSymmCiphers

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2018, 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
@ -26,7 +26,7 @@
* @bug 4898484 6604496 8001284
* @summary basic test for symmetric ciphers with no padding
* @author Valerie Peng
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm TestSymmCiphersNoPad

@ -1,5 +1,5 @@
#
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2017, 2018, 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
@ -24,6 +24,7 @@
# @test
# @bug 8187023
# @summary Pkcs11 config file should be assumed in ISO-8859-1
# @library /test/lib
# @build ReadConfInUTF16Env
# @run shell ReadConfInUTF16Env.sh

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, 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
@ -25,7 +25,7 @@
* @test
* @bug 8072452
* @summary Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm SupportedDHKeys
* @run main/othervm SupportedDHKeys sm

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
@ -26,7 +26,7 @@
* @bug 4921804 6324825
* @summary Verify that DH works properly
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm -Djdk.crypto.KeyAgreement.legacyKDF=true TestDH
* @run main/othervm -Djdk.crypto.KeyAgreement.legacyKDF=true TestDH sm

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018, 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
@ -25,7 +25,7 @@
* @test
* @bug 7146728
* @summary Interop test for DH with secret that has a leading 0x00 byte
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm TestInterop
* @run main/othervm TestInterop sm

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
@ -26,7 +26,7 @@
* @bug 4942494 7146728
* @summary KAT test for DH (normal and with secret that has leading a 0x00 byte)
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm TestShort
* @run main/othervm TestShort sm

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018, 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
@ -25,7 +25,7 @@
* @test
* @bug 8072452
* @summary Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm UnsupportedDHKeys
* @run main/othervm UnsupportedDHKeys sm

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
@ -26,7 +26,7 @@
* @bug 4898479
* @summary Verify that the parity bits are set correctly
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm DESParity

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
@ -26,7 +26,7 @@
* @bug 4917233 6461727 6490213 6720456
* @summary test the KeyGenerator
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm TestKeyGenerator
* @run main/othervm TestKeyGenerator sm

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2018, 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
@ -26,7 +26,7 @@
* @bug 7196382 8072452
* @summary Ensure that DH key pairs can be generated for 512 - 8192 bits
* @author Valerie Peng
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm TestDH2048
* @run main/othervm TestDH2048 sm

@ -1,5 +1,5 @@
#
# Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2018, 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
@ -23,6 +23,7 @@
# @test
# @bug 4938185
# @library /test/lib
# @summary KeyStore support for NSS cert/key databases
#
# @run shell Basic.sh
@ -60,7 +61,8 @@ fi
echo TESTSRC=${TESTSRC}
echo TESTCLASSES=${TESTCLASSES}
echo TESTJAVA=${TESTJAVA}
echo echo COMPILEJAVA=${COMPILEJAVA}
echo COMPILEJAVA=${COMPILEJAVA}
echo CPAPPEND=${CPAPPEND}
echo ""
# get command from input args -
@ -168,16 +170,17 @@ fi
if [ "${RECOMPILE}" = "yes" ] ; then
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-classpath ${TESTSRC}${FS}..${PS}${TESTSRC}${FS}loader.jar \
-d ${TESTCLASSES} \
${TESTSRC}${FS}Basic.java \
${TESTSRC}${FS}..${FS}PKCS11Test.java
-classpath ${TESTSRC}${FS}..${PS}${TESTSRC}${FS}loader.jar \
-d ${TESTCLASSES} \
${TESTSRC}${FS}..${FS}..${FS}..${FS}..${FS}..${FS}lib${FS}jdk${FS}test${FS}lib${FS}artifacts${FS}*.java \
${TESTSRC}${FS}Basic.java \
${TESTSRC}${FS}..${FS}PKCS11Test.java
fi
# run test
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \
-classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar${PS}${CPAPPEND} \
-DDIR=${TESTSRC}${FS}BasicData \
-DCUSTOM_DB_DIR=${TESTCLASSES} \
-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}BasicData${FS}p11-${TOKEN}.txt \

@ -1,5 +1,5 @@
#
# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2018, 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
@ -25,7 +25,7 @@
# @bug 4938185 7106773
# @summary KeyStore support for NSS cert/key databases
# 512 bits RSA key cannot work with SHA384 and SHA512
#
# @library /test/lib
# @run shell ClientAuth.sh
# set a few environment variables so that the shell-script can run stand-alone
@ -47,6 +47,7 @@ echo TESTSRC=${TESTSRC}
echo TESTCLASSES=${TESTCLASSES}
echo TESTJAVA=${TESTJAVA}
echo COMPILEJAVA=${COMPILEJAVA}
echo CPAPPEND=${CPAPPEND}
echo ""
OS=`uname -s`
@ -128,13 +129,14 @@ ${CHMOD} +w ${TESTCLASSES}${FS}key3.db
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-classpath ${TESTSRC} \
-d ${TESTCLASSES} \
${TESTSRC}${FS}..${FS}..${FS}..${FS}..${FS}..${FS}lib${FS}jdk${FS}test${FS}lib${FS}artifacts${FS}*.java \
${TESTSRC}${FS}ClientAuth.java \
${TESTSRC}${FS}..${FS}PKCS11Test.java
# run test
echo "Run ClientAuth TLSv1 ..."
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-classpath ${TESTCLASSES} \
-classpath ${TESTCLASSES}${PS}${CPAPPEND} \
-DDIR=${TESTSRC}${FS}ClientAuthData${FS} \
-DCUSTOM_DB_DIR=${TESTCLASSES} \
-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ClientAuthData${FS}p11-nss.txt \
@ -155,7 +157,7 @@ fi
# run test
echo "Run ClientAuth TLSv1.1 ..."
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-classpath ${TESTCLASSES} \
-classpath ${TESTCLASSES}${PS}${CPAPPEND} \
-DDIR=${TESTSRC}${FS}ClientAuthData${FS} \
-DCUSTOM_DB_DIR=${TESTCLASSES} \
-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ClientAuthData${FS}p11-nss.txt \
@ -176,7 +178,7 @@ fi
# run test with specified TLS protocol and cipher suite
echo "Run ClientAuth TLSv1.2 TLS_DHE_RSA_WITH_AES_128_CBC_SHA"
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-classpath ${TESTCLASSES} \
-classpath ${TESTCLASSES}${PS}${CPAPPEND} \
-DDIR=${TESTSRC}${FS}ClientAuthData${FS} \
-DCUSTOM_DB_DIR=${TESTCLASSES} \
-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ClientAuthData${FS}p11-nss.txt \

@ -1,5 +1,5 @@
#
# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2008, 2018, 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
@ -25,7 +25,7 @@
# @bug 6599979
# @summary Ensure that re-assigning the alias works
#
# @library ..
# @library /test/lib ..
# @build SecretKeysBasic
# @run shell SecretKeysBasic.sh
#
@ -52,6 +52,7 @@ fi
echo TESTSRC=${TESTSRC}
echo TESTCLASSES=${TESTCLASSES}
echo TESTJAVA=${TESTJAVA}
echo CPAPPEND=${CPAPPEND}
echo ""
#DEBUG=sunpkcs11,pkcs11keystore
@ -130,9 +131,9 @@ then
${MKDIR} ${TESTCLASSES}${FS}pkcs11_softtoken${FS}public
echo ${CP} ${TESTSRC}${FS}BasicData${FS}pkcs11_softtoken${FS}objstore_info \
${TESTCLASSES}${FS}pkcs11_softtoken
${TESTCLASSES}${FS}pkcs11_softtoken
${CP} ${TESTSRC}${FS}BasicData${FS}pkcs11_softtoken${FS}objstore_info \
${TESTCLASSES}${FS}pkcs11_softtoken
${TESTCLASSES}${FS}pkcs11_softtoken
echo ${CHMOD} +w ${TESTCLASSES}${FS}pkcs11_softtoken${FS}objstore_info
${CHMOD} 600 ${TESTCLASSES}${FS}pkcs11_softtoken${FS}objstore_info
@ -142,16 +143,16 @@ fi
# run test
cd ${TESTSRC}
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-DDIR=${TESTSRC}${FS}BasicData${FS} \
-DDIR=${TESTSRC}${FS}BasicData${FS} \
-classpath \
${TESTCLASSES}${PS}${TESTCLASSES}${FS}..${PS}${TESTSRC}${FS}loader.jar \
${TESTCLASSES}${PS}${TESTCLASSES}${FS}..${PS}${TESTSRC}${FS}loader.jar${PS}${CPAPPEND} \
-DCUSTOM_DB_DIR=${TESTCLASSES} \
-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}BasicData${FS}p11-${token}.txt \
-DNO_DEFAULT=true \
-DNO_DEIMOS=true \
-DTOKEN=${token} \
-Djava.security.debug=${DEBUG} \
SecretKeysBasic
-DNO_DEFAULT=true \
-DNO_DEIMOS=true \
-DTOKEN=${token} \
-Djava.security.debug=${DEBUG} \
SecretKeysBasic
# -DCUSTOM_P11_CONFIG=${TESTSRC}${FS}BasicData${FS}p11-${token}.txt \

@ -1,5 +1,5 @@
#
# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2018, 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
@ -23,6 +23,7 @@
# @test
# @bug 5038659
# @library /test/lib
# @summary Enable PKCS#11 KeyStore for SunPKCS11-Solaris
#
# @run shell Solaris.sh
@ -138,17 +139,18 @@ if [ "${RECOMPILE}" = "yes" ] ; then
cd ${TESTCLASSES}
${RM} *.class
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-classpath ${TESTSRC}${FS}..${PS}${TESTSRC}${FS}loader.jar \
-d ${TESTCLASSES} \
${TESTSRC}${FS}Basic.java \
${TESTSRC}${FS}..${FS}PKCS11Test.java
-classpath ${TESTSRC}${FS}..${PS}${TESTSRC}${FS}loader.jar \
-d ${TESTCLASSES} \
${TESTSRC}${FS}..${FS}..${FS}..${FS}..${FS}..${FS}lib${FS}jdk${FS}test${FS}lib${FS}artifacts${FS}*.java \
${TESTSRC}${FS}Basic.java \
${TESTSRC}${FS}..${FS}PKCS11Test.java
fi
# run test
cd ${TESTSRC}
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \
-classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar${PS}${CPAPPEND} \
-DDIR=${TESTSRC}${FS}BasicData${FS} \
-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}BasicData${FS}p11-solaris.txt \
-DNO_DEFAULT=true \

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
@ -26,7 +26,7 @@
* @bug 4846410 6313661 4963723
* @summary Basic known-answer-test for Hmac algorithms
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm MacKAT
* @run main/othervm MacKAT sm

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2018, 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
@ -26,7 +26,7 @@
* @bug 8048603
* @summary Check if doFinal and update operation result in same Mac
* @author Yu-Ching Valerie Peng, Bill Situ, Alexander Fomin
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm MacSameTest
* @run main/othervm MacSameTest sm

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
@ -26,7 +26,7 @@
* @bug 4856966
* @summary
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm ReinitMac

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
@ -26,7 +26,7 @@
* @bug 4856966
* @summary Test the MessageDigest.update(ByteBuffer) method
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm ByteBuffers

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
@ -26,7 +26,7 @@
* @bug 4856966
* @summary Basic known-answer-test for all our MessageDigest algorithms
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm DigestKAT
* @run main/othervm DigestKAT sm

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
@ -26,7 +26,7 @@
* @bug 4856966
* @summary
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm ReinitDigest

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018, 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
@ -26,7 +26,7 @@
* @bug 6414899
* @summary Ensure the cloning functionality works.
* @author Valerie Peng
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm TestCloning

@ -53,6 +53,10 @@ import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.Set;
import jdk.test.lib.artifacts.Artifact;
import jdk.test.lib.artifacts.ArtifactResolver;
import jdk.test.lib.artifacts.ArtifactResolverException;
public abstract class PKCS11Test {
private boolean enableSM = false;
@ -300,15 +304,8 @@ public abstract class PKCS11Test {
}
static String getNSSLibDir(String library) throws Exception {
String osName = props.getProperty("os.name");
if (osName.startsWith("Win")) {
osName = "Windows";
} else if (osName.equals("Mac OS X")) {
osName = "MacOSX";
}
String osid = osName + "-"
+ props.getProperty("os.arch") + "-" + props.getProperty("sun.arch.data.model");
String[] nssLibDirs = osMap.get(osid);
String osid = getOsId();
String[] nssLibDirs = getNssLibPaths(osid);
if (nssLibDirs == null) {
System.out.println("Warning: unsupported OS: " + osid
+ ", please initialize NSS librarys location firstly, skipping test");
@ -323,6 +320,7 @@ public abstract class PKCS11Test {
if (new File(dir).exists() &&
new File(dir + System.mapLibraryName(library)).exists()) {
nssLibDir = dir;
System.out.println("nssLibDir: " + nssLibDir);
System.setProperty("pkcs11test.nss.libdir", nssLibDir);
break;
}
@ -334,6 +332,18 @@ public abstract class PKCS11Test {
return nssLibDir;
}
private static String getOsId() {
String osName = props.getProperty("os.name");
if (osName.startsWith("Win")) {
osName = "Windows";
} else if (osName.equals("Mac OS X")) {
osName = "MacOSX";
}
String osid = osName + "-" + props.getProperty("os.arch") + "-"
+ props.getProperty("sun.arch.data.model");
return osid;
}
static boolean isBadNSSVersion(Provider p) {
double nssVersion = getNSSVersion();
if (isNSS(p) && nssVersion >= 3.11 && nssVersion < 3.12) {
@ -644,34 +654,74 @@ public abstract class PKCS11Test {
return false;
}
private static final Map<String,String[]> osMap;
private static Map<String,String[]> osMap;
// Location of the NSS libraries on each supported platform
static {
private static Map<String, String[]> getOsMap() {
if (osMap != null) {
return osMap;
}
osMap = new HashMap<>();
osMap.put("SunOS-sparc-32", new String[]{"/usr/lib/mps/"});
osMap.put("SunOS-sparcv9-64", new String[]{"/usr/lib/mps/64/"});
osMap.put("SunOS-x86-32", new String[]{"/usr/lib/mps/"});
osMap.put("SunOS-amd64-64", new String[]{"/usr/lib/mps/64/"});
osMap.put("Linux-i386-32", new String[]{
"/usr/lib/i386-linux-gnu/", "/usr/lib32/", "/usr/lib/"});
osMap.put("Linux-amd64-64", new String[]{
"/usr/lib/x86_64-linux-gnu/", "/usr/lib/x86_64-linux-gnu/nss/",
"/usr/lib64/"});
osMap.put("Linux-ppc64-64", new String[]{"/usr/lib64/"});
osMap.put("Linux-ppc64le-64", new String[]{"/usr/lib64/"});
osMap.put("Linux-s390x-64", new String[]{"/usr/lib64/"});
osMap.put("Windows-x86-32", new String[]{
PKCS11_BASE + "/nss/lib/windows-i586/".replace('/', SEP)});
osMap.put("Windows-amd64-64", new String[]{
PKCS11_BASE + "/nss/lib/windows-amd64/".replace('/', SEP)});
osMap.put("MacOSX-x86_64-64", new String[]{
PKCS11_BASE + "/nss/lib/macosx-x86_64/"});
osMap.put("Linux-arm-32", new String[]{
"/usr/lib/arm-linux-gnueabi/nss/",
"/usr/lib/arm-linux-gnueabihf/nss/"});
osMap.put("Linux-aarch64-64", new String[]{
"/usr/lib/aarch64-linux-gnu/", "/usr/lib/aarch64-linux-gnu/nss/"});
osMap.put("SunOS-sparc-32", new String[] { "/usr/lib/mps/" });
osMap.put("SunOS-sparcv9-64", new String[] { "/usr/lib/mps/64/" });
osMap.put("SunOS-x86-32", new String[] { "/usr/lib/mps/" });
osMap.put("SunOS-amd64-64", new String[] { "/usr/lib/mps/64/" });
osMap.put("Linux-i386-32", new String[] {
"/usr/lib/i386-linux-gnu/",
"/usr/lib32/",
"/usr/lib/" });
osMap.put("Linux-amd64-64", new String[] {
"/usr/lib/x86_64-linux-gnu/",
"/usr/lib/x86_64-linux-gnu/nss/",
"/usr/lib64/" });
osMap.put("Linux-ppc64-64", new String[] { "/usr/lib64/" });
osMap.put("Linux-ppc64le-64", new String[] { "/usr/lib64/" });
osMap.put("Linux-s390x-64", new String[] { "/usr/lib64/" });
osMap.put("Windows-x86-32", new String[] {});
osMap.put("Windows-amd64-64", new String[] {});
osMap.put("MacOSX-x86_64-64", new String[] {});
osMap.put("Linux-arm-32", new String[] {
"/usr/lib/arm-linux-gnueabi/nss/",
"/usr/lib/arm-linux-gnueabihf/nss/" });
osMap.put("Linux-aarch64-64", new String[] {
"/usr/lib/aarch64-linux-gnu/",
"/usr/lib/aarch64-linux-gnu/nss/" });
return osMap;
}
private static String[] getNssLibPaths(String osId) {
String[] preferablePaths = getPreferableNssLibPaths(osId);
if (preferablePaths.length != 0) {
return preferablePaths;
} else {
return getOsMap().get(osId);
}
}
private static String[] getPreferableNssLibPaths(String osId) {
List<String> nssLibPaths = new ArrayList<>();
String customNssLibPaths = System.getProperty("test.nss.lib.paths");
if (customNssLibPaths == null) {
// If custom local NSS lib path is not provided,
// try to download NSS libs from artifactory
String path = fetchNssLib(osId);
if (path != null) {
nssLibPaths.add(path);
}
} else {
String[] paths = customNssLibPaths.split(",");
for (String path : paths) {
if (!path.endsWith(File.separator)) {
nssLibPaths.add(path + File.separator);
} else {
nssLibPaths.add(path);
}
}
}
return nssLibPaths.toArray(new String[nssLibPaths.size()]);
}
private final static char[] hexDigits = "0123456789abcdef".toCharArray();
@ -797,4 +847,60 @@ public abstract class PKCS11Test {
}
return data;
}
private static String fetchNssLib(String osId) {
switch (osId) {
case "Windows-x86-32":
return fetchNssLib(WINDOWS_X86.class);
case "Windows-amd64-64":
return fetchNssLib(WINDOWS_X64.class);
case "MacOSX-x86_64-64":
return fetchNssLib(MACOSX_X64.class);
default:
return null;
}
}
private static String fetchNssLib(Class<?> clazz) {
String path = null;
try {
path = ArtifactResolver.resolve(clazz).entrySet().stream()
.findAny().get().getValue() + File.separator + "nsslib"
+ File.separator;
} catch (ArtifactResolverException e) {
Throwable cause = e.getCause();
if (cause == null) {
System.out.println("Cannot resolve artifact, "
+ "please check if JIB jar is present in classpath.");
} else {
throw new RuntimeException("Fetch artifact failed: " + clazz
+ "\nPlease make sure the artifact is available.");
}
}
return path;
}
@Artifact(
organization = "jpg.tests.jdk.nsslib",
name = "nsslib-windows_x64",
revision = "3.35",
extension = "zip")
private static class WINDOWS_X64 { }
@Artifact(
organization = "jpg.tests.jdk.nsslib",
name = "nsslib-windows_x86",
revision = "3.35",
extension = "zip")
private static class WINDOWS_X86 { }
@Artifact(
organization = "jpg.tests.jdk.nsslib",
name = "nsslib-macosx_x64",
revision = "3.35",
extension = "zip")
private static class MACOSX_X64 { }
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2018, 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
@ -23,7 +23,7 @@
/*
* @test
* @bug 7003952 7191662
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @summary load DLLs and launch executables using fully qualified path
*/

@ -1,5 +1,5 @@
#
# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2004, 2018, 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
@ -48,6 +48,7 @@ echo TESTSRC=${TESTSRC}
echo TESTCLASSES=${TESTCLASSES}
echo TESTJAVA=${TESTJAVA}
echo COMPILEJAVA=${COMPILEJAVA}
echo CPAPPEND=${CPAPPEND}
echo ""
# let java test exit if platform unsupported
@ -105,13 +106,14 @@ esac
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-classpath ${TESTSRC}${FS}.. \
-d ${TESTCLASSES} \
${TESTSRC}${FS}..${FS}..${FS}..${FS}..${FS}..${FS}lib${FS}jdk${FS}test${FS}lib${FS}artifacts${FS}*.java \
${TESTSRC}${FS}ConfigQuotedString.java \
${TESTSRC}${FS}..${FS}PKCS11Test.java
# run test
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-classpath ${TESTCLASSES} \
-classpath ${TESTCLASSES}${PS}${CPAPPEND} \
-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}ConfigQuotedString-nss.txt \
-Dtest.src=${TESTSRC} \
-Dtest.classes=${TESTCLASSES} \

@ -49,6 +49,7 @@ echo TESTSRC=${TESTSRC}
echo TESTCLASSES=${TESTCLASSES}
echo TESTJAVA=${TESTJAVA}
echo COMPILEJAVA=${COMPILEJAVA}
echo CPAPPEND=${CPAPPEND}
echo ""
# let java test exit if platform unsupported
@ -114,13 +115,14 @@ ${CHMOD} +w ${TESTCLASSES}${FS}key3.db
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
-classpath ${TESTSRC}${FS}.. \
-d ${TESTCLASSES} \
${TESTSRC}${FS}..${FS}..${FS}..${FS}..${FS}..${FS}lib${FS}jdk${FS}test${FS}lib${FS}artifacts${FS}*.java \
${TESTSRC}${FS}Login.java \
${TESTSRC}${FS}..${FS}PKCS11Test.java
# run test
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-classpath ${TESTCLASSES} \
-classpath ${TESTCLASSES}${PS}${CPAPPEND} \
-DCUSTOM_DB_DIR=${TESTCLASSES} \
-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}Login-nss.txt \
-DNO_DEFAULT=true \

@ -1,13 +1,33 @@
This README is to keep a list facts and known workaround for the pkcs11 java tests
perform as a result of bugs or features in NSS or other pkcs11 libraries.
- How to get NSS libraries?
The libraries come from the following sources.
1. Specified by system property test.nss.lib.paths
System property test.nss.lib.paths can specify a set of absolute paths to
the local NSS library directories. The paths are separated by comma.
2. Pre-built NSS libraries from artifactory server
If the value of system property test.nss.lib.paths is not set, the tests will try
to download pre-built NSS libraries from artifactory server. Currently, the
tests only looks for libraries for Windows and MacOSX platforms on artifactory.
Please note that JIB jar MUST be present in classpath when downloading the
libraries.
3. System NSS libraries
If both of the above sources are not available, the tests will try to search
for the libraries in some system paths. The paths are platform-specific. Note
that, there is no such system path on Windows and MacOSX platforms. On these
platforms, it has to use source 1 or 2.
- NSS ECC None/Basic/Extended
The tests detect the NSS library support for Elliptic Curves as to not
report incorrect failures. PKCS11 reports back CKR_DOMAIN_PARAMS_INVALID
when the curve is not supported.
- Default libsoftokn3.so
By default PKCS11Test.java will look for libsoftokn3.so. There are a number of
By default PKCS11Test.java will look for libsoftokn3.so. There are a number of
tests, particularly in Secmod, that need libnss3.so. The method useNSS() in
PKCS11test.java is to change the search and version checking to libnss3.
@ -17,6 +37,6 @@ ECC Basic supports is secp256r1, secp384r1, and secp521r1.
read incorrectly. KeyStore/SecretKeysBasic.java tiggers this bug and
knows to avoid it.
- A number of EC tests fail because of a DER bug in NSS 3.11. The best guess
- A number of EC tests fail because of a DER bug in NSS 3.11. The best guess
is Mozilla bug 480280. Those tests that abort execution with a PASS result
are: TestECDH2, TestECDSA, TestECDSA2 and TestECGenSpec.

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
@ -26,7 +26,7 @@
* @bug 4000000
* @summary XXX todo
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
*/

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2018, 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
@ -26,7 +26,7 @@
* @bug 6414980
* @summary Test that the PKCS#11 KeyStore handles RSA, DSA, and EC keys
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm AddPrivateKey
* @run main/othervm AddPrivateKey sm policy
@ -63,6 +63,11 @@ public class AddPrivateKey extends SecmodTest {
private static final byte[] DATA = generateData(DATA_LENGTH);
public static void main(String[] args) throws Exception {
if (args.length > 1 && "sm".equals(args[0])) {
System.setProperty("java.security.policy",
BASE + File.separator + args[1]);
}
if (initSecmod() == false) {
return;
}
@ -77,8 +82,6 @@ public class AddPrivateKey extends SecmodTest {
Security.addProvider(p);
if (args.length > 1 && "sm".equals(args[0])) {
System.setProperty("java.security.policy",
BASE + File.separator + args[1]);
System.setSecurityManager(new SecurityManager());
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2018, 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
@ -26,7 +26,7 @@
* @bug 6298106
* @summary make sure we can add a trusted cert to the NSS KeyStore module
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm AddTrustedCert
* @run main/othervm AddTrustedCert sm policy
@ -48,6 +48,11 @@ import java.util.TreeSet;
public class AddTrustedCert extends SecmodTest {
public static void main(String[] args) throws Exception {
if (args.length > 1 && "sm".equals(args[0])) {
System.setProperty("java.security.policy",
BASE + File.separator + args[1]);
}
if (initSecmod() == false) {
return;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2018, 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
@ -26,7 +26,7 @@
* @bug 6329006
* @summary verify that NSS no-db mode works correctly
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm Crypto
* @run main/othervm Crypto sm policy

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2018, 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
@ -27,7 +27,7 @@
* @summary make sure we can access the NSS softtoken KeyStore
* and use a private key
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm GetPrivateKey
* @run main/othervm GetPrivateKey sm policy
@ -47,6 +47,11 @@ import java.util.TreeSet;
public class GetPrivateKey extends SecmodTest {
public static void main(String[] args) throws Exception {
if (args.length > 1 && "sm".equals(args[0])) {
System.setProperty("java.security.policy",
BASE + File.separator + args[1]);
}
if (initSecmod() == false) {
return;
}
@ -58,8 +63,6 @@ public class GetPrivateKey extends SecmodTest {
Security.addProvider(p);
if (args.length > 1 && "sm".equals(args[0])) {
System.setProperty("java.security.policy",
BASE + File.separator + args[1]);
System.setSecurityManager(new SecurityManager());
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2018, 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
@ -26,7 +26,7 @@
* @bug 6269847
* @summary store a NSS PKCS11 PrivateKeyEntry to JKS KeyStore throws confusing NPE
* @author Wang Weijun
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm JksSetPrivateKey
* @run main/othervm JksSetPrivateKey sm policy
@ -46,6 +46,11 @@ import java.util.TreeSet;
public class JksSetPrivateKey extends SecmodTest {
public static void main(String[] args) throws Exception {
if (args.length > 1 && "sm".equals(args[0])) {
System.setProperty("java.security.policy",
BASE + File.separator + args[1]);
}
if (initSecmod() == false) {
return;
}
@ -57,8 +62,6 @@ public class JksSetPrivateKey extends SecmodTest {
Security.addProvider(p);
if (args.length > 1 && "sm".equals(args[0])) {
System.setProperty("java.security.policy",
BASE + File.separator + args[1]);
System.setSecurityManager(new SecurityManager());
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, 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
@ -25,7 +25,7 @@
* @test
* @bug 8048622 8134232
* @summary Checks that PKCS#11 keystore can't be loaded with wrong password
* @library ../
* @library /test/lib ../
* @modules jdk.crypto.cryptoki
* @run main/othervm LoadKeystore
* @run main/othervm LoadKeystore sm policy
@ -43,6 +43,11 @@ import java.util.Collections;
public class LoadKeystore extends SecmodTest {
public static void main(String[] args) throws Exception {
if (args.length > 1 && "sm".equals(args[0])) {
System.setProperty("java.security.policy",
BASE + File.separator + args[1]);
}
if (!initSecmod()) {
return;
}
@ -55,8 +60,6 @@ public class LoadKeystore extends SecmodTest {
Security.addProvider(p);
if (args.length > 1 && "sm".equals(args[0])) {
System.setProperty("java.security.policy",
BASE + File.separator + args[1]);
System.setSecurityManager(new SecurityManager());
}

@ -28,7 +28,7 @@
* @summary Test NSS DB Sqlite
* @comment There is no NSS on Aix.
* @requires os.family != "aix"
* @library ../
* @library /test/lib ../
* @modules java.base/sun.security.rsa
* java.base/sun.security.provider
* java.base/sun.security.jca

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2018, 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
@ -26,7 +26,7 @@
* @bug 6298106 6275523 6420252 8059627
* @summary make sure we can access the NSS trust anchor module
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm TrustAnchors
* @run main/othervm TrustAnchors sm policy

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2018, 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
@ -26,7 +26,7 @@
* @bug 6246411
* @summary basic test for PKCS#11 SecureRandom
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm Basic

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2018, 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
@ -25,7 +25,7 @@
* @test
* @bug 6837847
* @summary Ensure a deserialized PKCS#11 SecureRandom is functional.
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
*/

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
@ -26,7 +26,7 @@
* @bug 4921802
* @summary Test that the SunPKCS11 provider can be serialized
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
*/

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
@ -26,7 +26,7 @@
* @bug 4856966
* @summary Test the Signature.update(ByteBuffer) method
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm ByteBuffers

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
@ -26,7 +26,7 @@
* @bug 4856966
* @summary test that reinitializing Signatures works correctly
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main ReinitSignature

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
@ -26,7 +26,7 @@
* @bug 4856966
* @summary basic test of SHA1withDSA and RawDSA signing/verifying
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm TestDSA

@ -26,7 +26,7 @@
* @bug 7200306 8029158
* @summary verify that P11Signature impl will error out when initialized
* with unsupported key sizes
* @library ..
* @library /test/lib ..
* @key randomness
* @modules jdk.crypto.cryptoki
* @run main/othervm TestDSAKeyLength

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2018, 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
@ -26,7 +26,7 @@
* @bug 6695485
* @summary Make sure initSign/initVerify() check RSA key lengths
* @author Yu-Ching Valerie Peng
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm TestRSAKeyLength
* @run main/othervm TestRSAKeyLength sm

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2018, 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
@ -27,7 +27,7 @@
* @summary Make sure that we can parse certificates using various named curves
* and verify their signatures
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @library ../../../../java/security/testlibrary
* @modules jdk.crypto.cryptoki
* @run main/othervm ReadCertificates

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2018, 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
@ -26,7 +26,7 @@
* @bug 6405536
* @summary Verify that we can parse ECPrivateKeys from PKCS#12 and use them
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @library ../../../../java/security/testlibrary
* @key randomness
* @modules jdk.crypto.cryptoki

@ -26,7 +26,7 @@
* @bug 6405536 6414980
* @summary Basic consistency test for all curves using ECDSA and ECDH
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki/sun.security.pkcs11.wrapper
* @run main/othervm TestCurves
* @run main/othervm TestCurves sm

@ -26,7 +26,7 @@
* @bug 6405536
* @summary Basic known answer test for ECDH
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @library ../../../../java/security/testlibrary
* @modules jdk.crypto.cryptoki
* @run main/othervm TestECDH

@ -26,7 +26,7 @@
* @bug 6405536
* @summary basic test of ECDSA signatures for P-256 and P-384 from the
* example data in "Suite B Implementer's Guide to FIPS 186-3".
* @library ..
* @library /test/lib ..
* @library ../../../../java/security/testlibrary
* @modules java.base/sun.security.util
* jdk.crypto.cryptoki

@ -26,7 +26,7 @@
* @bug 6405536 8042967
* @summary basic test of SHA1withECDSA and NONEwithECDSA signing/verifying
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @library ../../../../java/security/testlibrary
* @key randomness
* @modules jdk.crypto.cryptoki

@ -26,7 +26,7 @@
* @bug 6405536
* @summary basic test of ECDSA signatures for P-256 and P-384 from the
* example data in "Suite B Implementer's Guide to FIPS 186-3".
* @library ..
* @library /test/lib ..
* @library ../../../../java/security/testlibrary
* @modules java.base/sun.security.util
* jdk.crypto.cryptoki

@ -26,7 +26,7 @@
* @bug 6405536
* @summary Verify that we can use ECGenParameterSpec
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm TestECGenSpec
* @run main/othervm TestECGenSpec sm

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2018, 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
@ -26,7 +26,7 @@
* @bug 6405536
* @summary Test the P11ECKeyFactory
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules jdk.crypto.cryptoki
* @run main/othervm TestKeyFactory
* @run main/othervm TestKeyFactory sm

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2018, 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
@ -25,7 +25,7 @@
* @test
* @bug 6313675 6323647 8028192
* @summary Verify that all ciphersuites work in FIPS mode
* @library ..
* @library /test/lib ..
* @author Andreas Sterbenz
* @modules java.base/com.sun.net.ssl.internal.ssl
* @run main/manual ClientJSSEServerJSSE

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2018, 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
@ -26,7 +26,7 @@
* @bug 6323647
* @summary Verify that the SunJSSE trustmanager works correctly in FIPS mode
* @author Andreas Sterbenz
* @library ..
* @library /test/lib ..
* @modules java.base/com.sun.net.ssl.internal.ssl
* @run main/othervm TrustManagerTest
* @run main/othervm TrustManagerTest sm TrustManagerTest.policy

Some files were not shown because too many files have changed in this diff Show More