Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
paramiko.ed25519key
#7
HI Nilamo,
Thanks for sticking with me.

I am moving forward, but not quite there yet.
C:\Users\Comp1\Documents\Work\Old>Host_FingerPrint_SFTP.py Yay.txt
Traceback (most recent call last):
  File "C:\Users\Comp1\Documents\Work\Old\Host_FingerPrint_SFTP.py",
 line 17, in <module>
    key = paramiko.ed25519key.Ed25519Key(data=text.encode())
  File "C:\Users\Comp1\AppData\Local\Programs\Python\Python37-32\lib\site-p
ackages\paramiko\ed25519key.py", line 71, in __init__
    cert_type="[email protected]",
  File "C:\Users\Comp1\AppData\Local\Programs\Python\Python37-32\lib\site-p
ackages\paramiko\pkey.py", line 416, in _check_type_and_load_cert
    raise SSHException(err.format(self.__class__.__name__, type_))
paramiko.ssh_exception.SSHException: Invalid key (class: Ed25519Key, data type:
5db5b8556c55d47aa661ea39b4b794e823a6f82066da73c4761243fe21da
This makes me think that the key i copied from File Zilla is wrong (either i copied it wrong which i have checked) or (else it is not the real key...?)

Sorry,
the code i used below is
import pysftp
import sys
import paramiko
from paramiko.py3compat import decodebytes
import base64
 
path = './folder/' + sys.argv[1]    #hard-coded
localpath = sys.argv[1]  
 
remote_path = "./work/" 				    #hard-coded
host = "1.2.3.4"                    	#hard-coded
password = "password"               #hard-coded
username = "username"                			#hard-coded
 
keydata = b"""RLhdtbhVbFXUeqZh6jm0t5ToI6b4IGbac8R2EkP+Ido=""" #obtained using filezilla, connected successfully then used lock icon on the bottom right to display fingerprints: SHA256: RLh...kP+Ido=
text = base64.b64decode(keydata).hex()
key = paramiko.ed25519key.Ed25519Key(data=text.encode())
cnopts = pysftp.CnOpts()
cnopts.hostkeys.add('1.2.3.4', 'ssh-ed25519', key)
 
 
with pysftp.Connection(host, username=username, password=password, cnopts=cnopts) as sftp:
    sftp.put(localpath, path)
 
print("Upload done")
Reply


Messages In This Thread
paramiko.ed25519key - by cverm - Nov-30-2018, 08:31 PM
RE: paramiko.ed25519key - by nilamo - Nov-30-2018, 09:25 PM
RE: paramiko.ed25519key - by cverm - Dec-03-2018, 01:18 PM
RE: paramiko.ed25519key - by nilamo - Dec-03-2018, 05:11 PM
RE: paramiko.ed25519key - by cverm - Dec-06-2018, 01:04 PM
RE: paramiko.ed25519key - by nilamo - Dec-06-2018, 03:45 PM
RE: paramiko.ed25519key - by cverm - Dec-06-2018, 08:26 PM
RE: paramiko.ed25519key - by nilamo - Dec-06-2018, 08:39 PM
RE: paramiko.ed25519key - by cverm - Dec-07-2018, 11:47 AM
RE: paramiko.ed25519key - by nilamo - Dec-07-2018, 03:59 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020