Publié Tue, 18 Jun 2019 12:30:36 GMT par Romain Amoudjayan
I've made the following script in php in order to generate the url integration from an extranet.
Despite many researches, i can't find what is wrong. I always get the error message "DocuWare.Gapi.Utils.Web.DWIntegration.EX_INVALID_PASS_PHRASE".

I've tried to compare my results with the application URL creator but i never get the same url.

I'm not sure that my code is correct to hash the passphrase and split it to get the key and iv.

Any help would be very appreciated. Thank you
//script php to generate url integration for docuware

//hash passphrase with sha512 and get key and iv    ( )
$passphrase = hash('sha512', 'xxxxx');
$encryption_key  = substr($passphrase,0,32);
$iv = substr($passphrase,32,16);
echo "Passphrase hash: $passphrase\n";
echo "encryption_key: $encryption_key\n";
echo "iv: $iv\n";

//create parameters string to encrypt ( )
//p=D for Download
$param = '&p=D';        
//Docuware login in base64
$lc = 'User=xxx\nPwd=xxx';    
$lc = convertToUrlTokenFormat(base64_encode($lc));
$param = $param . '&lc=' . $lc;
//fc=guid of the concerned file cabinet
$param = $param . '&fc=xxx';    
//request in base64
$q = '[N__DOCUMENT]=xxx';    
$q = convertToUrlTokenFormat(base64_encode($q));
$param = $param . '&q=' . $q ;
//download type
$param = $param . '&dt=Download';    

echo "Before encryption: $param\n";

// Encrypt $param using aes-256-cbc cipher with the given encryption key and iv
// The 0 gives us the default options, but can be changed to OPENSSL_RAW_param or OPENSSL_ZERO_PADDING
$encrypted = openssl_encrypt($param, 'aes-256-cbc', $encryption_key, 0, $iv);
echo "Encrypted: $encrypted\n";

//Encrypted paramters string encrypted again in base64 (see )
$encryptedbase64 = convertToUrlTokenFormat(base64_encode($encrypted));
echo "EncryptedBase64: $encryptedbase64\n\n";

$url = 'http://xxx/DocuWare/Platform/WebClient/1/Integration?&ep=' . $encryptedbase64;
echo "URL: $url\n";
function convertToUrlTokenFormat($val)
    $padding = substr_count($val, '=');
    $val = str_replace('=', '', $val);
    $val .= $padding;
    $val = str_replace('+', '-', str_replace('/', '_', $val));
    return $val;
Publié Tue, 18 Jun 2019 12:31:36 GMT par Matthias Wieland DocuWare Europe GmbH Sr. Director Support EMEA
Dear Romain Amoudjayan! It looks like the Community cannot answer your question. Thats why we have opened a Support Request with the Number SR-69877-N4K5V for you. A Software Support Specialist will contact you directly to follow up. We will update this thread with the solution as soon as we have solved the Support Request. With Best Regards, DocuWare Support Team
Publié Sat, 11 Apr 2020 18:09:08 GMT par Aren Slootweg Developer
Hello Romain,

With the new update of Docuware 7.2 it no longer allowed to send the credentials only base64 encoded in the URL.
So I need to use the passphrase also to encode the complete URL.

Can you give some feedback how your question is answered by the Docuware support Team, or do you have a working solution ?

Kind regards,

Publié Tue, 14 Apr 2020 07:56:45 GMT par Romain Amoudjayan


No, it has never worked with PHP.

With the help of the support, i've tried to create a webservice in .Net, it worked locally, but not from an external access. I put this topic in standy for the moment.



Publié Tue, 14 Apr 2020 15:52:34 GMT par Aren Slootweg Developer
Hello Romain,

I asked some help at Docuware , Florian M. was able to help me out.

The passhrase needs to be utf8 encoded and the hash needs an extra parameter, set to true, needed for raw output 

$key = utf8_encode('password1234');
$passphrase = hash('sha512', $key, true);

Then one more change:
$encrypted = openssl_encrypt($param, 'aes-256-cbc', $encryption_key, 0, $iv);

Change the 0 to OPENSSL_RAW_DATA

$encrypted = openssl_encrypt($param, 'aes-256-cbc', $encryption_key, OPENSSL_RAW_DATA, $iv);

For me it works now! (-:

Hope it helps you also!

Publié Wed, 15 Apr 2020 08:35:43 GMT par Romain Amoudjayan
Hello Aren

Thanks a lot for this feedback. With these modifications, the result seems to work effectively!
I'll try to make further tests.

Thank you

You must be signed in to post in this forum.