JCE: skip WolfSSLKeyStoreTest.testLoadSystemCAKeyStore() if JAR has not been created yet
parent
fcb42188fd
commit
455fbb0cf0
|
@ -29,9 +29,19 @@ export DYLD_LIBRARY_PATH=../../../lib:$DYLD_LIBRARY_PATH
|
|||
|
||||
OUTDIR=`pwd`
|
||||
|
||||
# First argument can be passed in to represent path to
|
||||
# wolfcrypt-jni.jar provider JAR. If not given, use default.
|
||||
if [ -z "$1" ]; then
|
||||
# default wolfcrypt-jni.jar path
|
||||
PROVIDER_PATH="../../../lib/wolfcrypt-jni.jar"
|
||||
else
|
||||
# use custom provider path
|
||||
PROVIDER_PATH=$1
|
||||
fi
|
||||
|
||||
# ARGS: <input-keystore-name> <output-keystore-name> <in-password> <out-password> <java home>
|
||||
jks_to_wks() {
|
||||
${5}/bin/keytool -importkeystore -srckeystore ${1} -destkeystore ${2}.wks -srcstoretype JKS -deststoretype WKS -srcstorepass "$3" -deststorepass "$3" -deststorepass "$4" -provider com.wolfssl.provider.jce.WolfCryptProvider --providerpath ../../../lib/wolfcrypt-jni.jar &> /dev/null
|
||||
${5}/bin/keytool -importkeystore -srckeystore ${1} -destkeystore ${2}.wks -srcstoretype JKS -deststoretype WKS -srcstorepass "$3" -deststorepass "$3" -deststorepass "$4" -provider com.wolfssl.provider.jce.WolfCryptProvider --providerpath "$PROVIDER_PATH"
|
||||
if [ $? -ne 0 ]; then
|
||||
printf "Failed to convert JKS to WKS!"
|
||||
exit 1
|
||||
|
@ -58,6 +68,8 @@ else
|
|||
javaHome="$JAVA_HOME"
|
||||
fi
|
||||
|
||||
echo "PROVIDER_PATH: $PROVIDER_PATH"
|
||||
|
||||
# Set up Java include and library paths for OS X and Linux
|
||||
# NOTE: you may need to modify these if your platform uses different locations
|
||||
if [ "$OS" == "Darwin" ]; then
|
||||
|
|
|
@ -66,6 +66,11 @@ import java.security.spec.InvalidKeySpecException;
|
|||
import javax.crypto.KeyGenerator;
|
||||
import javax.crypto.SecretKey;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
|
||||
import com.wolfssl.provider.jce.WolfCryptProvider;
|
||||
|
||||
public class WolfSSLKeyStoreTest {
|
||||
|
@ -1423,7 +1428,9 @@ public class WolfSSLKeyStoreTest {
|
|||
String scriptName = "system-cacerts-to-wks.sh";
|
||||
String cacertsWKS = "cacerts.wks";
|
||||
String jssecacertsWKS = "jssecacerts.wks";
|
||||
String cmd = "cd " + userDir + scriptDir + " && /bin/sh " + scriptName;
|
||||
String providerJARPath = "/lib/wolfcrypt-jni.jar";
|
||||
String cmd = "cd " + userDir + scriptDir + " && /bin/sh " + scriptName +
|
||||
" " + userDir + providerJARPath;
|
||||
KeyStore store = null;
|
||||
String cacertsPass = "changeitchangeit";
|
||||
File cacertFile = null;
|
||||
|
@ -1432,6 +1439,11 @@ public class WolfSSLKeyStoreTest {
|
|||
* and cacert gen script won't be there. */
|
||||
Assume.assumeTrue(!isAndroid());
|
||||
|
||||
/* Skip of wolfcrypt-jni.jar does not exist. This can happen if we
|
||||
* are running via 'mvn test' and the jar has not been created yet */
|
||||
File jarFile = new File(userDir + providerJARPath);
|
||||
Assume.assumeTrue(jarFile.exists());
|
||||
|
||||
assertNotNull(userDir);
|
||||
|
||||
/* Call system-cacerts-to-wks.sh script, converts system cacerts
|
||||
|
|
Loading…
Reference in New Issue