From 9196c557f82649889c175dd2e7c8d0e13eabe666 Mon Sep 17 00:00:00 2001 From: v-kaywon Date: Tue, 5 Dec 2017 16:34:18 -0800 Subject: [PATCH] update MsCommon_mid-refactor.inc to not require AE_Ksp --- .../pdo_sqlsrv/MsCommon_mid-refactor.inc | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/test/functional/pdo_sqlsrv/MsCommon_mid-refactor.inc b/test/functional/pdo_sqlsrv/MsCommon_mid-refactor.inc index f235ef74..35a175c7 100644 --- a/test/functional/pdo_sqlsrv/MsCommon_mid-refactor.inc +++ b/test/functional/pdo_sqlsrv/MsCommon_mid-refactor.inc @@ -13,6 +13,10 @@ // to be runnable from the MSSQL teams' internal proprietary test running system // +const KSP_NAME = 'MyCustomKSPName'; +const ENCRYPT_KEY = 'LPKCWVD07N3RG98J0MBLG4H2'; +const KSP_TEST_TABLE = 'CustomKSPTestTable'; + function isAEQualified($conn) { $msodbcsql_ver = $conn->getAttribute(PDO::ATTR_CLIENT_VERSION)["DriverVer"]; @@ -81,8 +85,9 @@ function getDSN($sqlsrvserver, $database, $keywords = '', $disableCE = false) $dsn .= "ColumnEncryption=Enabled;"; } if ($keystore == "ksp" && !$disableCE) { - require('AE_Ksp.inc'); $ksp_path = getKSPPath(); + $ksp_name = KSP_NAME; + $encrypt_key = ENCRYPT_KEY; $dsn .= "CEKeystoreProvider=$ksp_path;CEKeystoreName=$ksp_name;CEKeystoreEncryptKey=$encrypt_key;"; } if ($keywords) { @@ -118,6 +123,27 @@ function getCekName() return $cekName; } +/** + * @return the path to the KSP dll/so file + */ +function getKSPpath() +{ + $name = 'myKSP'; + + $dir_name = realpath(dirname(__FILE__)); + $ksp = $dir_name . DIRECTORY_SEPARATOR . $name; + if ( strtoupper( substr( php_uname( 's' ), 0, 3 ) ) == 'WIN' ) { + $arch = 'x64'; + if ( PHP_INT_SIZE == 4 ) // running 32 bit + $arch = ''; + $ksp .= $arch . '.dll'; + } + else + $ksp .= '.so'; + + return $ksp; +} + /** * class for encapsulating column metadata needed for creating a table @@ -523,6 +549,13 @@ function isColEncrypted() } } + +function isAEConnected() +{ + require('MsSetup.inc'); + return $keystore != "none"; +} + function teardown() { // TBD