Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-release > by-pkgid > ddac64d6cf5bff6699d858c22b637a35 > files > 21

lib64qoauth-devel-1.0.1-8.mga5.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.8"/>
<title>QOAuth: QOAuth::Interface Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">QOAuth
   &#160;<span id="projectnumber">1.0.1</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.8 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespace_q_o_auth.html">QOAuth</a></li><li class="navelem"><a class="el" href="class_q_o_auth_1_1_interface.html">Interface</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="class_q_o_auth_1_1_interface-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">QOAuth::Interface Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>This class provides means for interaction with network services supporting OAuth authorization scheme.  
 <a href="class_q_o_auth_1_1_interface.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="src_2interface_8h_source.html">QtOAuth</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for QOAuth::Interface:</div>
<div class="dyncontent">
 <div class="center">
  <img src="class_q_o_auth_1_1_interface.png" usemap="#QOAuth::Interface_map" alt=""/>
  <map id="QOAuth::Interface_map" name="QOAuth::Interface_map">
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a414600d2ddbca447248a57ade8d79535"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a414600d2ddbca447248a57ade8d79535"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_q_o_auth_1_1_interface.html#a414600d2ddbca447248a57ade8d79535">Interface</a> (QObject *parent=0)</td></tr>
<tr class="memdesc:a414600d2ddbca447248a57ade8d79535"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new <a class="el" href="class_q_o_auth_1_1_interface.html" title="This class provides means for interaction with network services supporting OAuth authorization scheme...">QOAuth::Interface</a> class instance with the given <em>parent</em>. <br /></td></tr>
<tr class="separator:a414600d2ddbca447248a57ade8d79535"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8ccd2711b06fae13e6554051ffadad27"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_q_o_auth_1_1_interface.html#a8ccd2711b06fae13e6554051ffadad27">Interface</a> (QNetworkAccessManager *manager, QObject *parent=0)</td></tr>
<tr class="memdesc:a8ccd2711b06fae13e6554051ffadad27"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new <a class="el" href="class_q_o_auth_1_1_interface.html" title="This class provides means for interaction with network services supporting OAuth authorization scheme...">QOAuth::Interface</a> class instance with the given <em>parent</em>, using <em>manager</em> for network connections.  <a href="#a8ccd2711b06fae13e6554051ffadad27">More...</a><br /></td></tr>
<tr class="separator:a8ccd2711b06fae13e6554051ffadad27"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad45f647eb9c3f1aab1cbfb95dc86ee87"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad45f647eb9c3f1aab1cbfb95dc86ee87"></a>
virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_q_o_auth_1_1_interface.html#ad45f647eb9c3f1aab1cbfb95dc86ee87">~Interface</a> ()</td></tr>
<tr class="memdesc:ad45f647eb9c3f1aab1cbfb95dc86ee87"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroys the <a class="el" href="class_q_o_auth_1_1_interface.html" title="This class provides means for interaction with network services supporting OAuth authorization scheme...">QOAuth::Interface</a> object. <br /></td></tr>
<tr class="separator:ad45f647eb9c3f1aab1cbfb95dc86ee87"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa39f382acd254adccc42937a931b18ad"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa39f382acd254adccc42937a931b18ad"></a>
QNetworkAccessManager *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_q_o_auth_1_1_interface.html#aa39f382acd254adccc42937a931b18ad">networkAccessManager</a> () const </td></tr>
<tr class="memdesc:aa39f382acd254adccc42937a931b18ad"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the network access manager used by the interface. <br /></td></tr>
<tr class="separator:aa39f382acd254adccc42937a931b18ad"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3b54987fa7f0757d0475d4d0a1ecf867"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_q_o_auth_1_1_interface.html#a3b54987fa7f0757d0475d4d0a1ecf867">setNetworkAccessManager</a> (QNetworkAccessManager *manager)</td></tr>
<tr class="memdesc:a3b54987fa7f0757d0475d4d0a1ecf867"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets <em>manager</em> to be the network access manager used by the interface.  <a href="#a3b54987fa7f0757d0475d4d0a1ecf867">More...</a><br /></td></tr>
<tr class="separator:a3b54987fa7f0757d0475d4d0a1ecf867"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afa8c4d004b0beddb71066c069e6cfebf"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_q_o_auth_1_1_interface.html#afa8c4d004b0beddb71066c069e6cfebf">setRSAPrivateKey</a> (const QString &amp;key, const QCA::SecureArray &amp;passphrase=QCA::SecureArray())</td></tr>
<tr class="separator:afa8c4d004b0beddb71066c069e6cfebf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7a2066da8941a5f3e04ae109b2362f30"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_q_o_auth_1_1_interface.html#a7a2066da8941a5f3e04ae109b2362f30">setRSAPrivateKeyFromFile</a> (const QString &amp;filename, const QCA::SecureArray &amp;passphrase=QCA::SecureArray())</td></tr>
<tr class="separator:a7a2066da8941a5f3e04ae109b2362f30"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6b7efa2ba4271451faf108ad4f3b6c48"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">ParamMap</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_q_o_auth_1_1_interface.html#a6b7efa2ba4271451faf108ad4f3b6c48">requestToken</a> (const QString &amp;requestUrl, <a class="el" href="namespace_q_o_auth.html#aa0e0bd4d8c1802873d3b3d2deb099319">HttpMethod</a> httpMethod, <a class="el" href="namespace_q_o_auth.html#a4cc48c641aa9025d289d7d7e013f766f">SignatureMethod</a> signatureMethod=<a class="el" href="namespace_q_o_auth.html#a4cc48c641aa9025d289d7d7e013f766fa74bc0d418aa61ebf3efc38282d6d22b0">HMAC_SHA1</a>, const <a class="el" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">ParamMap</a> &amp;params=<a class="el" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">ParamMap</a>())</td></tr>
<tr class="separator:a6b7efa2ba4271451faf108ad4f3b6c48"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5ed464673068dcef2fdf5182f9f7c966"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">ParamMap</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_q_o_auth_1_1_interface.html#a5ed464673068dcef2fdf5182f9f7c966">accessToken</a> (const QString &amp;requestUrl, <a class="el" href="namespace_q_o_auth.html#aa0e0bd4d8c1802873d3b3d2deb099319">HttpMethod</a> httpMethod, const QByteArray &amp;token, const QByteArray &amp;tokenSecret, <a class="el" href="namespace_q_o_auth.html#a4cc48c641aa9025d289d7d7e013f766f">SignatureMethod</a> signatureMethod=<a class="el" href="namespace_q_o_auth.html#a4cc48c641aa9025d289d7d7e013f766fa74bc0d418aa61ebf3efc38282d6d22b0">HMAC_SHA1</a>, const <a class="el" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">ParamMap</a> &amp;params=<a class="el" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">ParamMap</a>())</td></tr>
<tr class="separator:a5ed464673068dcef2fdf5182f9f7c966"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8800fd422be18c977a04db9679066938"><td class="memItemLeft" align="right" valign="top">QByteArray&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_q_o_auth_1_1_interface.html#a8800fd422be18c977a04db9679066938">createParametersString</a> (const QString &amp;requestUrl, <a class="el" href="namespace_q_o_auth.html#aa0e0bd4d8c1802873d3b3d2deb099319">HttpMethod</a> httpMethod, const QByteArray &amp;token, const QByteArray &amp;tokenSecret, <a class="el" href="namespace_q_o_auth.html#a4cc48c641aa9025d289d7d7e013f766f">SignatureMethod</a> signatureMethod, const <a class="el" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">ParamMap</a> &amp;params, <a class="el" href="namespace_q_o_auth.html#a442456118c9a45ac446554f17620def4">ParsingMode</a> mode)</td></tr>
<tr class="separator:a8800fd422be18c977a04db9679066938"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa6ae80c89c77d51ca4bacb22a2985b19"><td class="memItemLeft" align="right" valign="top">QByteArray&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_q_o_auth_1_1_interface.html#aa6ae80c89c77d51ca4bacb22a2985b19">inlineParameters</a> (const <a class="el" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">ParamMap</a> &amp;params, <a class="el" href="namespace_q_o_auth.html#a442456118c9a45ac446554f17620def4">ParsingMode</a> mode=<a class="el" href="namespace_q_o_auth.html#a442456118c9a45ac446554f17620def4ad28f70298ea8c4c1bec8c9c27b0aeaf5">ParseForRequestContent</a>)</td></tr>
<tr class="separator:aa6ae80c89c77d51ca4bacb22a2985b19"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>The <a class="el" href="class_q_o_auth_1_1_interface.html" title="This class provides means for interaction with network services supporting OAuth authorization scheme...">QOAuth::Interface</a> class is meant to enable OAuth support in applications in as simple way as possible. It provides 4 basic methods, two of which serve for authorization purposes: </p><ul>
<li><a class="el" href="class_q_o_auth_1_1_interface.html#a6b7efa2ba4271451faf108ad4f3b6c48">requestToken()</a>, </li>
<li><a class="el" href="class_q_o_auth_1_1_interface.html#a5ed464673068dcef2fdf5182f9f7c966">accessToken()</a>,</li>
</ul>
<p>and the other two help with creation of requests for accessing Protected Resources: </p><ul>
<li><a class="el" href="class_q_o_auth_1_1_interface.html#a8800fd422be18c977a04db9679066938">createParametersString()</a>, </li>
<li><a class="el" href="class_q_o_auth_1_1_interface.html#aa6ae80c89c77d51ca4bacb22a2985b19">inlineParameters()</a>.</li>
</ul>
<h1><a class="anchor" id="sec_auth_scheme"></a>
OAuth authorization scheme</h1>
<p>According to <a href="http://oauth.net/core/1.0/#consumer_req_param">OAuth 1.0 Core specification</a>, <em>the OAuth protocol enables websites or applications (Consumers) to access Protected Resources from a web service (Service Provider) via an API, without requiring Users to disclose their Service Provider credentials to the Consumers</em>. Simply, OAuth is a way of connecting an application to the Service Provider's API without needing to provide User's login or password. The authorization is based on an exchange of a Token (user-specific) together with a Consumer Key (application-specific), encrypted with a combination of so called Token Secret and Customer Secret. Getting access to Protected Resources consists in three basic steps: </p><ol>
<li>
obtaining an unauthorized Request Token from the Service Provider, </li>
<li>
asking the User to authorize the Request Token, </li>
<li>
exchanging the Request Token for the Access Token. </li>
</ol>
<p>Details are covered in <a href="http://oauth.net/core/1.0/#anchor9">Section 6</a> of the OAuth 1.0 Core Specification. As the authorization procedure is quite complex, the <a class="el" href="namespace_q_o_auth.html" title="This namespace encapsulates all classes and definitions provided by libqoauth. ">QOAuth</a> library helps to simplify it by doing all the dirty work behind the scenes.</p>
<h1><a class="anchor" id="sec_req_token"></a>
OAuth authorization with QOAuth</h1>
<p>First step of OAuth authorization can be done in one line using <a class="el" href="namespace_q_o_auth.html" title="This namespace encapsulates all classes and definitions provided by libqoauth. ">QOAuth</a> library. Consult the example:</p>
<div class="fragment"><div class="line">QByteArray token;</div>
<div class="line">QByteArray tokenSecret;</div>
<div class="line"></div>
<div class="line"><a class="code" href="class_q_o_auth_1_1_interface.html">QOAuth::Interface</a> *qoauth = <span class="keyword">new</span> <a class="code" href="class_q_o_auth_1_1_interface.html">QOAuth::Interface</a>;</div>
<div class="line"><span class="comment">// set the consumer key and secret</span></div>
<div class="line">qoauth-&gt;setConsumerKey( <span class="stringliteral">&quot;75b3d557c9268c49cfdf041a&quot;</span> );</div>
<div class="line">qoauth-&gt;setConsumerSecret( <span class="stringliteral">&quot;fd12803fbf0760d34cd2ceb9955199ce&quot;</span> );</div>
<div class="line"><span class="comment">// set a timeout for requests (in msecs)</span></div>
<div class="line">qoauth-&gt;setRequestTimeout( 10000 );</div>
<div class="line"></div>
<div class="line"><span class="comment">// send a request for an unauthorized token</span></div>
<div class="line"><a class="code" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">QOAuth::ParamMap</a> reply =</div>
<div class="line">    qoauth-&gt;<a class="code" href="class_q_o_auth_1_1_interface.html#a6b7efa2ba4271451faf108ad4f3b6c48">requestToken</a>( <span class="stringliteral">&quot;http://example.com/request_token&quot;</span>,</div>
<div class="line">                          <a class="code" href="namespace_q_o_auth.html#aa0e0bd4d8c1802873d3b3d2deb099319a7c85f104ca7dd13458329f66207f6be4">QOAuth::GET</a>, <a class="code" href="namespace_q_o_auth.html#a4cc48c641aa9025d289d7d7e013f766fa74bc0d418aa61ebf3efc38282d6d22b0">QOAuth::HMAC_SHA1</a> );</div>
<div class="line"></div>
<div class="line"><span class="comment">// if no error occurred, read the received token and token secret</span></div>
<div class="line"><span class="keywordflow">if</span> ( qoauth-&gt;error() == <a class="code" href="namespace_q_o_auth.html#a38fb8bcd101c339c7fd77b5de22df137acd78d96aa204e78fe3a3b3d9197b00e9">QOAuth::NoError</a> ) {</div>
<div class="line">  token = reply.value( <a class="code" href="namespace_q_o_auth.html#a84c62aa0297aa05562462798f3d7e910">QOAuth::tokenParameterName</a>() );</div>
<div class="line">  tokenSecret = reply.value( <a class="code" href="namespace_q_o_auth.html#ae1a36aa1528f69b04e74d5d3e6364393">QOAuth::tokenSecretParameterName</a>() );</div>
<div class="line">}</div>
<div class="line"></div>
</div><!-- fragment --><p>Once the unauthorized Request Token is received, User has to authorize it using Service Provider-defined method. This is beyond the scope of this library. Once User authorizes the Request Token, it can be exchanged for an Access Token that authorizes the application to access User's Protected Resources. This can be done with another one line:</p>
<div class="fragment"><div class="line"><span class="comment">// if necessary, create a map of additional arguments required by the Service Provider</span></div>
<div class="line"><a class="code" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">QOAuth::ParamMap</a> otherArgs;</div>
<div class="line">otherArgs.insert( <span class="stringliteral">&quot;misc_arg1&quot;</span>, <span class="stringliteral">&quot;value1&quot;</span> );</div>
<div class="line">otherArgs.insert( <span class="stringliteral">&quot;misc_arg2&quot;</span>, <span class="stringliteral">&quot;value2&quot;</span> );</div>
<div class="line"></div>
<div class="line"><span class="comment">// send a request to exchange Request Token for an Access Token</span></div>
<div class="line"><a class="code" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">QOAuth::ParamMap</a> reply =</div>
<div class="line">    qoauth-&gt;<a class="code" href="class_q_o_auth_1_1_interface.html#a5ed464673068dcef2fdf5182f9f7c966">accessToken</a>( <span class="stringliteral">&quot;http://example.com/access_token&quot;</span>, <a class="code" href="namespace_q_o_auth.html#aa0e0bd4d8c1802873d3b3d2deb099319af8cfac32beb6ddefef094014cfa8d60b">QOAuth::POST</a>, token,</div>
<div class="line">                         tokenSecret, <a class="code" href="namespace_q_o_auth.html#a4cc48c641aa9025d289d7d7e013f766fa74bc0d418aa61ebf3efc38282d6d22b0">QOAuth::HMAC_SHA1</a>, otherArgs );</div>
<div class="line"></div>
<div class="line"><span class="comment">// if no error occurred, read the Access Token (and other arguments, if applicable)</span></div>
<div class="line"><span class="keywordflow">if</span> ( qoauth-&gt;error() == <a class="code" href="namespace_q_o_auth.html#a38fb8bcd101c339c7fd77b5de22df137acd78d96aa204e78fe3a3b3d9197b00e9">QOAuth::NoError</a> ) {</div>
<div class="line">  token = reply.value( <a class="code" href="namespace_q_o_auth.html#a84c62aa0297aa05562462798f3d7e910">QOAuth::tokenParameterName</a>() );</div>
<div class="line">  tokenSecret = reply.value( <a class="code" href="namespace_q_o_auth.html#ae1a36aa1528f69b04e74d5d3e6364393">QOAuth::tokenSecretParameterName</a>() );</div>
<div class="line">  otherInfo = reply.value( <span class="stringliteral">&quot;misc_arg3&quot;</span> );</div>
<div class="line">}</div>
</div><!-- fragment --><p>Once the Access Token is received, the application is authorized.</p>
<h1><a class="anchor" id="sec_acc_res"></a>
Requesting Protected Resources with QOAuth</h1>
<p>In order to access Protected Resources, the application has to send a request containing arguments including Customer Key and Access Token, and encrypt them with Customer Secret and Token Secret. The process of constructing such a request can be reduced to another one-line call with <a class="el" href="class_q_o_auth_1_1_interface.html" title="This class provides means for interaction with network services supporting OAuth authorization scheme...">QOAuth::Interface</a>. The example code for inlining all request parameters (both User-specific and OAuth-related):</p>
<div class="fragment"><div class="line">QByteArray url( <span class="stringliteral">&quot;http://example.com/get_photo&quot;</span> );</div>
<div class="line"><span class="comment">// create a request parameters map</span></div>
<div class="line"><a class="code" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">QOAuth::ParamMap</a> map;</div>
<div class="line">map.insert( <span class="stringliteral">&quot;file&quot;</span>, <span class="stringliteral">&quot;flower_48.jpg&quot;</span> );</div>
<div class="line">map.insert( <span class="stringliteral">&quot;size&quot;</span>, <span class="stringliteral">&quot;small&quot;</span> );</div>
<div class="line"></div>
<div class="line"><span class="comment">// construct the parameters string</span></div>
<div class="line">QByteArray content =</div>
<div class="line">    qoauth-&gt;<a class="code" href="class_q_o_auth_1_1_interface.html#a8800fd422be18c977a04db9679066938">createParametersString</a>( requestUrl, <a class="code" href="namespace_q_o_auth.html#aa0e0bd4d8c1802873d3b3d2deb099319a7c85f104ca7dd13458329f66207f6be4">QOAuth::GET</a>, <a class="code" href="namespace_q_o_auth.html#a4cc48c641aa9025d289d7d7e013f766fa74bc0d418aa61ebf3efc38282d6d22b0">QOAuth::HMAC_SHA1</a>,</div>
<div class="line">                                    token, tokenSecret, map,</div>
<div class="line">                                    <a class="code" href="namespace_q_o_auth.html#a442456118c9a45ac446554f17620def4ad5e9093e69391cce3735734f909cf759">QOAuth::ParseForInlineQuery</a> );</div>
<div class="line"><span class="comment">// append parameters string to the URL</span></div>
<div class="line">url.append( content );</div>
<div class="line">QNetworkRequest request( QUrl( url ) );</div>
<div class="line"><span class="comment">// etc...</span></div>
</div><!-- fragment --><p>If Service Provider requires the OAuth authorization to be done in the <code>Authorization</code> header field, then only User-specific parameters should be inlined with the URL:</p>
<div class="fragment"><div class="line">QByteArray url( <span class="stringliteral">&quot;http://example.com/get_photo&quot;</span> );</div>
<div class="line"><span class="comment">// create a request parameters map</span></div>
<div class="line"><a class="code" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">QOAuth::ParamMap</a> map;</div>
<div class="line">map.insert( <span class="stringliteral">&quot;file&quot;</span>, <span class="stringliteral">&quot;flower_48.jpg&quot;</span> );</div>
<div class="line">map.insert( <span class="stringliteral">&quot;size&quot;</span>, <span class="stringliteral">&quot;small&quot;</span> );</div>
<div class="line"></div>
<div class="line"><span class="comment">// construct the authorization header</span></div>
<div class="line">QByteArray header =</div>
<div class="line">    qoauth-&gt;<a class="code" href="class_q_o_auth_1_1_interface.html#a8800fd422be18c977a04db9679066938">createParametersString</a>( requestUrl, <a class="code" href="namespace_q_o_auth.html#aa0e0bd4d8c1802873d3b3d2deb099319a7c85f104ca7dd13458329f66207f6be4">QOAuth::GET</a>, <a class="code" href="namespace_q_o_auth.html#a4cc48c641aa9025d289d7d7e013f766fa74bc0d418aa61ebf3efc38282d6d22b0">QOAuth::HMAC_SHA1</a>,</div>
<div class="line">                                    token, tokenSecret, map,</div>
<div class="line">                                    <a class="code" href="namespace_q_o_auth.html#a442456118c9a45ac446554f17620def4a6c2747775846e2d5e7c96f7db6314d28">QOAuth::ParseForHeaderArguments</a> );</div>
<div class="line"><span class="comment">// append parameters string to the URL</span></div>
<div class="line"><span class="comment">// alternatively you can use QOAuth::ParseForRequestContent if you want</span></div>
<div class="line"><span class="comment">// to use the output as a POST request content (remember then of passing</span></div>
<div class="line"><span class="comment">// QOAuth::POST above).</span></div>
<div class="line">url.append( qoauth-&gt;<a class="code" href="class_q_o_auth_1_1_interface.html#aa6ae80c89c77d51ca4bacb22a2985b19">inlineParameters</a>( map, <a class="code" href="namespace_q_o_auth.html#a442456118c9a45ac446554f17620def4ad5e9093e69391cce3735734f909cf759">QOAuth::ParseForInlineQuery</a> ) );</div>
<div class="line">QNetworkRequest request( QUrl( url ) );</div>
<div class="line">request.setRawHeader( <span class="stringliteral">&quot;Authorization&quot;</span>, header );</div>
<div class="line"><span class="comment">// etc...</span></div>
</div><!-- fragment --><h1><a class="anchor" id="sec_capabilities"></a>
Capabilities</h1>
<p><a class="el" href="namespace_q_o_auth.html" title="This namespace encapsulates all classes and definitions provided by libqoauth. ">QOAuth</a> library works with all 3 signature methods supported by the OAuth protocol, namely HMAC-SHA1, RSA-SHA1 and PLAINTEXT. Hovewer, RSA-SHA1 and (especially) PLAINTEXT methods may still need additional testing for various input conditions. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a8ccd2711b06fae13e6554051ffadad27"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">QOAuth::Interface::Interface </td>
          <td>(</td>
          <td class="paramtype">QNetworkAccessManager *&#160;</td>
          <td class="paramname"><em>manager</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">QObject *&#160;</td>
          <td class="paramname"><em>parent</em> = <code>0</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Use this constructor if you want to use your custom network access manager to handle network connections needed by the interface.</p>
<p>/sa <a class="el" href="class_q_o_auth_1_1_interface.html#a3b54987fa7f0757d0475d4d0a1ecf867" title="Sets manager to be the network access manager used by the interface. ">setNetworkAccessManager()</a> </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a5ed464673068dcef2fdf5182f9f7c966"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">QOAuth::ParamMap</a> QOAuth::Interface::accessToken </td>
          <td>(</td>
          <td class="paramtype">const QString &amp;&#160;</td>
          <td class="paramname"><em>requestUrl</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespace_q_o_auth.html#aa0e0bd4d8c1802873d3b3d2deb099319">HttpMethod</a>&#160;</td>
          <td class="paramname"><em>httpMethod</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const QByteArray &amp;&#160;</td>
          <td class="paramname"><em>token</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const QByteArray &amp;&#160;</td>
          <td class="paramname"><em>tokenSecret</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespace_q_o_auth.html#a4cc48c641aa9025d289d7d7e013f766f">SignatureMethod</a>&#160;</td>
          <td class="paramname"><em>signatureMethod</em> = <code><a class="el" href="namespace_q_o_auth.html#a4cc48c641aa9025d289d7d7e013f766fa74bc0d418aa61ebf3efc38282d6d22b0">HMAC_SHA1</a></code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">ParamMap</a> &amp;&#160;</td>
          <td class="paramname"><em>params</em> = <code><a class="el" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">ParamMap</a>()</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This method constructs and sends a request for exchanging a Request Token (obtained previously with a call to <a class="el" href="class_q_o_auth_1_1_interface.html#a6b7efa2ba4271451faf108ad4f3b6c48">requestToken()</a>) for an Access Token, that authorizes the application to access Protected Resources. This is the third step of the OAuth authentication flow, according to <a href="http://oauth.net/core/1.0/#anchor9">OAuth 1.0 Core specification</a>. The PLAINTEXT signature method uses Customer Secret and (if provided) Token Secret to sign a request. For the HMAC-SHA1 and RSA-SHA1 signature methods the <a href="http://oauth.net/core/1.0/#anchor14">Signature Base String</a> is created using the given <em>requestUrl</em>, <em>httpMethod</em>, <em>token</em> and <em>tokenSecret</em>. The optional request parameters specified by the Service Provider can be passed in the <em>params</em> ParamMap.</p>
<p>The Signature Base String contains the consumerKey and uses consumerSecret for encrypting the message, so it's necessary to provide them both before issuing this request. The method will check if both consumerKey and consumerSecret are provided, and fail if any of them is missing.</p>
<p>When the signature is created, the appropriate request is sent to the Service Provider (namely, the <em>requestUrl</em>). Depending on the type of the request, the parameters are passed according to the <a href="http://oauth.net/core/1.0/#consumer_req_param">Consumer Request Parametes</a> section of the OAuth specification, i.e.: </p><ul>
<li>for GET requests, in the HTTP Authorization header, as defined in <a href="http://oauth.net/core/1.0/#auth_header">OAuth HTTP Authorization Scheme</a>, </li>
<li>for POST requests, as a request body with <code>content-type</code> set to <code>application/x-www-form-urlencoded</code>.</li>
</ul>
<p>Once the request is sent, a local event loop is executed and set up to wait for the request to complete. If the requestTimeout property is set to a non-zero value, its vaue is applied as a request timeout, after which the request is aborted.</p>
<dl class="section return"><dt>Returns</dt><dd>If request succeded, the method returns all the data passed in the Service Provider response (including an authorized Access Token and Token Secret), formed in a ParamMap. This request ends the authorization process, and the obtained Access Token and Token Secret should be kept by the application and provided with every future request authorized by OAuth, e.g. using <a class="el" href="class_q_o_auth_1_1_interface.html#a8800fd422be18c977a04db9679066938">createParametersString()</a>. If request fails, the error property is set to an appropriate value, and an empty ParamMap is returned.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="class_q_o_auth_1_1_interface.html#a6b7efa2ba4271451faf108ad4f3b6c48">requestToken()</a>, <a class="el" href="class_q_o_auth_1_1_interface.html#a8800fd422be18c977a04db9679066938">createParametersString()</a>, error </dd></dl>

</div>
</div>
<a class="anchor" id="a8800fd422be18c977a04db9679066938"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">QByteArray QOAuth::Interface::createParametersString </td>
          <td>(</td>
          <td class="paramtype">const QString &amp;&#160;</td>
          <td class="paramname"><em>requestUrl</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespace_q_o_auth.html#aa0e0bd4d8c1802873d3b3d2deb099319">HttpMethod</a>&#160;</td>
          <td class="paramname"><em>httpMethod</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const QByteArray &amp;&#160;</td>
          <td class="paramname"><em>token</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const QByteArray &amp;&#160;</td>
          <td class="paramname"><em>tokenSecret</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespace_q_o_auth.html#a4cc48c641aa9025d289d7d7e013f766f">SignatureMethod</a>&#160;</td>
          <td class="paramname"><em>signatureMethod</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">ParamMap</a> &amp;&#160;</td>
          <td class="paramname"><em>params</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespace_q_o_auth.html#a442456118c9a45ac446554f17620def4">ParsingMode</a>&#160;</td>
          <td class="paramname"><em>mode</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This method generates a parameters string required to access Protected Resources using OAuth authorization. According to <a href="http://oauth.net/core/1.0/#anchor13">OAuth 1.0 Core specification</a>, every outgoing request for accessing Protected Resources must contain information like the Consumer Key and Access Token, and has to be signed using one of the supported signature methods.</p>
<p>The PLAINTEXT signature method uses Customer Secret and (if provided) Token Secret to sign a request. For the HMAC-SHA1 and RSA-SHA1 signature methods the <a href="http://oauth.net/core/1.0/#anchor14">Signature Base String</a> is created using the given <em>requestUrl</em>, <em>httpMethod</em>, <em>token</em> and <em>tokenSecret</em>. The optional request parameters specified by the Service Provider can be passed in the <em>params</em> <a class="el" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">ParamMap</a>.</p>
<p>The Signature Base String contains the consumerKey and uses consumerSecret for encrypting the message, so it's necessary to provide them both before issuing this request. The method will check if both consumerKey and consumerSecret are provided, and fail if any of them is missing.</p>
<p>The <em>mode</em> parameter specifies the format of the parameter string.</p>
<dl class="section return"><dt>Returns</dt><dd>The parsed parameters string, that depending on <em>mode</em> and <em>httpMethod</em> is:</dd></dl>
<table class="doxtable">
<tr>
<td><b><em>mode</em> </b>  </td><td><b>outcome</b>  </td></tr>
<tr>
<td><code><a class="el" href="namespace_q_o_auth.html#a442456118c9a45ac446554f17620def4ad28f70298ea8c4c1bec8c9c27b0aeaf5" title="Inline query format (foo=bar&bar=baz&baz=foo ...), suitable for POST requests. ">QOAuth::ParseForRequestContent</a></code> </td><td>ready to be posted as a request body </td></tr>
<tr>
<td><code><a class="el" href="namespace_q_o_auth.html#a442456118c9a45ac446554f17620def4ad5e9093e69391cce3735734f909cf759">QOAuth::ParseForInlineQuery</a></code> </td><td>prepended with a <em>'?'</em> and ready to be appended to the <em>requestUrl</em>  </td></tr>
<tr>
<td><code><a class="el" href="namespace_q_o_auth.html#a442456118c9a45ac446554f17620def4a6c2747775846e2d5e7c96f7db6314d28" title="HTTP request header format (parameters to be put inside a request header) ">QOAuth::ParseForHeaderArguments</a></code> </td><td>ready to be set as an argument for the <code>Authorization</code> HTTP header </td></tr>
<tr>
<td><code><a class="el" href="namespace_q_o_auth.html#a442456118c9a45ac446554f17620def4ad12a3ed424be9e87704f138dc28804cf" title="Signature Base String format, meant for internal use. ">QOAuth::ParseForSignatureBaseString</a></code> </td><td><em>meant for internal use</em> </td></tr>
</table>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="class_q_o_auth_1_1_interface.html#aa6ae80c89c77d51ca4bacb22a2985b19">inlineParameters()</a> </dd></dl>

</div>
</div>
<a class="anchor" id="aa6ae80c89c77d51ca4bacb22a2985b19"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">QByteArray QOAuth::Interface::inlineParameters </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">ParamMap</a> &amp;&#160;</td>
          <td class="paramname"><em>params</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespace_q_o_auth.html#a442456118c9a45ac446554f17620def4">ParsingMode</a>&#160;</td>
          <td class="paramname"><em>mode</em> = <code><a class="el" href="namespace_q_o_auth.html#a442456118c9a45ac446554f17620def4ad28f70298ea8c4c1bec8c9c27b0aeaf5">ParseForRequestContent</a></code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This method is provided for convenience. It generates an inline query string out of given parameter map. The resulting string can be either sent in an HTTP POST request as a request content, or appended directly to an HTTP GET request's URL as a query string. When using this method for preparing an HTTP GET query string you can set the <em>mode</em> to ParseForInlineQuery to have the string prepended with a question mark (separating the URL path from the query string). Modes other than <a class="el" href="namespace_q_o_auth.html#a442456118c9a45ac446554f17620def4ad28f70298ea8c4c1bec8c9c27b0aeaf5" title="Inline query format (foo=bar&bar=baz&baz=foo ...), suitable for POST requests. ">QOAuth::ParseForRequestContent</a> and <a class="el" href="namespace_q_o_auth.html#a442456118c9a45ac446554f17620def4ad5e9093e69391cce3735734f909cf759">QOAuth::ParseForInlineQuery</a> produce an empty byte array.</p>
<p>Use this method together with <a class="el" href="class_q_o_auth_1_1_interface.html#a8800fd422be18c977a04db9679066938">createParametersString()</a>, when you request a header parameters string (<a class="el" href="namespace_q_o_auth.html#a442456118c9a45ac446554f17620def4a6c2747775846e2d5e7c96f7db6314d28" title="HTTP request header format (parameters to be put inside a request header) ">QOAuth::ParseForHeaderArguments</a>) together with HTTP GET method. In such case, apart from header arguments, you must provide a query string containing custom request parameters (i.e. not OAuth-related). Pass the custom parameters map to this method to receive a query string to be appended to the URL.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="class_q_o_auth_1_1_interface.html#a8800fd422be18c977a04db9679066938">createParametersString()</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a6b7efa2ba4271451faf108ad4f3b6c48"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">QOAuth::ParamMap</a> QOAuth::Interface::requestToken </td>
          <td>(</td>
          <td class="paramtype">const QString &amp;&#160;</td>
          <td class="paramname"><em>requestUrl</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespace_q_o_auth.html#aa0e0bd4d8c1802873d3b3d2deb099319">HttpMethod</a>&#160;</td>
          <td class="paramname"><em>httpMethod</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespace_q_o_auth.html#a4cc48c641aa9025d289d7d7e013f766f">SignatureMethod</a>&#160;</td>
          <td class="paramname"><em>signatureMethod</em> = <code><a class="el" href="namespace_q_o_auth.html#a4cc48c641aa9025d289d7d7e013f766fa74bc0d418aa61ebf3efc38282d6d22b0">HMAC_SHA1</a></code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">ParamMap</a> &amp;&#160;</td>
          <td class="paramname"><em>params</em> = <code><a class="el" href="namespace_q_o_auth.html#a4a001535b7fdb06cc9d34cad1af27d2f">ParamMap</a>()</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This method constructs and sends a request for obtaining an unauthorized Request Token from the Service Provider. This is the first step of the OAuth authentication flow, according to <a href="http://oauth.net/core/1.0/#anchor9">OAuth 1.0 Core specification</a>. The PLAINTEXT signature method uses Customer Secret and (if provided) Token Secret to sign a request. For the HMAC-SHA1 and RSA-SHA1 signature methods the <a href="http://oauth.net/core/1.0/#anchor14">Signature Base String</a> is created using the given <em>requestUrl</em> and <em>httpMethod</em>. The optional request parameters specified by the Service Provider can be passed in the <em>params</em> ParamMap.</p>
<p>The Signature Base String contains the consumerKey and uses consumerSecret for encrypting the message, so it's necessary to provide them both before issuing this request. The method will check if both consumerKey and consumerSecret are provided, and fail if any of them is missing.</p>
<p>When the signature is created, the appropriate request is sent to the Service Provider (namely, the <em>requestUrl</em>). Depending on the type of the request, the parameters are passed according to the <a href="http://oauth.net/core/1.0/#consumer_req_param">Consumer Request Parametes</a> section of the OAuth specification, i.e.: </p><ul>
<li>for GET requests, in the HTTP Authorization header, as defined in <a href="http://oauth.net/core/1.0/#auth_header">OAuth HTTP Authorization Scheme</a>, </li>
<li>for POST requests, as a request body with <code>content-type</code> set to <code>application/x-www-form-urlencoded</code>.</li>
</ul>
<p>Once the request is sent, a local event loop is executed and set up to wait for the request to complete. If the requestTimeout property is set to a non-zero value, its vaue is applied as a request timeout, after which the request is aborted.</p>
<dl class="section return"><dt>Returns</dt><dd>If request succeded, the method returns all the data passed in the Service Provider response (including a Request Token and Token Secret), formed in a ParamMap. If request fails, the error property is set to an appropriate value, and an empty ParamMap is returned.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="class_q_o_auth_1_1_interface.html#a5ed464673068dcef2fdf5182f9f7c966">accessToken()</a>, error </dd></dl>

</div>
</div>
<a class="anchor" id="a3b54987fa7f0757d0475d4d0a1ecf867"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void QOAuth::Interface::setNetworkAccessManager </td>
          <td>(</td>
          <td class="paramtype">QNetworkAccessManager *&#160;</td>
          <td class="paramname"><em>manager</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>The interface class takes ownership of the manager. If there already is a manager, it's being deleted.</p>
<p>/sa <a class="el" href="class_q_o_auth_1_1_interface.html#aa39f382acd254adccc42937a931b18ad" title="Returns the network access manager used by the interface. ">networkAccessManager()</a> </p>

</div>
</div>
<a class="anchor" id="afa8c4d004b0beddb71066c069e6cfebf"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool QOAuth::Interface::setRSAPrivateKey </td>
          <td>(</td>
          <td class="paramtype">const QString &amp;&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const QCA::SecureArray &amp;&#160;</td>
          <td class="paramname"><em>passphrase</em> = <code>QCA::SecureArray()</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This method is useful when using OAuth with RSA-SHA1 signing algorithm. It reads the RSA private key from the string given as <em>key</em>, and stores it internally. If the key is secured by a passphrase, it should be passed as the second argument.</p>
<p>The provided string is decoded into a private RSA key, optionally using the <em>passphrase</em>. If <em>key</em> contains a valid RSA private key, this method returns true. If any problems were encountered during decoding (either the key or the passphrase are invalid), false is returned and the error code is set to <a class="el" href="namespace_q_o_auth.html#a38fb8bcd101c339c7fd77b5de22df137a7a547bd32c7474766969573dad8e5694">QOAuth::RSADecodingError</a>.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="class_q_o_auth_1_1_interface.html#a7a2066da8941a5f3e04ae109b2362f30">setRSAPrivateKeyFromFile()</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a7a2066da8941a5f3e04ae109b2362f30"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool QOAuth::Interface::setRSAPrivateKeyFromFile </td>
          <td>(</td>
          <td class="paramtype">const QString &amp;&#160;</td>
          <td class="paramname"><em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const QCA::SecureArray &amp;&#160;</td>
          <td class="paramname"><em>passphrase</em> = <code>QCA::SecureArray()</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This method is useful when using OAuth with RSA-SHA1 signing algorithm. It reads the RSA private key from the given <em>file</em>, and stores it internally. If the key is secured by a passphrase, it should be passed as the second argument.</p>
<p>The provided file is read and decoded into a private RSA key, optionally using the <em>passphrase</em>. If it contains a valid RSA private key, this method returns true. If any problems were encountered during decoding, false is returned and the appropriate error code is set: </p><ul>
<li><code><a class="el" href="namespace_q_o_auth.html#a38fb8bcd101c339c7fd77b5de22df137a8099e324c0dcef5b2267427edc833bdb" title="The provided key file either doesn&#39;t exist or is unreadable. ">QOAuth::RSAKeyFileError</a></code> - when the key file doesn't exist or is unreadable </li>
<li><code><a class="el" href="namespace_q_o_auth.html#a38fb8bcd101c339c7fd77b5de22df137a7a547bd32c7474766969573dad8e5694">QOAuth::RSADecodingError</a></code> - if problems occurred during encoding (either the key and/or password are invalid).</li>
</ul>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="class_q_o_auth_1_1_interface.html#afa8c4d004b0beddb71066c069e6cfebf">setRSAPrivateKey()</a> </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>src/<a class="el" href="src_2interface_8h_source.html">interface.h</a></li>
<li>src/interface.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Oct 16 2014 02:05:35 for QOAuth by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.8
</small></address>
</body>
</html>