Sophie

Sophie

distrib > Mageia > 6 > i586 > by-pkgid > dbf69eaa13c86c67c80d31d9cbb7847c > files > 1865

qtbase5-doc-5.9.4-1.2.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qsslpresharedkeyauthenticator.cpp -->
  <title>QSslPreSharedKeyAuthenticator Class | Qt Network 5.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.9</td><td ><a href="qtnetwork-index.html">Qt Network</a></td><td ><a href="qtnetwork-module.html">C++ Classes</a></td><td >QSslPreSharedKeyAuthenticator</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#related-non-members">Related Non-Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QSslPreSharedKeyAuthenticator Class</h1>
<!-- $$$QSslPreSharedKeyAuthenticator-brief -->
<p>The <a href="qsslpresharedkeyauthenticator.html">QSslPreSharedKeyAuthenticator</a> class provides authentication data for pre shared keys (PSK) ciphersuites. <a href="#details">More...</a></p>
<!-- @@@QSslPreSharedKeyAuthenticator -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QSslPreSharedKeyAuthenticator&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += network</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign">  Qt 5.5</td></tr></table></div><ul>
<li><a href="qsslpresharedkeyauthenticator-members.html">List of all members, including inherited members</a></li>
</ul>
<p><b>Note:</b> All functions in this class are reentrant.</p>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsslpresharedkeyauthenticator.html#QSslPreSharedKeyAuthenticator">QSslPreSharedKeyAuthenticator</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsslpresharedkeyauthenticator.html#QSslPreSharedKeyAuthenticator-1">QSslPreSharedKeyAuthenticator</a></b>(const QSslPreSharedKeyAuthenticator &amp;<i>authenticator</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsslpresharedkeyauthenticator.html#dtor.QSslPreSharedKeyAuthenticator">~QSslPreSharedKeyAuthenticator</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qsslpresharedkeyauthenticator.html#identity">identity</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qsslpresharedkeyauthenticator.html#identityHint">identityHint</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsslpresharedkeyauthenticator.html#maximumIdentityLength">maximumIdentityLength</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsslpresharedkeyauthenticator.html#maximumPreSharedKeyLength">maximumPreSharedKeyLength</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qsslpresharedkeyauthenticator.html#preSharedKey">preSharedKey</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsslpresharedkeyauthenticator.html#setIdentity">setIdentity</a></b>(const QByteArray &amp;<i>identity</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsslpresharedkeyauthenticator.html#setPreSharedKey">setPreSharedKey</a></b>(const QByteArray &amp;<i>preSharedKey</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsslpresharedkeyauthenticator.html#swap">swap</a></b>(QSslPreSharedKeyAuthenticator &amp;<i>authenticator</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSslPreSharedKeyAuthenticator &amp;</td><td class="memItemRight bottomAlign"><b><a href="qsslpresharedkeyauthenticator.html#operator-eq">operator=</a></b>(const QSslPreSharedKeyAuthenticator &amp;<i>authenticator</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSslPreSharedKeyAuthenticator &amp;</td><td class="memItemRight bottomAlign"><b><a href="qsslpresharedkeyauthenticator.html#operator-eq-1">operator=</a></b>(QSslPreSharedKeyAuthenticator &amp;&amp;<i>authenticator</i>)</td></tr>
</table></div>
<a name="related-non-members"></a>
<h2 id="related-non-members">Related Non-Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsslpresharedkeyauthenticator.html#operator-not-eq">operator!=</a></b>(const QSslPreSharedKeyAuthenticator &amp;<i>lhs</i>, const QSslPreSharedKeyAuthenticator &amp;<i>rhs</i>)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QSslPreSharedKeyAuthenticator-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qsslpresharedkeyauthenticator.html">QSslPreSharedKeyAuthenticator</a> class provides authentication data for pre shared keys (PSK) ciphersuites.</p>
<p>The <a href="qsslpresharedkeyauthenticator.html">QSslPreSharedKeyAuthenticator</a> class is used by an SSL socket to provide the required authentication data in a pre shared key (PSK) ciphersuite.</p>
<p>In a PSK handshake, the client must derive a key, which must match the key set on the server. The exact algorithm of deriving the key depends on the application; however, for this purpose, the server may send an <i>identity hint</i> to the client. This hint, combined with other information (for instance a passphrase), is then used by the client to construct the shared key.</p>
<p>The <a href="qsslpresharedkeyauthenticator.html">QSslPreSharedKeyAuthenticator</a> provides means to client applications for completing the PSK handshake. The client application needs to connect a slot to the <a href="qsslsocket.html#preSharedKeyAuthenticationRequired">QSslSocket::preSharedKeyAuthenticationRequired</a>() signal:</p>
<pre class="cpp">

  connect(socket<span class="operator">,</span> <span class="operator">&amp;</span><span class="type"><a href="qsslsocket.html">QSslSocket</a></span><span class="operator">::</span>preSharedKeyAuthenticationRequired<span class="operator">,</span>
          <span class="keyword">this</span><span class="operator">,</span> <span class="operator">&amp;</span>AuthManager<span class="operator">::</span>handlePreSharedKeyAuthentication);

