title: openssl_sign(): supplied key param cannot be coerced into a private key
body: <p>I have googled to search answer for these problem.but I'm not able to find proper solution for my question as many answer was specific to problem related.</p>
  
  <p>when I tried to create digital signature of content using <code>XMLSecurityKey</code> and <code>openssl_sign</code> I'm getting warning and signature was not created.</p>
  
  <p>openssl_sign is throwing error as :</p>
  
  <pre><code>Warning: openssl_sign(): supplied key param cannot be coerced into a private key in /var/www/git/ta_client/accessService.php on line 105
  </code></pre>
  
  <p>And my code is:</p>
  
  <pre><code>public function _signMessage($encData, $configValues)
      {
  $decode = 'decode';
      $token = $encData['token'];
      $cipherValue = $encData['cipherValue'];
      $clientId = $encData['ClientId'];
      $grpCustNum = $encData['grpCustNum'];
  
      // Sign the concatenated string
      $toSign = $token . $cipherValue . $clientId . $grpCustNum;
  
      // Encrypt the token with the public key from vendor
      $cipher = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type'=&gt;'private')); // Reference to XMLSecLibs
      $cipher-&gt;loadKey($configValues['privkey'], true);
      try{
      if (! openssl_sign ($toSign, $signature, $cipher-&gt;key, OPENSSL_ALGO_MD5)) {
          openssl_error_string();
          throw new Exception();
      }
      }catch(Exception $e){
      print_r($e);
      die;
  }
      // append the decode values
      $encData['sign'] = urlencode(base64_encode($signature)) . $decode;
      $encData['token'] = urlencode($token) . $decode;
      $encData['cipherValue'] = urlencode($cipherValue) . $decode;
  
      return $encData;
  }
  </code></pre>
  
  <p>And my <code>$configValues['privkey']</code> is in xml format.Any suggestions?</p>