We are receving this error when trying do a query on a field called EMPLOYEE. I convert the query data to base64 and also the login data to base 64 and then encrypt that using AES-128-CBC. I get the error listed below.
The request could not be served.
Status:
500 - Internal Server Error
Message:
DocuWare.Gapi.Utils.Web.DWIntegration.EX_INVALID_PASS_PHRASE
Exception
IntegrationInvalidParameterException: DocuWare.Gapi.Utils.Web.DWIntegration.EX_INVALID_PASS_PHRASE
I know this passphrase is correct because I can open URL creator and use it and it works fine. Any ideas here?
Here is the code being used from the Intranet of the company.
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
function encryptor($action, $string) {
$output = false;
$encrypt_method = "AES-128-CBC";
//pls set your unique hashing key
$secret_key = 'THEPASSPHRASE';
$secret_iv = 'THEPASSPHRASE';
// hash
$key = hash('sha512', $secret_key);
// iv - encrypt method AES-256-CBC expects 16 bytes - else you will get a warning
$key = substr(hash('sha256', $secret_key), 0, 32);
$iv = substr(hash('sha256', $secret_key), 32, 16);
//do the encyption given text/string/number
if( $action == 'encrypt' ) {
// $output = openssl_encrypt($string, $encrypt_method, $key, $options=OPENSSL_RAW_DATA, $iv);
$output = openssl_encrypt($string, $encrypt_method, $key, 0, $iv);
$output = base64_encode($output);
}
else if( $action == 'decrypt' ){
//decrypt the given text/string/number
$output = openssl_decrypt(base64_decode($string), $encrypt_method, $key, 0, $iv);
}
return $output;
}
function base64url_encode($plainText)
{
$base64 = base64_encode($plainText);
$base64url = strtr($base64, '+/', '-_');
return ($base64url);
}
?>
<script type="text/javascript">
function openit(URL,width,height)
{
var width;
var height;
var newWindow, args = "";
args += "height=" + height + ",width=" + width;
args += " ,menubar=yes, titlebar=yes,dependent=yes,scrollbars=yes,resizable=yes";
var popup = window.open("", "_blank", args) ;
popup.location = URL;
}
</script>
<?php
$User = 'USER';
// Setup query
$Qry = '[EMPLOYEE__]='.trim($User);
$QrySelect = '&q='.base64url_encode($Qry);
$login = 'User=Training User\nPwd=USERPASSWORD';
$loginSelect = '&lc='.base64url_encode($login);
$ep = $loginSelect.$QrySelect;
$epencrypt = encryptor('encrypt', $ep);
$EditCourseLink = 'http://docuware-01/DocuWare/PlatformRO/WebClient/1/Integration?ep='.$epencrypt;
echo "<table width='100%' cellspacing='0' cellpadding='0' border='0'>";
echo "</tr>";
echo "<tr>";
echo "<TD width='15%' align='center' >
<button type='button' class='button' onclick=\"openit('$EditCourseLink',900,800)\">Certifications</button>";
echo "</td>";
echo "</tr></table>";
// testing only
echo $key;
ECHO '<BR><BR>';
echo $iv;
ECHO '<BR><BR>';
ECHO '<BR><BR>';
ECHO 'QRY='.$Qry;
ECHO '<BR><BR>';
ECHO 'QrySelect= '.$QrySelect;
ECHO '<BR><BR>';
ECHO 'login='.$login;
ECHO '<BR><BR>';
ECHO 'loginSelect='.$loginSelect;
ECHO '<BR><BR>';
echo $ep;
echo '<br><BR>';
echo 'epencrypt= '.$epencrypt;
echo '<br>';
echo $EditCourseLink;
echo '<br><BR>';