+
+ (fd, path) = tempfile.mkstemp("", "sshkeytry")
+ f = open(path, "w")
+ f.write(Str)
+ f.close
+ (result, output) = commands.getstatusoutput("ssh-keygen -f %s -l" % (path))
+ os.remove(path)
+ if (result != 0):
+ sys.stderr.write("ssh-keygen -l invocation failed!\n%s\n" % (output))
+ sys.exit(result)
+
+ Match = SSHFingerprint.match(output)
+
+ g = Match.groups()
+ if (g[0] < 1024):
+ return "SSH keys must have at least 1024 bits, not added"
+ elif g[0] in badkeys:
+ return "Submitted SSH Key known to be bad and insecure, not added"
+