1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- from pwman.util.crypto_engine import CryptoEngine
- __DB_FORMAT__ = 0.6
- class DatabaseException(Exception):
- pass
- class Database(object):
- def open(self, dbver=None):
- """
- Open the database, by calling the _open method of the
- class inherited for the specific database.
- When done validation that the file is OK, check if it has
- encryption key, by calling
- enc = CryptoEngine.get()
- key = self.loadkey()
- """
- self._open()
- enc = CryptoEngine.get()
- key = self.loadkey()
- if key is not None:
- enc.set_cryptedkey(key)
- else:
- self.get_user_password()
- def close(self):
- pass
- def get_user_password(self):
- """
- get the databases password from the user
- """
- enc = CryptoEngine.get()
- newkey = enc.changepassword()
- return self.savekey(newkey)
- def changepassword(self):
- """
- Change the databases password.
- """
-
-
-
-
-
-
-
- def listtags(self, all=False):
- pass
-
-
- def addnodes(self, nodes):
- pass
- def editnode(self, id, node):
- pass
- def removenodes(self, nodes):
- pass
- def listnodes(self):
- pass
- def savekey(self, key):
- pass
- def loadkey(self):
- pass
|