def test_04_random(self):
     config = current_app.config
     hsm = DefaultSecurityModule({"file": config.get("PI_ENCFILE"),
                                  "crypted": True})
     r = hsm.random(20)
     self.assertTrue(len(r) == 20, r)
     self.assertFalse(hsm.is_ready)
 def test_04_random(self):
     config = current_app.config
     hsm = DefaultSecurityModule({"file": config.get("PI_ENCFILE"),
                                  "crypted": True})
     r = hsm.random(20)
     self.assertTrue(len(r) == 20, r)
     self.assertFalse(hsm.is_ready)
Beispiel #3
0
def create_enckey():
    """
    If the key of the given configuration does not exist, it will be created
    """
    print
    filename = app.config.get("PI_ENCFILE")
    if os.path.isfile(filename):
        print("The file \n\t%s\nalready exist. We do not overwrite it!" %
              filename)
        sys.exit(1)
    f = open(filename, "w")
    f.write(DefaultSecurityModule.random(96))
    f.close()
    print "Encryption key written to %s" % filename
    print "Please ensure to set the access rights for the correct user to 400!"