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.
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);
}
?>
$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 "
";
echo "";
echo "";
echo " "; echo " | ";
echo "
";
// testing only
echo $key;
ECHO '
';
echo $iv;
ECHO '
';
ECHO '
';
ECHO 'QRY='.$Qry;
ECHO '
';
ECHO 'QrySelect= '.$QrySelect;
ECHO '
';
ECHO 'login='.$login;
ECHO '
';
ECHO 'loginSelect='.$loginSelect;
ECHO '
';
echo $ep;
echo '
';
echo 'epencrypt= '.$epencrypt;
echo '
';
echo $EditCourseLink;
echo '
';