|
@@ -1,6 +1,7 @@
|
|
|
import os
|
|
|
import os.path
|
|
|
import sys
|
|
|
+from Crypto.Random import OSRNG
|
|
|
|
|
|
if 'darwin' in sys.platform:
|
|
|
from pwman.ui.mac import PwmanCliMac as PwmanCliOld
|
|
@@ -50,6 +51,19 @@ class SetupTester(object):
|
|
|
dbver = 0.4
|
|
|
dbtype = config.get_value("Database", "type")
|
|
|
db = pwman.data.factory.create(dbtype, dbver)
|
|
|
+ # TODO:
|
|
|
+ # use db to insert an encrypted password here to the table
|
|
|
+ # KEY
|
|
|
+ # This way the key will be passed by "SELECT THEKEY FROM KEY"
|
|
|
+ # and there won't be a any prompting for password
|
|
|
+ ce = CryptoEngine()
|
|
|
+ ce.set_callback(raw_input)
|
|
|
+ random = OSRNG.new()
|
|
|
+ key = str(random.read(32)).encode('base64')
|
|
|
+ password = '12345'
|
|
|
+ cipher = ce._getcipher_real(password, ce._algo)
|
|
|
+ cipher.encrypt(ce._preparedata(key,
|
|
|
+ cipher.block_size)).encode('base64')
|
|
|
self.cli = PwmanCliNew(db, self.xselpath)
|
|
|
|
|
|
|