Did I find the right examples for you? yes no

All Samples(31)  |  Call(31)  |  Derive(0)  |  Import(0)
Create a key object by reading a private key file.  If the private
key is encrypted and C{password} is not C{None}, the given password
will be used to decrypt the key (otherwise L{PasswordRequiredException}
is thrown).  Through the magic of python, this factory method will
exist in all subclasses of PKey (such as L{RSAKey} or L{DSSKey}), but
is useless on the abstract PKey class.

@param filename: name of the file to read
@type filename: str
@param password: an optional password to use to decrypt the key file,(more...)

src/s/s/ssh-1.8.0/demos/demo.py   ssh(Download)
            path = default_path
        try:
            key = ssh.RSAKey.from_private_key_file(path)
        except ssh.PasswordRequiredException:
            password = getpass.getpass('RSA key password: ')
            key = ssh.RSAKey.from_private_key_file(path, password)

src/s/s/ssh-HEAD/demos/demo.py   ssh(Download)
            path = default_path
        try:
            key = ssh.RSAKey.from_private_key_file(path)
        except ssh.PasswordRequiredException:
            password = getpass.getpass('RSA key password: ')
            key = ssh.RSAKey.from_private_key_file(path, password)

src/r/e/reductio-0.2.1/reductio/para_ssh.py   reductio(Download)
 
            private_key_file = os.path.expanduser(private_key)
            rsa_key = ssh.RSAKey.from_private_key_file(private_key_file)
            self._transport.connect(username = username, pkey = rsa_key)
 

src/s/s/ssh-1.8.0/tests/test_pkey.py   ssh(Download)
    def test_2_load_rsa(self):
        key = RSAKey.from_private_key_file('tests/test_rsa.key')
        self.assertEquals('ssh-rsa', key.get_name())
        exp_rsa = FINGER_RSA.split()[1].replace(':', '')
        my_rsa = hexlify(key.get_fingerprint())
    def test_3_load_rsa_password(self):
        key = RSAKey.from_private_key_file('tests/test_rsa_password.key', 'television')
        self.assertEquals('ssh-rsa', key.get_name())
        exp_rsa = FINGER_RSA.split()[1].replace(':', '')
        my_rsa = hexlify(key.get_fingerprint())
    def test_6_compare_rsa(self):
        # verify that the private & public keys compare equal
        key = RSAKey.from_private_key_file('tests/test_rsa.key')
        self.assertEquals(key, key)
        pub = RSAKey(data=str(key))
    def test_8_sign_rsa(self):
        # verify that the rsa private key can sign and verify
        key = RSAKey.from_private_key_file('tests/test_rsa.key')
        msg = key.sign_ssh_data(rng, 'ice weasels')
        self.assert_(type(msg) is Message)

src/s/s/ssh-HEAD/tests/test_pkey.py   ssh(Download)
    def test_2_load_rsa(self):
        key = RSAKey.from_private_key_file('tests/test_rsa.key')
        self.assertEquals('ssh-rsa', key.get_name())
        exp_rsa = FINGER_RSA.split()[1].replace(':', '')
        my_rsa = hexlify(key.get_fingerprint())
    def test_3_load_rsa_password(self):
        key = RSAKey.from_private_key_file('tests/test_rsa_password.key', 'television')
        self.assertEquals('ssh-rsa', key.get_name())
        exp_rsa = FINGER_RSA.split()[1].replace(':', '')
        my_rsa = hexlify(key.get_fingerprint())
    def test_6_compare_rsa(self):
        # verify that the private & public keys compare equal
        key = RSAKey.from_private_key_file('tests/test_rsa.key')
        self.assertEquals(key, key)
        pub = RSAKey(data=str(key))
    def test_8_sign_rsa(self):
        # verify that the rsa private key can sign and verify
        key = RSAKey.from_private_key_file('tests/test_rsa.key')
        msg = key.sign_ssh_data(rng, 'ice weasels')
        self.assert_(type(msg) is Message)

src/s/s/ssh-1.8.0/tests/test_sftp.py   ssh(Download)
        tc = t
        try:
            key = ssh.RSAKey.from_private_key_file(keyfile, passwd)
        except ssh.PasswordRequiredException:
            sys.stderr.write('\n\nssh.RSAKey.from_private_key_file REQUIRES PASSWORD.\n')
        ts = ssh.Transport(socks)
 
        host_key = ssh.RSAKey.from_private_key_file('tests/test_rsa.key')
        ts.add_server_key(host_key)
        event = threading.Event()

src/s/s/ssh-HEAD/tests/test_sftp.py   ssh(Download)
        tc = t
        try:
            key = ssh.RSAKey.from_private_key_file(keyfile, passwd)
        except ssh.PasswordRequiredException:
            sys.stderr.write('\n\nssh.RSAKey.from_private_key_file REQUIRES PASSWORD.\n')
        ts = ssh.Transport(socks)
 
        host_key = ssh.RSAKey.from_private_key_file('tests/test_rsa.key')
        ts.add_server_key(host_key)
        event = threading.Event()

src/s/s/ssh-HEAD/tests/test_client.py   ssh(Download)
    def _run(self):
        self.socks, addr = self.sockl.accept()
        self.ts = ssh.Transport(self.socks)
        host_key = ssh.RSAKey.from_private_key_file('tests/test_rsa.key')
        self.ts.add_server_key(host_key)
    def test_1_client(self):
        """
        verify that the SSHClient stuff works too.
        """
        host_key = ssh.RSAKey.from_private_key_file('tests/test_rsa.key')
    def test_2_client_dsa(self):
        """
        verify that SSHClient works with a DSA key.
        """
        host_key = ssh.RSAKey.from_private_key_file('tests/test_rsa.key')
    def test_3_multiple_key_files(self):
        """
        verify that SSHClient accepts and tries multiple key files.
        """
        host_key = ssh.RSAKey.from_private_key_file('tests/test_rsa.key')
    def test_4_auto_add_policy(self):
        """
        verify that SSHClient's AutoAddPolicy works.
        """
        host_key = ssh.RSAKey.from_private_key_file('tests/test_rsa.key')

src/s/s/ssh-HEAD/tests/test_auth.py   ssh(Download)
    def start_server(self):
        host_key = RSAKey.from_private_key_file('tests/test_rsa.key')
        self.public_host_key = RSAKey(data=str(host_key))
        self.ts.add_server_key(host_key)
        self.event = threading.Event()

src/s/s/ssh-1.8.0/tests/test_client.py   ssh(Download)
    def _run(self):
        self.socks, addr = self.sockl.accept()
        self.ts = ssh.Transport(self.socks)
        host_key = ssh.RSAKey.from_private_key_file('tests/test_rsa.key')
        self.ts.add_server_key(host_key)
    def test_1_client(self):
        """
        verify that the SSHClient stuff works too.
        """
        host_key = ssh.RSAKey.from_private_key_file('tests/test_rsa.key')
    def test_2_client_dsa(self):
        """
        verify that SSHClient works with a DSA key.
        """
        host_key = ssh.RSAKey.from_private_key_file('tests/test_rsa.key')
    def test_3_multiple_key_files(self):
        """
        verify that SSHClient accepts and tries multiple key files.
        """
        host_key = ssh.RSAKey.from_private_key_file('tests/test_rsa.key')
    def test_4_auto_add_policy(self):
        """
        verify that SSHClient's AutoAddPolicy works.
        """
        host_key = ssh.RSAKey.from_private_key_file('tests/test_rsa.key')

  1 | 2  Next