IMG = "test.img"
PASSWORD = "password"
+PASSWORD2 = "password2"
DEVICE = "pycryptsetup_test_dev"
def log(pri, txt):
return
def askyes(txt):
- print "Asking about:", txt, "\n"
+ print "Question:", txt
return 1
def askpassword(txt):
r = c.isLuks()
print "isLuks :", r
-c.luksFormat()
+c.askyes(message = "Is there anybody out there?")
+c.log(priority = 1, message = "Nobody there...\n")
+c.luksFormat(cipher = "aes", cipherMode= "xts-plain64", keysize = 512)
print "isLuks :", c.isLuks()
print "luksUUID:", c.luksUUID()
-print "addKey :", c.addKeyByVolumeKey(PASSWORD)
+print "addKeyVK:", c.addKeyByVolumeKey(newPassphrase = PASSWORD, slot = 2)
+print "addKeyP :", c.addKeyByPassphrase(passphrase = PASSWORD,
+ newPassphrase = PASSWORD2, slot = 3)
+print "removeP :", c.removePassphrase(passphrase = PASSWORD2)
+print "addKeyP :", c.addKeyByPassphrase(PASSWORD, PASSWORD2)
+# original api required wrong passphrase paramater here
+# print "killSlot:", c.killSlot(passphrase = "xxx", slot = 0)
+print "killSlot:", c.killSlot(slot = 0)
print "activate:", c.activate(name = DEVICE, passphrase = PASSWORD)
+print "suspend :", c.suspend()
+# os.system("dmsetup info -c " + DEVICE)
+print "resume :", c.resume(passphrase = PASSWORD)
print "status :", c.status()
info = c.info()
print "cipher :", info["cipher"]
print "cmode :", info["cipher_mode"]
+print "keysize :", info["keysize"]
+print "dir :", info["dir"]
+print "device :", info["device"]
+print "offset :", info["offset"]
+print "name :", info["name"]
+print "uuid :", info["uuid"]
+# os.system("cryptsetup luksDump " + info["device"])
print "deact. :", c.deactivate()
del c