HEX
Server: Apache/2.4.41 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40
System: Linux ip-172-31-40-18 4.14.146-93.123.amzn1.x86_64 #1 SMP Tue Sep 24 00:45:23 UTC 2019 x86_64
User: apache (48)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: //usr/share/doc/python27-paramiko-1.15.1/docs/api/keys.html
<!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/html; charset=utf-8" />
    
    <title>Key handling &mdash; Paramiko  documentation</title>
    
    <link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="top" title="Paramiko  documentation" href="../index.html" />
    <link rel="next" title="GSS-API authentication" href="ssh_gss.html" />
    <link rel="prev" title="Host keys / known_hosts files" href="hostkeys.html" />
   
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">

  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="ssh_gss.html" title="GSS-API authentication"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="hostkeys.html" title="Host keys / known_hosts files"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">Paramiko  documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="key-handling">
<h1>Key handling<a class="headerlink" href="#key-handling" title="Permalink to this headline">¶</a></h1>
<div class="section" id="module-paramiko.pkey">
<span id="parent-key-class"></span><h2>Parent key class<a class="headerlink" href="#module-paramiko.pkey" title="Permalink to this headline">¶</a></h2>
<p>Common API for all public keys.</p>
<dl class="class">
<dt id="paramiko.pkey.PKey">
<em class="property">class </em><tt class="descclassname">paramiko.pkey.</tt><tt class="descname">PKey</tt><big>(</big><em>msg=None</em>, <em>data=None</em><big>)</big><a class="headerlink" href="#paramiko.pkey.PKey" title="Permalink to this definition">¶</a></dt>
<dd><p>Base class for public keys.</p>
<dl class="method">
<dt id="paramiko.pkey.PKey.__cmp__">
<tt class="descname">__cmp__</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#paramiko.pkey.PKey.__cmp__" title="Permalink to this definition">¶</a></dt>
<dd><p>Compare this key to another.  Returns 0 if this key is equivalent to
the given key, or non-0 if they are different.  Only the public parts
of the key are compared, so a public key will compare equal to its
corresponding private key.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>other</strong> (<em>.Pkey</em>) &#8211; key to compare to.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="paramiko.pkey.PKey.__init__">
<tt class="descname">__init__</tt><big>(</big><em>msg=None</em>, <em>data=None</em><big>)</big><a class="headerlink" href="#paramiko.pkey.PKey.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a new instance of this public key type.  If <tt class="docutils literal"><span class="pre">msg</span></tt> is given,
the key&#8217;s public part(s) will be filled in from the message.  If
<tt class="docutils literal"><span class="pre">data</span></tt> is given, the key&#8217;s public part(s) will be filled in from
the string.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>msg</strong> (<em>.Message</em>) &#8211; an optional SSH <a class="reference internal" href="message.html#paramiko.message.Message" title="paramiko.message.Message"><tt class="xref py py-obj docutils literal"><span class="pre">Message</span></tt></a> containing a public key of this type.</li>
<li><strong>data</strong> (<a class="reference external" href="http://docs.python.org/2.6/library/functions.html#str" title="(in Python v2.6)"><em>str</em></a>) &#8211; an optional string containing a public key of this type</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name" colspan="2">Raises SSHException:</th></tr>
<tr class="field-even field"><td>&nbsp;</td><td class="field-body"><p class="first last">if a key cannot be created from the <tt class="docutils literal"><span class="pre">data</span></tt> or <tt class="docutils literal"><span class="pre">msg</span></tt> given, or
no key was passed in.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="paramiko.pkey.PKey.__weakref__">
<tt class="descname">__weakref__</tt><a class="headerlink" href="#paramiko.pkey.PKey.__weakref__" title="Permalink to this definition">¶</a></dt>
<dd><p>list of weak references to the object (if defined)</p>
</dd></dl>

