예제 #1
0
 def clean_ssh_key(self):
     if self.cleaned_data.get("ssh_key") is not None:
         got = self.cleaned_data['ssh_key'].read()
         self.cleaned_data['ssh_key'].seek(0)
         try:
             SSHKey(got, self.cleaned_data['password']).key_obj
         except paramiko.ssh_exception.SSHException as error:
             raise forms.ValidationError(error)
     return self.cleaned_data['ssh_key']
예제 #2
0
 def ssh_key_fingerprint(self):
     return SSHKey(self.ssh_key.read(), self.password).fingerprint()