</pre>
<p>The signal carries a <a href="qsslpresharedkeyauthenticator.html">QSslPreSharedKeyAuthenticator</a> object containing the identity hint the server sent to the client, and which must be filled with the corresponding client identity and the derived key:</p>
<pre class="cpp">

  <span class="type">void</span> AuthManager<span class="operator">::</span>handlePreSharedKeyAuthentication(<span class="type"><a href="qsslpresharedkeyauthenticator.html#QSslPreSharedKeyAuthenticator">QSslPreSharedKeyAuthenticator</a></span> <span class="operator">*</span>authenticator)
  {
      authenticator<span class="operator">-</span><span class="operator">&gt;</span>setIdentity(<span class="string">&quot;My Qt App&quot;</span>);

      <span class="keyword">const</span> <span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> key <span class="operator">=</span> deriveKey(authenticator<span class="operator">-</span><span class="operator">&gt;</span>identityHint()<span class="operator">,</span> passphrase);
      authenticator<span class="operator">-</span><span class="operator">&gt;</span>setPreSharedKey(key);
  }

</pre>
<p><b>Note: </b>PSK ciphersuites are supported only when using OpenSSL 1.0&#x2e;1 (or greater) as the SSL backend.</p></div>
<p><b>See also </b><a href="qsslsocket.html">QSslSocket</a>.</p>
<!-- @@@QSslPreSharedKeyAuthenticator -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QSslPreSharedKeyAuthenticator[overload1]$$$QSslPreSharedKeyAuthenticator -->
<h3 class="fn" id="QSslPreSharedKeyAuthenticator"><a name="QSslPreSharedKeyAuthenticator"></a>QSslPreSharedKeyAuthenticator::<span class="name">QSslPreSharedKeyAuthenticator</span>()</h3>
<p>Constructs a default <a href="qsslpresharedkeyauthenticator.html">QSslPreSharedKeyAuthenticator</a> object.</p>
<p>The identity hint, the identity and the key will be initialized to empty byte arrays; the maximum length for both the identity and the key will be initialized to 0.</p>
<!-- @@@QSslPreSharedKeyAuthenticator -->
<!-- $$$QSslPreSharedKeyAuthenticator$$$QSslPreSharedKeyAuthenticatorconstQSslPreSharedKeyAuthenticator& -->
<h3 class="fn" id="QSslPreSharedKeyAuthenticator-1"><a name="QSslPreSharedKeyAuthenticator-1"></a>QSslPreSharedKeyAuthenticator::<span class="name">QSslPreSharedKeyAuthenticator</span>(const <span class="type"><a href="qsslpresharedkeyauthenticator.html#QSslPreSharedKeyAuthenticator">QSslPreSharedKeyAuthenticator</a></span> &amp;<i>authenticator</i>)</h3>
<p>Constructs a <a href="qsslpresharedkeyauthenticator.html">QSslPreSharedKeyAuthenticator</a> object as a copy of <i>authenticator</i>.</p>
<p><b>See also </b><a href="qsslpresharedkeyauthenticator.html#operator-eq">operator=</a>().</p>
<!-- @@@QSslPreSharedKeyAuthenticator -->
<!-- $$$~QSslPreSharedKeyAuthenticator[overload1]$$$~QSslPreSharedKeyAuthenticator -->
<h3 class="fn" id="dtor.QSslPreSharedKeyAuthenticator"><a name="dtor.QSslPreSharedKeyAuthenticator"></a>QSslPreSharedKeyAuthenticator::<span class="name">~QSslPreSharedKeyAuthenticator</span>()</h3>
<p>Destroys the <a href="qsslpresharedkeyauthenticator.html">QSslPreSharedKeyAuthenticator</a> object.</p>
<!-- @@@~QSslPreSharedKeyAuthenticator -->
<!-- $$$identity[overload1]$$$identity -->
<h3 class="fn" id="identity"><a name="identity"></a><span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> QSslPreSharedKeyAuthenticator::<span class="name">identity</span>() const</h3>
<p>Returns the PSK client identity.</p>
<p><b>See also </b><a href="qsslpresharedkeyauthenticator.html#setIdentity">setIdentity</a>().</p>
<!-- @@@identity -->
<!-- $$$identityHint[overload1]$$$identityHint -->
<h3 class="fn" id="identityHint"><a name="identityHint"></a><span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> QSslPreSharedKeyAuthenticator::<span class="name">identityHint</span>() const</h3>
<p>Returns the PSK identity hint as provided by the server. The interpretation of this hint is left to the application.</p>
<!-- @@@identityHint -->
<!-- $$$maximumIdentityLength[overload1]$$$maximumIdentityLength -->
<h3 class="fn" id="maximumIdentityLength"><a name="maximumIdentityLength"></a><span class="type">int</span> QSslPreSharedKeyAuthenticator::<span class="name">maximumIdentityLength</span>() const</h3>
<p>Returns the maximum length, in bytes, of the PSK client identity.</p>
<p><b>Note: </b>it is possible to set an identity whose length is greater than maximumIdentityLength(); in this case, only the first maximumIdentityLength() bytes will be actually sent to the server.</p><p><b>See also </b><a href="qsslpresharedkeyauthenticator.html#setIdentity">setIdentity</a>().</p>
<!-- @@@maximumIdentityLength -->
<!-- $$$maximumPreSharedKeyLength[overload1]$$$maximumPreSharedKeyLength -->
<h3 class="fn" id="maximumPreSharedKeyLength"><a name="maximumPreSharedKeyLength"></a><span class="type">int</span> QSslPreSharedKeyAuthenticator::<span class="name">maximumPreSharedKeyLength</span>() const</h3>
<p>Returns the maximum length, in bytes, of the pre shared key.</p>
<p><b>Note: </b>it is possible to set a key whose length is greater than the maximumPreSharedKeyLength(); in this case, only the first maximumPreSharedKeyLength() bytes will be actually sent to the server.</p><p><b>See also </b><a href="qsslpresharedkeyauthenticator.html#setPreSharedKey">setPreSharedKey</a>().</p>
<!-- @@@maximumPreSharedKeyLength -->
<!-- $$$preSharedKey[overload1]$$$preSharedKey -->
<h3 class="fn" id="preSharedKey"><a name="preSharedKey"></a><span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> QSslPreSharedKeyAuthenticator::<span class="name">preSharedKey</span>() const</h3>
<p>Returns the pre shared key.</p>
<p><b>See also </b><a href="qsslpresharedkeyauthenticator.html#setPreSharedKey">setPreSharedKey</a>().</p>
<!-- @@@preSharedKey -->
<!-- $$$setIdentity[overload1]$$$setIdentityconstQByteArray& -->
<h3 class="fn" id="setIdentity"><a name="setIdentity"></a><span class="type">void</span> QSslPreSharedKeyAuthenticator::<span class="name">setIdentity</span>(const <span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> &amp;<i>identity</i>)</h3>
<p>Sets the PSK client identity (to be advised to the server) to <i>identity</i>.</p>
<p><b>Note: </b>it is possible to set an identity whose length is greater than <a href="qsslpresharedkeyauthenticator.html#maximumIdentityLength">maximumIdentityLength</a>(); in this case, only the first <a href="qsslpresharedkeyauthenticator.html#maximumIdentityLength">maximumIdentityLength</a>() bytes will be actually sent to the server.</p><p><b>See also </b><a href="qsslpresharedkeyauthenticator.html#identity">identity</a>() and <a href="qsslpresharedkeyauthenticator.html#maximumIdentityLength">maximumIdentityLength</a>().</p>
<!-- @@@setIdentity -->
<!-- $$$setPreSharedKey[overload1]$$$setPreSharedKeyconstQByteArray& -->
<h3 class="fn" id="setPreSharedKey"><a name="setPreSharedKey"></a><span class="type">void</span> QSslPreSharedKeyAuthenticator::<span class="name">setPreSharedKey</span>(const <span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> &amp;<i>preSharedKey</i>)</h3>
<p>Sets the pre shared key to <i>preSharedKey</i>.</p>
<p><b>Note: </b>it is possible to set a key whose length is greater than the <a href="qsslpresharedkeyauthenticator.html#maximumPreSharedKeyLength">maximumPreSharedKeyLength</a>(); in this case, only the first <a href="qsslpresharedkeyauthenticator.html#maximumPreSharedKeyLength">maximumPreSharedKeyLength</a>() bytes will be actually sent to the server.</p><p><b>See also </b><a href="qsslpresharedkeyauthenticator.html#preSharedKey">preSharedKey</a>(), <a href="qsslpresharedkeyauthenticator.html#maximumPreSharedKeyLength">maximumPreSharedKeyLength</a>(), and <a href="../qtcore/qbytearray.html#fromHex">QByteArray::fromHex</a>().</p>
<!-- @@@setPreSharedKey -->
<!-- $$$swap[overload1]$$$swapQSslPreSharedKeyAuthenticator& -->
<h3 class="fn" id="swap"><a name="swap"></a><span class="type">void</span> QSslPreSharedKeyAuthenticator::<span class="name">swap</span>(<span class="type"><a href="qsslpresharedkeyauthenticator.html#QSslPreSharedKeyAuthenticator">QSslPreSharedKeyAuthenticator</a></span> &amp;<i>authenticator</i>)</h3>
<p>Swaps the <a href="qsslpresharedkeyauthenticator.html">QSslPreSharedKeyAuthenticator</a> object <i>authenticator</i> with this object. This operation is very fast and never fails.</p>
<!-- @@@swap -->
<!-- $$$operator=[overload1]$$$operator=constQSslPreSharedKeyAuthenticator& -->
<h3 class="fn" id="operator-eq"><a name="operator-eq"></a><span class="type"><a href="qsslpresharedkeyauthenticator.html#QSslPreSharedKeyAuthenticator">QSslPreSharedKeyAuthenticator</a></span> &amp;QSslPreSharedKeyAuthenticator::<span class="name">operator=</span>(const <span class="type"><a href="qsslpresharedkeyauthenticator.html#QSslPreSharedKeyAuthenticator">QSslPreSharedKeyAuthenticator</a></span> &amp;<i>authenticator</i>)</h3>
<p>Assigns the <a href="qsslpresharedkeyauthenticator.html">QSslPreSharedKeyAuthenticator</a> object <i>authenticator</i> to this object, and returns a reference to the copy.</p>
<!-- @@@operator= -->
<!-- $$$operator=$$$operator=QSslPreSharedKeyAuthenticator&& -->
<h3 class="fn" id="operator-eq-1"><a name="operator-eq-1"></a><span class="type"><a href="qsslpresharedkeyauthenticator.html#QSslPreSharedKeyAuthenticator">QSslPreSharedKeyAuthenticator</a></span> &amp;QSslPreSharedKeyAuthenticator::<span class="name">operator=</span>(<span class="type"><a href="qsslpresharedkeyauthenticator.html#QSslPreSharedKeyAuthenticator">QSslPreSharedKeyAuthenticator</a></span> &amp;&amp;<i>authenticator</i>)</h3>
<p>Move-assigns the the <a href="qsslpresharedkeyauthenticator.html">QSslPreSharedKeyAuthenticator</a> object <i>authenticator</i> to this object, and returns a reference to the moved instance.</p>
<!-- @@@operator= -->
</div>
<div class="relnonmem">
<h2>Related Non-Members</h2>
<!-- $$$operator!=[overload1]$$$operator!=constQSslPreSharedKeyAuthenticator&constQSslPreSharedKeyAuthenticator& -->
<h3 class="fn" id="operator-not-eq"><a name="operator-not-eq"></a><span class="type">bool</span> <span class="name">operator!=</span>(const <span class="type"><a href="qsslpresharedkeyauthenticator.html#QSslPreSharedKeyAuthenticator">QSslPreSharedKeyAuthenticator</a></span> &amp;<i>lhs</i>, const <span class="type"><a href="qsslpresharedkeyauthenticator.html#QSslPreSharedKeyAuthenticator">QSslPreSharedKeyAuthenticator</a></span> &amp;<i>rhs</i>)</h3>
<p>Returns true if the authenticator object <i>lhs</i> is different than <i>rhs</i>; false otherwise.</p>
<p>This function was introduced in  Qt 5.5.</p>
<!-- @@@operator!= -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>