123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- 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(dbver=dbver)
- 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
|