• RE: Creation of URL integration in PHP

    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
  • RE: Creation of URL integration in PHP


    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.



  • RE: DWIntegration EX_INVALID_PASS_PHRASE-1529591502

    Thank you Joe. Something is maybe missing in the help in the explanation of the encryption (for example in the help page of the encryption algorithm, it was not written that after encryption with AES key, we have to encrypt again a second time in base 64)

    If i can't achieve the encryption in php, i will try in .net, but for the moment, i don't know how to make easily the link between my extranet, my erp, and another .net program.

  • RE: DWIntegration EX_INVALID_PASS_PHRASE-1529591502

    Hello Joe,
    Thanks for your feedback.
    Indeed, if i use my parameter strings ($param) with only the request q and the login lc encrypted in base64, it works correctly.

    But for security reason, i'd like to encrypt the complete parameter strings as indicated by docuware with the AES key in order to use it into the parameter "https://<url>/docuware/platform/webclient/1/Integration?ep=<parameters encrypted>" , because we will use these url on our extranet accessible directly on the web.
  • RE: DWIntegration EX_INVALID_PASS_PHRASE-1529591502


    I've found your post during my research on the same topic. I began with another example of code, but finally, it's very similar, but my code doesn't work too.

    Compared to your code, i've made differently the creation of key and iv. Also, in your function 'base64url_encode', i think you have to replace the = by 0,1 or 2 as the function HttpServerUtility.UrlTokenEncode as explained in docuware help page (http://help.docuware.com/en/#b64090t60284n89495 ) .

    Here is the post i've created:

    Thank you

  • Creation of URL integration in PHP

    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    ( http://help.docuware.com/en/#b64090t60297n89509 )
    $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 ( http://help.docuware.com/en/#b64090t61532n89494 )
    //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 https://support.docuware.com/fr-fr/knowledgebase/article/KBA-35664 )
    $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;