Zum Hauptinhalt springen
Chris’ wirre Gedankenwelt
  1. posts/

sign data with your ssh-key

This is just a kind of stub. But however ;)

>>> import paramiko.agent

>>> a = paramiko.agent.Agent()
>>> k = a.get_keys()[0]
>>> d = k.sign_ssh_data(None, 'Hello World')
### Transfer d
>>> from paramiko import Message
>>> from paramiko.rsakey import RSAKey
>>> with open('id_rsa.pub') as f:
...     keytype, b64key, _ = f.next().strip().split(None, 2)
...
>>> import base64
>>> pkey = RSAKey(data=base64.b64decode(b64key))
>>> msg=Message(d)
>>> pkey.verify_ssh_sig('Hello World', msg)
True
>>> pkey.verify_ssh_sig('Hellö World', msg)
False

ssh-agent should run.