Example #1
0
    def initKey(self):
        retVal = ""
        if (Get(self.URI + "/keyfile", "keyfile")):
            #if os.path.isfile("keyfile"):
            self.cryptHandle = CryptHandler("keyfile", self.username,
                                            self.password, True)
        else:
            print "Failed to download remote keyfile, creating new one"
            open("keyfile", "w").close()

            self.cryptHandle = CryptHandler("keyfile", self.username,
                                            self.password, False)
            #self.cryptHandle.encryptKeyFile()
            path = self.cryptHandle.encryptKeyFile()
            retVal = Upload(path, str(self.URI + "/keyfile"))
            if (retVal != ''):
                print "Upload sucessful, retVal=" + str(retVal)
            else:
                print "Upload failed, retVal=" + str(retVal)