<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QSslKey Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QSslKey Class Reference<br /><sup><sup>[<a href="qtnetwork.html">QtNetwork</a> module]</sup></sup></h1><p>The QSslKey class provides an interface for private and public keys. <a href="#details">More...</a></p> <h3>Methods</h3><ul><li><div class="fn" /><b><a href="qsslkey.html#QSslKey">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsslkey.html#QSslKey-2">__init__</a></b> (<i>self</i>, QByteArray <i>encoded</i>, QSsl.KeyAlgorithm <i>algorithm</i>, QSsl.EncodingFormat <i>encoding</i> = QSsl.Pem, QSsl.KeyType <i>type</i> = QSsl.PrivateKey, QByteArray <i>passPhrase</i> = QByteArray())</li><li><div class="fn" /><b><a href="qsslkey.html#QSslKey-3">__init__</a></b> (<i>self</i>, QIODevice <i>device</i>, QSsl.KeyAlgorithm <i>algorithm</i>, QSsl.EncodingFormat <i>encoding</i> = QSsl.Pem, QSsl.KeyType <i>type</i> = QSsl.PrivateKey, QByteArray <i>passPhrase</i> = QByteArray())</li><li><div class="fn" /><b><a href="qsslkey.html#QSslKey-4">__init__</a></b> (<i>self</i>, QSslKey <i>other</i>)</li><li><div class="fn" />QSsl.KeyAlgorithm <b><a href="qsslkey.html#algorithm">algorithm</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsslkey.html#clear">clear</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qsslkey.html#handle">handle</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsslkey.html#isNull">isNull</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qsslkey.html#length">length</a></b> (<i>self</i>)</li><li><div class="fn" />QByteArray <b><a href="qsslkey.html#toDer">toDer</a></b> (<i>self</i>, QByteArray <i>passPhrase</i> = QByteArray())</li><li><div class="fn" />QByteArray <b><a href="qsslkey.html#toPem">toPem</a></b> (<i>self</i>, QByteArray <i>passPhrase</i> = QByteArray())</li><li><div class="fn" />QSsl.KeyType <b><a href="qsslkey.html#type">type</a></b> (<i>self</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qsslkey.html#__eq__">__eq__</a></b> (<i>self</i>, QSslKey <i>key</i>)</li><li><div class="fn" />bool <b><a href="qsslkey.html#__ne__">__ne__</a></b> (<i>self</i>, QSslKey <i>key</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QSslKey class provides an interface for private and public keys.</p> <p>QSslKey provides a simple API for managing keys.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QSslKey" />QSslKey.__init__ (<i>self</i>)</h3><p>Constructs a null key.</p> <p><b>See also</b> <a href="qsslkey.html#isNull">isNull</a>().</p> <h3 class="fn"><a name="QSslKey-2" />QSslKey.__init__ (<i>self</i>, <a href="qbytearray.html">QByteArray</a> <i>encoded</i>, <a href="qssl.html#KeyAlgorithm-enum">QSsl.KeyAlgorithm</a> <i>algorithm</i>, <a href="qssl.html#EncodingFormat-enum">QSsl.EncodingFormat</a> <i>encoding</i> = QSsl.Pem, <a href="qssl.html#KeyType-enum">QSsl.KeyType</a> <i>type</i> = QSsl.PrivateKey, <a href="qbytearray.html">QByteArray</a> <i>passPhrase</i> = QByteArray())</h3><p>Constructs a <a href="qsslkey.html">QSslKey</a> by decoding the string in the byte array <i>encoded</i> using a specified <i>algorithm</i> and <i>encoding</i> format. If the encoded key is encrypted, <i>passPhrase</i> is used to decrypt it. <i>type</i> specifies whether the key is public or private.</p> <p>After construction, use <a href="qsslkey.html#isNull">isNull</a>() to check if <i>encoded</i> contained a valid key.</p> <h3 class="fn"><a name="QSslKey-3" />QSslKey.__init__ (<i>self</i>, <a href="qiodevice.html">QIODevice</a> <i>device</i>, <a href="qssl.html#KeyAlgorithm-enum">QSsl.KeyAlgorithm</a> <i>algorithm</i>, <a href="qssl.html#EncodingFormat-enum">QSsl.EncodingFormat</a> <i>encoding</i> = QSsl.Pem, <a href="qssl.html#KeyType-enum">QSsl.KeyType</a> <i>type</i> = QSsl.PrivateKey, <a href="qbytearray.html">QByteArray</a> <i>passPhrase</i> = QByteArray())</h3><p>Constructs a <a href="qsslkey.html">QSslKey</a> by reading and decoding data from a <i>device</i> using a specified <i>algorithm</i> and <i>encoding</i> format. If the encoded key is encrypted, <i>passPhrase</i> is used to decrypt it. <i>type</i> specifies whether the key is public or private.</p> <p>After construction, use <a href="qsslkey.html#isNull">isNull</a>() to check if <i>device</i> provided a valid key.</p> <h3 class="fn"><a name="QSslKey-4" />QSslKey.__init__ (<i>self</i>, <a href="qsslkey.html">QSslKey</a> <i>other</i>)</h3><p>Constructs an identical copy of <i>other</i>.</p> <h3 class="fn"><a name="algorithm" /><a href="qssl.html#KeyAlgorithm-enum">QSsl.KeyAlgorithm</a> QSslKey.algorithm (<i>self</i>)</h3><p>Returns the key algorithm.</p> <h3 class="fn"><a name="clear" />QSslKey.clear (<i>self</i>)</h3><p>Clears the contents of this key, making it a null key.</p> <p><b>See also</b> <a href="qsslkey.html#isNull">isNull</a>().</p> <h3 class="fn"><a name="handle" />int QSslKey.handle (<i>self</i>)</h3><p>Returns a pointer to the native key handle, if it is available; otherwise a null pointer is returned.</p> <p>You can use this handle together with the native API to access extended information about the key.</p> <p><b>Warning:</b> Use of this function has a high probability of being non-portable, and its return value may vary across platforms, and between minor Qt releases.</p> <h3 class="fn"><a name="isNull" />bool QSslKey.isNull (<i>self</i>)</h3><p>Returns true if this is a null key; otherwise false.</p> <p><b>See also</b> <a href="qsslkey.html#clear">clear</a>().</p> <h3 class="fn"><a name="length" />int QSslKey.length (<i>self</i>)</h3><p>Returns the length of the key in bits, or -1 if the key is null.</p> <h3 class="fn"><a name="toDer" /><a href="qbytearray.html">QByteArray</a> QSslKey.toDer (<i>self</i>, <a href="qbytearray.html">QByteArray</a> <i>passPhrase</i> = QByteArray())</h3><p>Returns the key in DER encoding. The result is encrypted with <i>passPhrase</i> if the key is a private key and <i>passPhrase</i> is non-empty.</p> <h3 class="fn"><a name="toPem" /><a href="qbytearray.html">QByteArray</a> QSslKey.toPem (<i>self</i>, <a href="qbytearray.html">QByteArray</a> <i>passPhrase</i> = QByteArray())</h3><p>Returns the key in PEM encoding. The result is encrypted with <i>passPhrase</i> if the key is a private key and <i>passPhrase</i> is non-empty.</p> <h3 class="fn"><a name="type" /><a href="qssl.html#KeyType-enum">QSsl.KeyType</a> QSslKey.type (<i>self</i>)</h3><p>Returns the type of the key (i.e., PublicKey or PrivateKey).</p> <h3 class="fn"><a name="__eq__" />bool QSslKey.__eq__ (<i>self</i>, <a href="qsslkey.html">QSslKey</a> <i>key</i>)</h3><h3 class="fn"><a name="__ne__" />bool QSslKey.__ne__ (<i>self</i>, <a href="qsslkey.html">QSslKey</a> <i>key</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>