refactor KSP related tests
This commit is contained in:
parent
0bb4703e2b
commit
aa04104bb2
|
@ -4,19 +4,11 @@ Fetch data from a prepopulated test table given a custom keystore provider
|
||||||
<?php require('skipif_not_ksp.inc'); ?>
|
<?php require('skipif_not_ksp.inc'); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
require( 'MsSetup.inc' );
|
require_once("MsCommon_mid-refactor.inc");
|
||||||
require( 'AE_Ksp.inc' );
|
|
||||||
|
|
||||||
$ksp_path = getKSPpath();
|
|
||||||
|
|
||||||
$connectionInfo = "Database = $databaseName; ColumnEncryption = Enabled; ";
|
|
||||||
$connectionInfo .= "CEKeystoreProvider = $ksp_path; ";
|
|
||||||
$connectionInfo .= "CEKeystoreName = $ksp_name; ";
|
|
||||||
$connectionInfo .= "CEKeystoreEncryptKey = $encrypt_key; ";
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$conn = new PDO( "sqlsrv:server = $server ; $connectionInfo", $uid, $pwd );
|
$conn = connect();
|
||||||
echo "Connected successfully with ColumnEncryption enabled and KSP specified.\n";
|
echo "Connected successfully with ColumnEncryption enabled and KSP specified.\n";
|
||||||
}
|
}
|
||||||
catch( PDOException $e )
|
catch( PDOException $e )
|
||||||
|
@ -26,15 +18,16 @@ Fetch data from a prepopulated test table given a custom keystore provider
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$tsql = "SELECT * FROM CustomKSPTestTable";
|
$tbname = KSP_TEST_TABLE;
|
||||||
|
$tsql = "SELECT * FROM $tbname";
|
||||||
$stmt = $conn->query($tsql);
|
$stmt = $conn->query($tsql);
|
||||||
while ($row = $stmt->fetch(PDO::FETCH_NUM))
|
while ($row = $stmt->fetch(PDO::FETCH_NUM))
|
||||||
{
|
{
|
||||||
echo "c1=" . $row[0] . "\tc2=" . $row[1] . "\tc3=" . $row[2] . "\tc4=" . $row[3] . "\n";
|
echo "c1=" . $row[0] . "\tc2=" . $row[1] . "\tc3=" . $row[2] . "\tc4=" . $row[3] . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = null;
|
unset($stmt);
|
||||||
$conn = null;
|
unset($conn);
|
||||||
|
|
||||||
echo "Done\n";
|
echo "Done\n";
|
||||||
|
|
||||||
|
|
|
@ -4,19 +4,11 @@ Fetch encrypted data from a prepopulated test table given a custom keystore prov
|
||||||
<?php require('skipif_not_ksp.inc'); ?>
|
<?php require('skipif_not_ksp.inc'); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
require( 'MsSetup.inc' );
|
require_once("MsCommon_mid-refactor.inc");
|
||||||
require( 'AE_Ksp.inc' );
|
|
||||||
|
|
||||||
$ksp_path = getKSPpath();
|
|
||||||
|
|
||||||
$connectionInfo = "Database = $databaseName; ";
|
|
||||||
$connectionInfo .= "CEKeystoreProvider = $ksp_path; ";
|
|
||||||
$connectionInfo .= "CEKeystoreName = $ksp_name; ";
|
|
||||||
$connectionInfo .= "CEKeystoreEncryptKey = $encrypt_key; ";
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$conn = new PDO( "sqlsrv:server = $server ; $connectionInfo", $uid, $pwd );
|
$conn = connect();
|
||||||
echo "Connected successfully with ColumnEncryption disabled and KSP specified.\n";
|
echo "Connected successfully with ColumnEncryption disabled and KSP specified.\n";
|
||||||
}
|
}
|
||||||
catch( PDOException $e )
|
catch( PDOException $e )
|
||||||
|
@ -26,7 +18,8 @@ Fetch encrypted data from a prepopulated test table given a custom keystore prov
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$tsql = "SELECT * FROM CustomKSPTestTable";
|
$tbname = KSP_TEST_TABLE;
|
||||||
|
$tsql = "SELECT * FROM $tbname";
|
||||||
$stmt = $conn->query($tsql);
|
$stmt = $conn->query($tsql);
|
||||||
while ($row = $stmt->fetch(PDO::FETCH_NUM))
|
while ($row = $stmt->fetch(PDO::FETCH_NUM))
|
||||||
{
|
{
|
||||||
|
@ -37,8 +30,8 @@ Fetch encrypted data from a prepopulated test table given a custom keystore prov
|
||||||
echo "\n" ;
|
echo "\n" ;
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = null;
|
unset($stmt);
|
||||||
$conn = null;
|
unset($conn);
|
||||||
|
|
||||||
echo "Done\n";
|
echo "Done\n";
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ Connect using a custom keystore provider with some required inputs missing
|
||||||
<?php require('skipif_not_ksp.inc'); ?>
|
<?php require('skipif_not_ksp.inc'); ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
require( 'MsSetup.inc' );
|
require("MsSetup.inc");
|
||||||
require( 'AE_Ksp.inc' );
|
require_once("MsCommon_mid-refactor.inc");
|
||||||
|
|
||||||
function connect( $connectionInfo )
|
function connect( $connectionInfo )
|
||||||
{
|
{
|
||||||
|
@ -25,6 +25,8 @@ Connect using a custom keystore provider with some required inputs missing
|
||||||
}
|
}
|
||||||
|
|
||||||
$ksp_path = getKSPpath();
|
$ksp_path = getKSPpath();
|
||||||
|
$ksp_name = KSP_NAME;
|
||||||
|
$encrypt_key = ENCRYPT_KEY;
|
||||||
|
|
||||||
echo("Connecting... with column encryption\n");
|
echo("Connecting... with column encryption\n");
|
||||||
$connectionInfo = "Database = $databaseName; ColumnEncryption = Enabled; ";
|
$connectionInfo = "Database = $databaseName; ColumnEncryption = Enabled; ";
|
||||||
|
|
Loading…
Reference in a new issue