<dl class="method">
<dt id="paramiko.pkey.PKey.asbytes">
<tt class="descname">asbytes</tt><big>(</big><big>)</big><a class="headerlink" href="#paramiko.pkey.PKey.asbytes" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a string of an SSH <a class="reference internal" href="message.html#paramiko.message.Message" title="paramiko.message.Message"><tt class="xref py py-obj docutils literal"><span class="pre">Message</span></tt></a> made up of the public part(s) of
this key.  This string is suitable for passing to <a class="reference internal" href="#paramiko.pkey.PKey.__init__" title="paramiko.pkey.PKey.__init__"><tt class="xref py py-obj docutils literal"><span class="pre">__init__</span></tt></a> to
re-create the key object later.</p>
</dd></dl>

<dl class="method">
<dt id="paramiko.pkey.PKey.can_sign">
<tt class="descname">can_sign</tt><big>(</big><big>)</big><a class="headerlink" href="#paramiko.pkey.PKey.can_sign" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <tt class="docutils literal"><span class="pre">True</span></tt> if this key has the private part necessary for signing
data.</p>
</dd></dl>

<dl class="classmethod">
<dt id="paramiko.pkey.PKey.from_private_key">
<em class="property">classmethod </em><tt class="descname">from_private_key</tt><big>(</big><em>file_obj</em>, <em>password=None</em><big>)</big><a class="headerlink" href="#paramiko.pkey.PKey.from_private_key" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a key object by reading a private key from a file (or file-like)
object.  If the private key is encrypted and <tt class="docutils literal"><span class="pre">password</span></tt> is not <tt class="docutils literal"><span class="pre">None</span></tt>,
the given password will be used to decrypt the key (otherwise
<a class="reference internal" href="ssh_exception.html#paramiko.ssh_exception.PasswordRequiredException" title="paramiko.ssh_exception.PasswordRequiredException"><tt class="xref py py-obj docutils literal"><span class="pre">PasswordRequiredException</span></tt></a> is thrown).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>file_obj</strong> (<a class="reference external" href="http://docs.python.org/2.6/library/functions.html#file" title="(in Python v2.6)"><em>file</em></a>) &#8211; the file to read from</li>
<li><strong>password</strong> (<a class="reference external" href="http://docs.python.org/2.6/library/functions.html#str" title="(in Python v2.6)"><em>str</em></a>) &#8211; an optional password to use to decrypt the key, if it&#8217;s encrypted</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a new <a class="reference internal" href="#paramiko.pkey.PKey" title="paramiko.pkey.PKey"><tt class="xref py py-obj docutils literal"><span class="pre">PKey</span></tt></a> based on the given private key</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><strong>IOError</strong> &#8211; if there was an error reading the key</li>
<li><strong>PasswordRequiredException</strong> &#8211; if the private key file is encrypted,
and <tt class="docutils literal"><span class="pre">password</span></tt> is <tt class="docutils literal"><span class="pre">None</span></tt></li>
<li><strong>SSHException</strong> &#8211; if the key file is invalid</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="classmethod">
<dt id="paramiko.pkey.PKey.from_private_key_file">
<em class="property">classmethod </em><tt class="descname">from_private_key_file</tt><big>(</big><em>filename</em>, <em>password=None</em><big>)</big><a class="headerlink" href="#paramiko.pkey.PKey.from_private_key_file" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a key object by reading a private key file.  If the private
key is encrypted and <tt class="docutils literal"><span class="pre">password</span></tt> is not <tt class="docutils literal"><span class="pre">None</span></tt>, the given password
will be used to decrypt the key (otherwise <a class="reference internal" href="ssh_exception.html#paramiko.ssh_exception.PasswordRequiredException" title="paramiko.ssh_exception.PasswordRequiredException"><tt class="xref py py-obj docutils literal"><span class="pre">PasswordRequiredException</span></tt></a>
is thrown).  Through the magic of Python, this factory method will
exist in all subclasses of PKey (such as <a class="reference internal" href="#paramiko.rsakey.RSAKey" title="paramiko.rsakey.RSAKey"><tt class="xref py py-obj docutils literal"><span class="pre">RSAKey</span></tt></a> or <a class="reference internal" href="#paramiko.dsskey.DSSKey" title="paramiko.dsskey.DSSKey"><tt class="xref py py-obj docutils literal"><span class="pre">DSSKey</span></tt></a>), but
is useless on the abstract PKey class.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>filename</strong> (<a class="reference external" href="http://docs.python.org/2.6/library/functions.html#str" title="(in Python v2.6)"><em>str</em></a>) &#8211; name of the file to read</li>
<li><strong>password</strong> (<a class="reference external" href="http://docs.python.org/2.6/library/functions.html#str" title="(in Python v2.6)"><em>str</em></a>) &#8211; an optional password to use to decrypt the key file,
if it&#8217;s encrypted</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a new <a class="reference internal" href="#paramiko.pkey.PKey" title="paramiko.pkey.PKey"><tt class="xref py py-obj docutils literal"><span class="pre">PKey</span></tt></a> based on the given private key</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><strong>IOError</strong> &#8211; if there was an error reading the file</li>
<li><strong>PasswordRequiredException</strong> &#8211; if the private key file is
encrypted, and <tt class="docutils literal"><span class="pre">password</span></tt> is <tt class="docutils literal"><span class="pre">None</span></tt></li>
<li><strong>SSHException</strong> &#8211; if the key file is invalid</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="paramiko.pkey.PKey.get_base64">
<tt class="descname">get_base64</tt><big>(</big><big>)</big><a class="headerlink" href="#paramiko.pkey.PKey.get_base64" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a base64 string containing the public part of this key.  Nothing
secret is revealed.  This format is compatible with that used to store
public key files or recognized host keys.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">a base64 <a class="reference external" href="http://docs.python.org/2.6/library/functions.html#str" title="(in Python v2.6)"><tt class="xref py py-obj docutils literal"><span class="pre">string</span></tt></a> containing the public part of the key.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="paramiko.pkey.PKey.get_bits">
<tt class="descname">get_bits</tt><big>(</big><big>)</big><a class="headerlink" href="#paramiko.pkey.PKey.get_bits" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the number of significant bits in this key.  This is useful
for judging the relative security of a key.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">bits in the key (as an <a class="reference external" href="http://docs.python.org/2.6/library/functions.html#int" title="(in Python v2.6)"><tt class="xref py py-obj docutils literal"><span class="pre">int</span></tt></a>)</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="paramiko.pkey.PKey.get_fingerprint">
<tt class="descname">get_fingerprint</tt><big>(</big><big>)</big><a class="headerlink" href="#paramiko.pkey.PKey.get_fingerprint" title="Permalink to this definition">¶</a></dt>
<dd><p>Return an MD5 fingerprint of the public part of this key.  Nothing
secret is revealed.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">a 16-byte <a class="reference external" href="http://docs.python.org/2.6/library/functions.html#str" title="(in Python v2.6)"><tt class="xref py py-obj docutils literal"><span class="pre">string</span></tt></a> (binary) of the MD5 fingerprint, in SSH
format.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="paramiko.pkey.PKey.get_name">
<tt class="descname">get_name</tt><big>(</big><big>)</big><a class="headerlink" href="#paramiko.pkey.PKey.get_name" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the name of this private key implementation.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">name of this private key type, in SSH terminology, as a <a class="reference external" href="http://docs.python.org/2.6/library/functions.html#str" title="(in Python v2.6)"><tt class="xref py py-obj docutils literal"><span class="pre">str</span></tt></a> (for
example, <tt class="docutils literal"><span class="pre">&quot;ssh-rsa&quot;</span></tt>).</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="paramiko.pkey.PKey.sign_ssh_data">
<tt class="descname">sign_ssh_data</tt><big>(</big><em>data</em><big>)</big><a class="headerlink" href="#paramiko.pkey.PKey.sign_ssh_data" title="Permalink to this definition">¶</a></dt>
<dd><p>Sign a blob of data with this private key, and return a <a class="reference internal" href="message.html#paramiko.message.Message" title="paramiko.message.Message"><tt class="xref py py-obj docutils literal"><span class="pre">Message</span></tt></a>
representing an SSH signature message.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> (<a class="reference external" href="http://docs.python.org/2.6/library/functions.html#str" title="(in Python v2.6)"><em>str</em></a>) &#8211; the data to sign.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">an SSH signature <a class="reference internal" href="message.html#paramiko.message.Message" title="paramiko.message.Message"><tt class="xref py py-obj docutils literal"><span class="pre">message</span></tt></a>.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="paramiko.pkey.PKey.verify_ssh_sig">
<tt class="descname">verify_ssh_sig</tt><big>(</big><em>data</em>, <em>msg</em><big>)</big><a class="headerlink" href="#paramiko.pkey.PKey.verify_ssh_sig" title="Permalink to this definition">¶</a></dt>
<dd><p>Given a blob of data, and an SSH message representing a signature of
that data, verify that it was signed with this key.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>data</strong> (<a class="reference external" href="http://docs.python.org/2.6/library/functions.html#str" title="(in Python v2.6)"><em>str</em></a>) &#8211; the data that was signed.</li>
<li><strong>msg</strong> (<em>.Message</em>) &#8211; an SSH signature message</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><tt class="docutils literal"><span class="pre">True</span></tt> if the signature verifies correctly; <tt class="docutils literal"><span class="pre">False</span></tt> otherwise.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="paramiko.pkey.PKey.write_private_key">
<tt class="descname">write_private_key</tt><big>(</big><em>file_obj</em>, <em>password=None</em><big>)</big><a class="headerlink" href="#paramiko.pkey.PKey.write_private_key" title="Permalink to this definition">¶</a></dt>
<dd><p>Write private key contents into a file (or file-like) object.  If the
password is not <tt class="docutils literal"><span class="pre">None</span></tt>, the key is encrypted before writing.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>file_obj</strong> (<a class="reference external" href="http://docs.python.org/2.6/library/functions.html#file" title="(in Python v2.6)"><em>file</em></a>) &#8211; the file object to write into</li>
<li><strong>password</strong> (<a class="reference external" href="http://docs.python.org/2.6/library/functions.html#str" title="(in Python v2.6)"><em>str</em></a>) &#8211; an optional password to use to encrypt the key</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><strong>IOError</strong> &#8211; if there was an error writing to the file</li>
<li><strong>SSHException</strong> &#8211; if the key is invalid</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="paramiko.pkey.PKey.write_private_key_file">
<tt class="descname">write_private_key_file</tt><big>(</big><em>filename</em>, <em>password=None</em><big>)</big><a class="headerlink" href="#paramiko.pkey.PKey.write_private_key_file" title="Permalink to this definition">¶</a></dt>
<dd><p>Write private key contents into a file.  If the password is not
<tt class="docutils literal"><span class="pre">None</span></tt>, the key is encrypted before writing.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>filename</strong> (<a class="reference external" href="http://docs.python.org/2.6/library/functions.html#str" title="(in Python v2.6)"><em>str</em></a>) &#8211; name of the file to write</li>
<li><strong>password</strong> (<a class="reference external" href="http://docs.python.org/2.6/library/functions.html#str" title="(in Python v2.6)"><em>str</em></a>) &#8211; an optional password to use to encrypt the key file</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><strong>IOError</strong> &#8211; if there was an error writing the file</li>
<li><strong>SSHException</strong> &#8211; if the key is invalid</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-paramiko.dsskey">
<span id="dsa-dss"></span><h2>DSA (DSS)<a class="headerlink" href="#module-paramiko.dsskey" title="Permalink to this headline">¶</a></h2>
<p>DSS keys.</p>
<dl class="class">
<dt id="paramiko.dsskey.DSSKey">
<em class="property">class </em><tt class="descclassname">paramiko.dsskey.</tt><tt class="descname">DSSKey</tt><big>(</big><em>msg=None</em>, <em>data=None</em>, <em>filename=None</em>, <em>password=None</em>, <em>vals=None</em>, <em>file_obj=None</em><big>)</big><a class="headerlink" href="#paramiko.dsskey.DSSKey" title="Permalink to this definition">¶</a></dt>
<dd><p>Representation of a DSS key which can be used to sign an verify SSH2
data.</p>
<dl class="staticmethod">
<dt id="paramiko.dsskey.DSSKey.generate">
<em class="property">static </em><tt class="descname">generate</tt><big>(</big><em>bits=1024</em>, <em>progress_func=None</em><big>)</big><a class="headerlink" href="#paramiko.dsskey.DSSKey.generate" title="Permalink to this definition">¶</a></dt>
<dd><p>Generate a new private DSS key.  This factory function can be used to
generate a new host key or authentication key.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>bits</strong> (<a class="reference external" href="http://docs.python.org/2.6/library/functions.html#int" title="(in Python v2.6)"><em>int</em></a>) &#8211; number of bits the generated key should be.</li>
<li><strong>progress_func</strong> (<em>function</em>) &#8211; an optional function to call at key points in key generation (used
by <tt class="docutils literal"><span class="pre">pyCrypto.PublicKey</span></tt>).</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">new <a class="reference internal" href="#paramiko.dsskey.DSSKey" title="paramiko.dsskey.DSSKey"><tt class="xref py py-obj docutils literal"><span class="pre">DSSKey</span></tt></a> private key</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-paramiko.rsakey">
<span id="rsa"></span><h2>RSA<a class="headerlink" href="#module-paramiko.rsakey" title="Permalink to this headline">¶</a></h2>
<p>RSA keys.</p>
<dl class="class">
<dt id="paramiko.rsakey.RSAKey">
<em class="property">class </em><tt class="descclassname">paramiko.rsakey.</tt><tt class="descname">RSAKey</tt><big>(</big><em>msg=None</em>, <em>data=None</em>, <em>filename=None</em>, <em>password=None</em>, <em>vals=None</em>, <em>file_obj=None</em><big>)</big><a class="headerlink" href="#paramiko.rsakey.RSAKey" title="Permalink to this definition">¶</a></dt>
<dd><p>Representation of an RSA key which can be used to sign and verify SSH2
data.</p>
<dl class="staticmethod">
<dt id="paramiko.rsakey.RSAKey.generate">
<em class="property">static </em><tt class="descname">generate</tt><big>(</big><em>bits</em>, <em>progress_func=None</em><big>)</big><a class="headerlink" href="#paramiko.rsakey.RSAKey.generate" title="Permalink to this definition">¶</a></dt>
<dd><p>Generate a new private RSA key.  This factory function can be used to
generate a new host key or authentication key.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>bits</strong> (<a class="reference external" href="http://docs.python.org/2.6/library/functions.html#int" title="(in Python v2.6)"><em>int</em></a>) &#8211; number of bits the generated key should be.</li>
<li><strong>progress_func</strong> (<em>function</em>) &#8211; an optional function to call at key points in key generation (used
by <tt class="docutils literal"><span class="pre">pyCrypto.PublicKey</span></tt>).</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">new <a class="reference internal" href="#paramiko.rsakey.RSAKey" title="paramiko.rsakey.RSAKey"><tt class="xref py py-obj docutils literal"><span class="pre">RSAKey</span></tt></a> private key</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-paramiko.ecdsakey">
<span id="ecdsa"></span><h2>ECDSA<a class="headerlink" href="#module-paramiko.ecdsakey" title="Permalink to this headline">¶</a></h2>
<p>ECDSA keys</p>
<dl class="class">
<dt id="paramiko.ecdsakey.ECDSAKey">
<em class="property">class </em><tt class="descclassname">paramiko.ecdsakey.</tt><tt class="descname">ECDSAKey</tt><big>(</big><em>msg=None</em>, <em>data=None</em>, <em>filename=None</em>, <em>password=None</em>, <em>vals=None</em>, <em>file_obj=None</em>, <em>validate_point=True</em><big>)</big><a class="headerlink" href="#paramiko.ecdsakey.ECDSAKey" title="Permalink to this definition">¶</a></dt>
<dd><p>Representation of an ECDSA key which can be used to sign and verify SSH2
data.</p>
<dl class="staticmethod">
<dt id="paramiko.ecdsakey.ECDSAKey.generate">
<em class="property">static </em><tt class="descname">generate</tt><big>(</big><em>curve=&lt;ecdsa.curves.Curve instance at 0x10cb94d88&gt;</em>, <em>progress_func=None</em><big>)</big><a class="headerlink" href="#paramiko.ecdsakey.ECDSAKey.generate" title="Permalink to this definition">¶</a></dt>
<dd><p>Generate a new private RSA key.  This factory function can be used to
generate a new host key or authentication key.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>progress_func</strong> (<em>function</em>) &#8211; an optional function to call at key points in key generation (used
by <tt class="docutils literal"><span class="pre">pyCrypto.PublicKey</span></tt>).</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A new private key (<a class="reference internal" href="#paramiko.rsakey.RSAKey" title="paramiko.rsakey.RSAKey"><tt class="xref py py-obj docutils literal"><span class="pre">RSAKey</span></tt></a>) object</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="../index.html">Paramiko</a></h1>



