update MsCommon_mid-refactor.inc to not require AE_Ksp

This commit is contained in:
v-kaywon 2017-12-05 16:34:18 -08:00
parent 8297fce1b9
commit 9196c557f8

View file

@ -13,6 +13,10 @@
// to be runnable from the MSSQL teams' internal proprietary test running system // 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) function isAEQualified($conn)
{ {
$msodbcsql_ver = $conn->getAttribute(PDO::ATTR_CLIENT_VERSION)["DriverVer"]; $msodbcsql_ver = $conn->getAttribute(PDO::ATTR_CLIENT_VERSION)["DriverVer"];
@ -81,8 +85,9 @@ function getDSN($sqlsrvserver, $database, $keywords = '', $disableCE = false)
$dsn .= "ColumnEncryption=Enabled;"; $dsn .= "ColumnEncryption=Enabled;";
} }
if ($keystore == "ksp" && !$disableCE) { if ($keystore == "ksp" && !$disableCE) {
require('AE_Ksp.inc');
$ksp_path = getKSPPath(); $ksp_path = getKSPPath();
$ksp_name = KSP_NAME;
$encrypt_key = ENCRYPT_KEY;
$dsn .= "CEKeystoreProvider=$ksp_path;CEKeystoreName=$ksp_name;CEKeystoreEncryptKey=$encrypt_key;"; $dsn .= "CEKeystoreProvider=$ksp_path;CEKeystoreName=$ksp_name;CEKeystoreEncryptKey=$encrypt_key;";
} }
if ($keywords) { if ($keywords) {
@ -118,6 +123,27 @@ function getCekName()
return $cekName; 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 * 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() function teardown()
{ {
// TBD // TBD