public function setX509Credentials ($cert, $key, $keypass, $type = 'PEM') {
    $this->addCurlOption(CURLOPT_SSLCERTTYPE, $type);
    $this->addCurlOption(CURLOPT_SSLCERT, $cert);
    $this->addCurlOption(CURLOPT_SSLKEY, $key);
    $this->addCurlOption(CURLOPT_SSLKEYPASSWD, $keypass);
    return $this;
  }