<p class="blurb">A Python implementation of SSHv2.</p>



<p>
<iframe src="http://ghbtns.com/github-btn.html?user=paramiko&repo=paramiko&type=watch&count=true&size=large"
  allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px"></iframe>
</p>




    

<p>
<a href="https://travis-ci.org/paramiko/paramiko">
    <img
        alt="https://secure.travis-ci.org/paramiko/paramiko.png?branch=master"
        src="https://secure.travis-ci.org/paramiko/paramiko.png?branch=master"
    >
</a>
</p>
<h3>Navigation</h3>
<ul>
<li class="toctree-l1"><a class="reference internal" href="channel.html">Channel</a></li>
<li class="toctree-l1"><a class="reference internal" href="client.html">Client</a></li>
<li class="toctree-l1"><a class="reference internal" href="message.html">Message</a></li>
<li class="toctree-l1"><a class="reference internal" href="packet.html">Packetizer</a></li>
<li class="toctree-l1"><a class="reference internal" href="transport.html">Transport</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="agent.html">SSH agents</a></li>
<li class="toctree-l1"><a class="reference internal" href="hostkeys.html">Host keys / <tt class="docutils literal"><span class="pre">known_hosts</span></tt> files</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Key handling</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#module-paramiko.pkey">Parent key class</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-paramiko.dsskey">DSA (DSS)</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-paramiko.rsakey">RSA</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-paramiko.ecdsakey">ECDSA</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="ssh_gss.html">GSS-API authentication</a></li>
<li class="toctree-l1"><a class="reference internal" href="kex_gss.html">GSS-API key exchange</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="config.html">Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="proxy.html"><tt class="docutils literal"><span class="pre">ProxyCommand</span></tt> support</a></li>
<li class="toctree-l1"><a class="reference internal" href="server.html">Server implementation</a></li>
<li class="toctree-l1"><a class="reference internal" href="sftp.html">SFTP</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="buffered_pipe.html">Buffered pipes</a></li>
<li class="toctree-l1"><a class="reference internal" href="file.html">Buffered files</a></li>
<li class="toctree-l1"><a class="reference internal" href="pipe.html">Cross-platform pipe implementations</a></li>
<li class="toctree-l1"><a class="reference internal" href="ssh_exception.html">Exceptions</a></li>
</ul>


<hr />
<ul>
    
    <li class="toctree-l1"><a href="http://www.paramiko.org">Main website</a></li>
    
</ul>

<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
<h3>Donate</h3>
<p>
Consider supporting the authors on <a href="https://www.gratipay.com/">Gratipay</a>:
<script data-gratipay-username="bitprophet"
        data-gratipay-widget="button"
        src="//gttp.co/v1.js"></script>
</p>

        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
      &copy;2014 Jeff Forcier.
      
      |
      Powered by <a href="http://sphinx-doc.org/">Sphinx 1.2.2</a>
      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.6.1</a>
      
      |
      <a href="../_sources/api/keys.txt"
          rel="nofollow">Page source</a></li>
    </div>

    

    
    <script type="text/javascript">

      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-18486793-2']);
      _gaq.push(['_setDomainName', 'none']);
      _gaq.push(['_setAllowLinker', true]);
      _gaq.push(['_trackPageview']);

      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();

    </script>
    
  </body>
</html>